cun
This commit is contained in:
@ -185,8 +185,8 @@ void sensor_collect_task(void){
|
||||
send_data.checkout_2 = 0xBB;
|
||||
send_data.foot = foot_init;
|
||||
send_data.package_index = package_index;
|
||||
// circle_buffer_write(&g_ble_send_cb, &send_data);
|
||||
// os_sem_post(&receiver_ready_sem); //通知另一个发送任务
|
||||
circle_buffer_write(&g_ble_send_cb, &send_data);
|
||||
os_sem_post(&receiver_ready_sem); //通知另一个发送任务
|
||||
|
||||
memset(&send_data, 0, sizeof(ble_send_data_t));
|
||||
memset(&accx_buf, 0, sizeof(accx_buf));
|
||||
@ -469,8 +469,8 @@ void test_func(void){
|
||||
acc_data_buf[i] = i;
|
||||
}
|
||||
|
||||
// SL_SC7U22_Config();
|
||||
// mmc5603nj_init();
|
||||
SL_SC7U22_Config();
|
||||
mmc5603nj_init();
|
||||
#if BMP280
|
||||
BMP280_init();
|
||||
#else
|
||||
|
||||
@ -28,73 +28,73 @@ static int32_t c00, c10;
|
||||
* @brief 写入单个字节到WF282A寄存器
|
||||
*/
|
||||
static void wf282a_write_reg(uint8_t reg, uint8_t data) {
|
||||
hw_iic_start(I2C_HANDLE);
|
||||
// 发送从设备地址 (写模式)
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_WRITE_ADDRESS)) {
|
||||
// 如果没有收到ACK,可能是设备不存在或忙,直接停止
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
// 可以添加错误日志或返回错误码
|
||||
xlog("WF282A Write: No ACK after slave address\n");
|
||||
return;
|
||||
}
|
||||
// 发送寄存器地址
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, reg)) {
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
xlog("WF282A Write: No ACK after register address\n");
|
||||
return;
|
||||
}
|
||||
// 发送数据字节
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, data)) {
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
xlog("WF282A Write: No ACK after data byte\n");
|
||||
return;
|
||||
}
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
// hw_iic_start(I2C_HANDLE);
|
||||
// // 发送从设备地址 (写模式)
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_WRITE_ADDRESS)) {
|
||||
// // 如果没有收到ACK,可能是设备不存在或忙,直接停止
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// // 可以添加错误日志或返回错误码
|
||||
// xlog("WF282A Write: No ACK after slave address\n");
|
||||
// return;
|
||||
// }
|
||||
// // 发送寄存器地址
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, reg)) {
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// xlog("WF282A Write: No ACK after register address\n");
|
||||
// return;
|
||||
// }
|
||||
// // 发送数据字节
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, data)) {
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// xlog("WF282A Write: No ACK after data byte\n");
|
||||
// return;
|
||||
// }
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
|
||||
// gravity_sensor_command(WF_IIC_WRITE_ADDRESS, reg, data);
|
||||
gravity_sensor_command(WF_IIC_WRITE_ADDRESS, reg, data);
|
||||
}
|
||||
/**
|
||||
* @brief 从WF282A读取多个字节
|
||||
*/
|
||||
static uint32_t wf282a_read_regs(uint8_t reg, uint8_t *buf, uint8_t len) {
|
||||
uint32_t bytes_read = 0;
|
||||
if (len == 0) return 0;
|
||||
// uint32_t bytes_read = 0;
|
||||
// if (len == 0) return 0;
|
||||
|
||||
hw_iic_start(I2C_HANDLE);
|
||||
// 1. 发送从设备地址 (写模式) 和寄存器地址
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_WRITE_ADDRESS)) {
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
xlog("WF282A Read: No ACK after slave address (write phase)\n");
|
||||
return 0;
|
||||
}
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, reg)) {
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
xlog("WF282A Read: No ACK after register address\n");
|
||||
return 0;
|
||||
}
|
||||
// hw_iic_start(I2C_HANDLE);
|
||||
// // 1. 发送从设备地址 (写模式) 和寄存器地址
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_WRITE_ADDRESS)) {
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// xlog("WF282A Read: No ACK after slave address (write phase)\n");
|
||||
// return 0;
|
||||
// }
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, reg)) {
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// xlog("WF282A Read: No ACK after register address\n");
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// 2. 发送重复开始条件
|
||||
hw_iic_start(I2C_HANDLE); // Repeated START
|
||||
// // 2. 发送重复开始条件
|
||||
// hw_iic_start(I2C_HANDLE); // Repeated START
|
||||
|
||||
// 3. 发送从设备地址 (读模式)
|
||||
if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_READ_ADDRESS)) {
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
xlog("WF282A Read: No ACK after slave address (read phase)\n");
|
||||
return 0;
|
||||
}
|
||||
// // 3. 发送从设备地址 (读模式)
|
||||
// if (!hw_iic_tx_byte(I2C_HANDLE, WF_IIC_READ_ADDRESS)) {
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// xlog("WF282A Read: No ACK after slave address (read phase)\n");
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// 4. 循环读取数据
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
// 如果是最后一个字节,发送NACK
|
||||
// hw_iic_rx_byte 的第二个参数是 ack_enable (1 for ACK, 0 for NACK)
|
||||
uint8_t ack_val = (i == (len - 1)) ? 0 : 1; // 最后一个字节NACK,其余ACK
|
||||
buf[i] = hw_iic_rx_byte(I2C_HANDLE, ack_val);
|
||||
bytes_read++;
|
||||
}
|
||||
// // 4. 循环读取数据
|
||||
// for (uint32_t i = 0; i < len; i++) {
|
||||
// // 如果是最后一个字节,发送NACK
|
||||
// // hw_iic_rx_byte 的第二个参数是 ack_enable (1 for ACK, 0 for NACK)
|
||||
// uint8_t ack_val = (i == (len - 1)) ? 0 : 1; // 最后一个字节NACK,其余ACK
|
||||
// buf[i] = hw_iic_rx_byte(I2C_HANDLE, ack_val);
|
||||
// bytes_read++;
|
||||
// }
|
||||
|
||||
hw_iic_stop(I2C_HANDLE);
|
||||
return bytes_read;
|
||||
// return _gravity_sensor_get_ndata(WF_IIC_READ_ADDRESS, reg, buf, len);
|
||||
// hw_iic_stop(I2C_HANDLE);
|
||||
// return bytes_read;
|
||||
return _gravity_sensor_get_ndata(WF_IIC_READ_ADDRESS, reg, buf, len);
|
||||
}
|
||||
/*==================================================================================*/
|
||||
/* Delay functions (Copied from manufacturer's code for consistency) */
|
||||
@ -206,7 +206,7 @@ uint8_t WF_Init() {
|
||||
xlog("Parsed Coefficients: c0=%d, c1=%d, c00=%ld, c10=%ld, c01=%d, c11=%d, c20=%d, c21=%d, c30=%d\n",
|
||||
c0, c1, c00, c10, c01, c11, c20, c21, c30);
|
||||
|
||||
#if 1 //连续测量
|
||||
#if 0 //连续测量
|
||||
// 3. 配置压力、温度和通用寄存器为连续测量模式
|
||||
// 压力配置: 32Hz测量速率 (PM_RATE_32), 16x过采样 (PM_PRC_16) -> 0x54
|
||||
wf282a_write_reg(WF_PRS_CFG, (PM_RATE_32 << 4) | PM_PRC_16);
|
||||
@ -281,7 +281,7 @@ void WF_start_measure(void){
|
||||
}
|
||||
|
||||
void WF_GET_Temperature_Pressure(float* temperature, float* precessure){
|
||||
// WF_start_measure();
|
||||
WF_start_measure();
|
||||
int32_t Traw = Get_Traw();
|
||||
int32_t Praw = Get_Praw();
|
||||
float Traw_sc = (float)Traw / KT; // 缩放原始温度值 (KT is now 16x scale factor)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -10,7 +10,7 @@ copy ..\..\ota.bin .
|
||||
copy ..\..\anc_coeff.bin .
|
||||
copy ..\..\anc_gains.bin .
|
||||
|
||||
..\..\isd_download.exe ..\..\isd_config.ini -tonorflash -dev br28 -boot 0x120000 -div8 -wait 300 -uboot ..\..\uboot.boot -app ..\..\app.bin -res ..\..\cfg_tool.bin tone.cfg p11_code.bin ..\..\eq_cfg_hw.bin -uboot_compress -format all
|
||||
..\..\isd_download.exe ..\..\isd_config.ini -tonorflash -dev br28 -boot 0x120000 -div8 -wait 300 -uboot ..\..\uboot.boot -app ..\..\app.bin -res ..\..\cfg_tool.bin tone.cfg p11_code.bin ..\..\eq_cfg_hw.bin -uboot_compress -format all -key 646-AC690X-7603.key
|
||||
|
||||
@REM..\..\isd_download.exe ..\..\isd_config.ini -tonorflash -dev br34 -boot 0x20000 -div8 -wait 300 -uboot ..\..\uboot.boot -app ..\..\app.bin ..\..\cfg_tool.bin -res tone.cfg kws_command.bin p11_code.bin -uboot_compress
|
||||
|
||||
|
||||
Binary file not shown.
@ -5375,6 +5375,8 @@ objs/apps/earphone/xtell_Sensor/send_data.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,mmc5603nj_read_mag_data,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SL_SC7U22_FIFO_Read,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,WF_GET_Temperature_Pressure,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,circle_buffer_write,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_sem_post,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_time_dly,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,data_log,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,uartSendData,pl
|
||||
@ -5393,8 +5395,11 @@ objs/apps/earphone/xtell_Sensor/send_data.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,test_uart_init,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,sensor_test_task,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,test_func,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SL_SC7U22_Config,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,mmc5603nj_init,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,WF_Init,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,puts,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,foot_init,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,j,pl
|
||||
objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_init,pl
|
||||
@ -5522,10 +5527,8 @@ objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,WF_GET_Temperature_Pressure,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,WF_Altitude_Calculate,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,powf,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,hw_iic_start,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,hw_iic_tx_byte,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,hw_iic_stop,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,hw_iic_rx_byte,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,gravity_sensor_command,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/sensor/WF282A.c.o,_gravity_sensor_get_ndata,l
|
||||
cpu/br28/liba/cpu.a.llvm.19376.crc16.c
|
||||
-r=cpu/br28/liba/cpu.a.llvm.19376.crc16.c,__crc16_mutex_init,pl
|
||||
-r=cpu/br28/liba/cpu.a.llvm.19376.crc16.c,os_mutex_create,l
|
||||
|
||||
Reference in New Issue
Block a user