51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
![]() |
/*
|
||
|
* fml_ds90ub948.c
|
||
|
*
|
||
|
* Created on: 2025年4月10日
|
||
|
* Author: 22332
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include "cola_init.h"
|
||
|
#include "cola_device.h"
|
||
|
#include "bsp_register_map.h"
|
||
|
#include "fml_ds90ub948.h"
|
||
|
static cola_device_t *g_pDevDS948 = NULL;
|
||
|
void fml_ds90ub948_open(void)
|
||
|
{
|
||
|
g_pDevDS948 = cola_device_find("DS90UB948");
|
||
|
if(g_pDevDS948)
|
||
|
{
|
||
|
cola_device_open(g_pDevDS948, 0);
|
||
|
}
|
||
|
}
|
||
|
void fml_ds90ub948_close(void)
|
||
|
{
|
||
|
if(g_pDevDS948)
|
||
|
cola_device_close(g_pDevDS948);
|
||
|
|
||
|
}
|
||
|
void fml_ds90ub948_init(void *rxbuf, int rx_length,void *txbuf, int tx_length,void *fun,void *task)
|
||
|
{
|
||
|
g_pDevDS948 = cola_device_find("DS90UB948");
|
||
|
if(g_pDevDS948)
|
||
|
{
|
||
|
cola_device_ctrl(g_pDevDS948, 0, task);
|
||
|
ST_I2C_RX_TX stRxTxBuf;
|
||
|
stRxTxBuf.rxbuf = rxbuf;
|
||
|
stRxTxBuf.rxlength = rx_length;
|
||
|
stRxTxBuf.txbuf = txbuf;
|
||
|
stRxTxBuf.txlength = tx_length;
|
||
|
stRxTxBuf.fun = fun;
|
||
|
cola_device_ctrl(g_pDevDS948, 1, &stRxTxBuf);
|
||
|
cola_device_open(g_pDevDS948, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void fml_ds90ub948_read(uint8_t *pBuf,int len)
|
||
|
{
|
||
|
if(g_pDevDS948 == NULL)return;
|
||
|
cola_device_read(g_pDevDS948,0,pBuf,len);
|
||
|
}
|
||
|
|