diff --git a/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c b/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c index 348d962..ecfcf81 100644 --- a/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c +++ b/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c @@ -707,11 +707,8 @@ static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_h u16 handle = att_handle; log_info("write_callback, handle= 0x%04x,size = %d\n", handle, buffer_size); - if(buffer[0] == 0xbe && buffer[1] == 0xbb){ - extern void test_func(void); - test_func(); - } - + extern void le_user_app_event(u8* buffer); + le_user_app_event(buffer); switch (handle) { diff --git a/apps/earphone/board/br28/board_jl701n_demo_cfg.h b/apps/earphone/board/br28/board_jl701n_demo_cfg.h index ed7b19a..09398ad 100644 --- a/apps/earphone/board/br28/board_jl701n_demo_cfg.h +++ b/apps/earphone/board/br28/board_jl701n_demo_cfg.h @@ -25,8 +25,8 @@ // #define TCFG_UART0_ENABLE 0 //串口打印模块使能 #define TCFG_UART0_RX_PORT NO_CONFIG_PORT //串口接收脚配置(用于打印可以选择NO_CONFIG_PORT) #define TCFG_UART0_TX_PORT IO_PORT_DP //串口发送脚配置 -// #define TCFG_UART0_BAUDRATE 1000000 //串口波特率配置 -#define TCFG_UART0_BAUDRATE 115200 //串口波特率配置 +#define TCFG_UART0_BAUDRATE 1000000 //串口波特率配置 +// #define TCFG_UART0_BAUDRATE 115200 //串口波特率配置 //*********************************************************************************// // IIC配置 // diff --git a/apps/earphone/xtell_Sensor/buffer/circle_buffer.c b/apps/earphone/xtell_Sensor/buffer/circle_buffer.c index 1b5bbaf..77759fd 100644 --- a/apps/earphone/xtell_Sensor/buffer/circle_buffer.c +++ b/apps/earphone/xtell_Sensor/buffer/circle_buffer.c @@ -9,11 +9,19 @@ void circle_buffer_init(circle_buffer_t *cb, void *buffer, u16 capacity, u16 ele cb->head = 0; cb->tail = 0; cb->size = 0; + os_mutex_create(&cb->mutex); +} + +// 销毁环形缓冲区 +void circle_buffer_deinit(circle_buffer_t *cb) { + os_mutex_del(&cb->mutex, 0); } // 向环形缓冲区写入一个元素 bool circle_buffer_write(circle_buffer_t *cb, const void *element) { + os_mutex_pend(&cb->mutex, 0); if (circle_buffer_is_full(cb)) { + os_mutex_post(&cb->mutex); return false; // 缓冲区已满 } @@ -22,12 +30,15 @@ bool circle_buffer_write(circle_buffer_t *cb, const void *element) { cb->head = (cb->head + 1) % cb->capacity; cb->size++; + os_mutex_post(&cb->mutex); return true; } // 从环形缓冲区读取一个元素 bool circle_buffer_read(circle_buffer_t *cb, void *element) { + os_mutex_pend(&cb->mutex, 0); if (circle_buffer_is_empty(cb)) { + os_mutex_post(&cb->mutex); return false; // 缓冲区为空 } @@ -36,25 +47,38 @@ bool circle_buffer_read(circle_buffer_t *cb, void *element) { cb->tail = (cb->tail + 1) % cb->capacity; cb->size--; + os_mutex_post(&cb->mutex); return true; } // 获取已用空间的大小(以元素为单位) u16 circle_buffer_get_size(circle_buffer_t *cb) { - return cb->size; + os_mutex_pend(&cb->mutex, 0); + u16 size = cb->size; + os_mutex_post(&cb->mutex); + return size; } // 获取剩余空间的大小(以元素为单位) u16 circle_buffer_get_free_space(circle_buffer_t *cb) { - return cb->capacity - cb->size; + os_mutex_pend(&cb->mutex, 0); + u16 free_space = cb->capacity - cb->size; + os_mutex_post(&cb->mutex); + return free_space; } // 检查缓冲区是否已满 bool circle_buffer_is_full(circle_buffer_t *cb) { - return cb->size == cb->capacity; + os_mutex_pend(&cb->mutex, 0); + bool is_full = (cb->size == cb->capacity); + os_mutex_post(&cb->mutex); + return is_full; } // 检查缓冲区是否为空 bool circle_buffer_is_empty(circle_buffer_t *cb) { - return cb->size == 0; + os_mutex_pend(&cb->mutex, 0); + bool is_empty = (cb->size == 0); + os_mutex_post(&cb->mutex); + return is_empty; } \ No newline at end of file diff --git a/apps/earphone/xtell_Sensor/buffer/circle_buffer.h b/apps/earphone/xtell_Sensor/buffer/circle_buffer.h index fdaf179..7780984 100644 --- a/apps/earphone/xtell_Sensor/buffer/circle_buffer.h +++ b/apps/earphone/xtell_Sensor/buffer/circle_buffer.h @@ -2,6 +2,7 @@ #define CIRCLE_BUFFER_H #include "system/includes.h" +#include "os/os_api.h" // 定义环形缓冲区的结构体 typedef struct { @@ -11,6 +12,7 @@ typedef struct { u16 head; // 头部指针(写入位置,以元素为单位) u16 tail; // 尾部指针(读取位置,以元素为单位) u16 size; // 当前已用大小(以元素为单位) + OS_MUTEX mutex; // 用于保护缓冲区的互斥锁 } circle_buffer_t; /** @@ -22,6 +24,12 @@ typedef struct { */ void circle_buffer_init(circle_buffer_t *cb, void *buffer, u16 capacity, u16 element_size); +/** + * @brief 销毁环形缓冲区,释放相关资源 + * @param cb 指向环形缓冲区结构体的指针 + */ +void circle_buffer_deinit(circle_buffer_t *cb); + /** * @brief 向环形缓冲区写入一个元素 * @param cb 指向环形缓冲区结构体的指针 diff --git a/apps/earphone/xtell_Sensor/send_data.c b/apps/earphone/xtell_Sensor/send_data.c index 34e9b68..523b397 100644 --- a/apps/earphone/xtell_Sensor/send_data.c +++ b/apps/earphone/xtell_Sensor/send_data.c @@ -42,7 +42,10 @@ #define xlog(format, ...) ((void)0) #endif -#define SENSOR_DATA_BUFFER_SIZE 1000 // 定义缓冲区可以存储XXX个sensor_data_t元素 +#define SENSOR_DATA_BUFFER_SIZE 200 // 定义缓冲区可以存储XXX个sensor_data_t元素 + +#define MPU_FIFO_INTERVAL 4 //隔多久读取六轴fifo,单位10ms +#define MPU_FIFO_LEN 16 //(MPU_FIFO_INTERVAL*10/2.5) //400hz采用频率,那每40ms的时间,fifo就有16组六轴数据 // /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,7 +55,6 @@ void send_data_to_ble_client(const u8* data, u16 length); extern void create_process(u16* pid, const char* name, void *priv, void (*func)(void *priv), u32 msec); extern void close_process(u16* pid,char* name); -void start_collect_fuc(void); void BLE_send_fuc(void); //END -- 函数定义 ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -62,35 +64,26 @@ void BLE_send_fuc(void); //START -- 变量定义 static u32 timer_offset_ms = 0; -typedef struct { - // -- 六轴 -- - signed short SC7U22_data[6]; - // -- 磁力计 -- - uint8_t mmc5603nj_buffer[9]; - // -- 速度 -- - uint16_t speed_cms; - // -- 气压计 -- - int16_t temperature; - uint32_t pressure; - // -- 左/右腿 -- - uint8_t foot_state; //1:左脚;2:右脚 - // -- 时间 -- - u32 timestamp_ms; +typedef struct{ + signed short SC7U22_data[6]; //12字节 + int mmc5603nj_buffer[3]; //12字节 + int16_t temperature; //2 + uint32_t pressure; //4 +}sensor_package_t __attribute__((packed)); -} BLE_send_data_t; - -static int count = 0; +typedef struct{ + uint8_t checkout_1; + uint8_t checkout_2; + uint8_t index; + sensor_package_t sensor_package[MPU_FIFO_LEN];//一次蓝牙发送MPU_FIFO_LEN组传感器数据 +}ble_send_data_t; //一次蓝牙发送的数据内容 // --- 环形缓冲区 --- -static circle_buffer_t BLE_send_buff; // 环形缓冲区管理结构体 -BLE_send_data_t BLE_send_data[SENSOR_DATA_BUFFER_SIZE]; +static circle_buffer_t g_ble_send_cb; // 环形缓冲区管理结构体 +static ble_send_data_t g_sensor_data_storage[SENSOR_DATA_BUFFER_SIZE]; //缓冲区 -// -- 任务id -- -u16 SC7U22_calibration_id; -u16 start_collect_fuc_id; -u16 BLE_send_fuc_id; -static u8 stop_ble_send_fuc_id; +static OS_SEM receiver_ready_sem; // 用于启动同步的信号量 //END -- 变量定义 ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -106,110 +99,154 @@ u32 get_ms_timer(void) { return sys_timer_get_ms() - timer_offset_ms; } -// ---------------------------------------------------------------------------------------------------------------- -// --------------------------------------------定时器回调函数---------------------------------------------------------- -/** - * @brief 六轴静态校准 - * - */ -void SC7U22_static_calibration(void){ - signed short acc_data_buf[3]; - signed short gyr_data_buf[3]; - float angle[3]; - float quaternion_output[3]; - - static signed short combined_raw_data[6]; - static int calibration_done = 0; - char status = 0; - static first_set_flag = 0; - if(first_set_flag == 0){ - first_set_flag = 1; - set_SC7U22_Error_Flag(0); - } - SL_SC7U22_RawData_Read(acc_data_buf,gyr_data_buf); - memcpy(&combined_raw_data[0], acc_data_buf, 3 * sizeof(signed short)); - memcpy(&combined_raw_data[3], gyr_data_buf, 3 * sizeof(signed short)); - status = Q_SL_SC7U22_Angle_Output(1, combined_raw_data, angle,NULL, 0, quaternion_output); - - if(status == 1){ //校准完成 - extern u16 SC7U22_calibration_id; - extern u8 SC7U22_init; - first_set_flag = 0; - SC7U22_init = 0x11; - close_process(&SC7U22_calibration_id, "SC7U22_calibration"); - u8 send2_1[5] = {0xBB,0xBE,0x02,0x00,0x00}; - send2_1[4] = SC7U22_init; - send_data_to_ble_client(&send2_1,5); - } - if(count > 100){ - count = 0; - char log_buffer[100]; - // snprintf( log_buffer, sizeof(log_buffer),"status:%d\n",status); - // send_data_to_ble_client(&log_buffer,strlen(log_buffer)); - xlog("status:%d\n", status); - xlog("RawData:AX=%d,AY=%d,AZ=%d,GX=%d,GY=%d,GZ=%d\r\n",combined_raw_data[0],combined_raw_data[1],combined_raw_data[2],combined_raw_data[3],combined_raw_data[4],combined_raw_data[5]); - uint8_t send[5] = {0xBB, 0xBE, 0x02, 0x00, 0x12}; - send_data_to_ble_client(&send,5); //正在校验中 - } - count++; -} /** - * @brief 开始采集传感器数据和计算速度 + * @brief 传感器采集任务 * */ -void start_collect_fuc(void){ - // xlog("=======sensor_read_data START\n"); - static signed short combined_raw_data[6]; - static int initialized = 0; - static int calibration_done = 0; - char status = 0; - BLE_send_data_t BLE_send_data_tmp; - uint8_t mmc5603nj_buffer[9]; - signed short acc_data_buf[3]; - signed short gyr_data_buf[3]; - float angle[3]; - float quaternion_output[3]; - +void sensor_collect_task(void){ + ble_send_data_t send_data; + mmc5603nj_mag_data_t mmc5603nj_buffer; float temperature = 0; float pressure = 0; + int interval = 0; + signed short accx_buf[100]; + signed short accy_buf[100]; + signed short accz_buf[100]; + signed short gyrx_buf[100]; + signed short gyry_buf[100]; + signed short gyrz_buf[100]; + int fifo_num = 0; + u8 index = 1; - // -- 读数据 -- - SL_SC7U22_RawData_Read(acc_data_buf,gyr_data_buf); - mmc5603nj_read_origin_data(mmc5603nj_buffer); - // bmp280_read_originanl_data(&BLE_send_data_tmp.adc_P, &BLE_send_data_tmp.adc_T); - bmp280_read_data(&temperature, &pressure); + while(1){//4组地磁数据、16组六轴数据、1组气压计数据 + interval++; + mmc5603nj_read_mag_data(&mmc5603nj_buffer); + for(int i = (interval-1)*4; i < interval*4; i++){ + send_data.sensor_package[i].mmc5603nj_buffer[0] = (int32_t)(mmc5603nj_buffer.x * 1000.0f); + send_data.sensor_package[i].mmc5603nj_buffer[1] = (int32_t)(mmc5603nj_buffer.y * 1000.0f); + send_data.sensor_package[i].mmc5603nj_buffer[2] = (int32_t)(mmc5603nj_buffer.z * 1000.0f); + } + // xlog("MAG x: %.2f,y: %.2f,z: %.2f\n",mmc5603nj_buffer.x,mmc5603nj_buffer.y,mmc5603nj_buffer.z); + if(interval >= 4){ + interval = 0; + memset(&accx_buf, 0, sizeof(accx_buf)); + memset(&accy_buf, 0, sizeof(accy_buf)); + memset(&accz_buf, 0, sizeof(accz_buf)); + memset(&gyrx_buf, 0, sizeof(gyrx_buf)); + memset(&gyry_buf, 0, sizeof(gyry_buf)); + memset(&gyrz_buf, 0, sizeof(gyrz_buf)); + fifo_num = SL_SC7U22_FIFO_Read(accx_buf,accy_buf,accz_buf,gyrx_buf,gyry_buf,gyrz_buf); //40ms一次性读取内置fifo的数据 + bmp280_read_data(&temperature, &pressure);//每40ms读取一次 + for(int i = 0;i= 0xFF) index = 1; + // xlog("=====================%d============================\n",get_ms_timer()); + } + + os_time_dly(1); //10ms为单位 } - - // xlog("=======sensor_read_data END\n"); +} - + +static int random = 0; +void data_log(uint8_t* data){ + // 检查数据包头部 + if (data[0] != 0xBE || data[1] != 0xBB) { + printf("Error: Invalid data packet header.\n"); + return; + } + + // 解析包索引 + uint8_t index = data[2]; + printf("--- Parsing Data Packet Index: %d ---\n", index); + + uint8_t* p = &data[3]; // 指向数据负载的起始位置 + + // 循环解析16组数据 + for (int i = 0; i < MPU_FIFO_LEN; i++) { + // 1. 解析六轴传感器数据 (12 bytes) + int16_t imu_raw[6]; + for (int j = 0; j < 6; j++) { + // 小端模式: 低字节在前, 高字节在后 + imu_raw[j] = (int16_t)(((uint16_t)p[1] << 8) | (uint16_t)p[0]); + p += 2; + } + float acc_g[3]; + float gyr_dps[3]; + acc_g[0] = (float)imu_raw[0] / 2048.0f; + acc_g[1] = (float)imu_raw[1] / 2048.0f; + acc_g[2] = (float)imu_raw[2] / 2048.0f; + gyr_dps[0] = (float)imu_raw[3] * 0.061f; + gyr_dps[1] = (float)imu_raw[4] * 0.061f; + gyr_dps[2] = (float)imu_raw[5] * 0.061f; + + // 2. 解析地磁传感器数据 (12 bytes) + int32_t mag_raw[3]; + for (int j = 0; j < 3; j++) { + // 小端模式 + mag_raw[j] = (int32_t)(((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16) | ((uint32_t)p[1] << 8) | (uint32_t)p[0]); + p += 4; + } + float mag_gauss[3]; + mag_gauss[0] = (float)mag_raw[0] / 1000.0f; + mag_gauss[1] = (float)mag_raw[1] / 1000.0f; + mag_gauss[2] = (float)mag_raw[2] / 1000.0f; + + // 3. 解析温度数据 (2 bytes) + int16_t temp_raw = (int16_t)(((uint16_t)p[1] << 8) | (uint16_t)p[0]); + p += 2; + float temperature = (float)temp_raw / 1000.0f; + + // 4. 解析气压数据 (4 bytes) + uint32_t press_raw = (uint32_t)(((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16) | ((uint32_t)p[1] << 8) | (uint32_t)p[0]); + p += 4; + float pressure = (float)press_raw / 1000.0f; + + // 打印解析后的数据 + // if(i % 4 == 0){ + printf("Package[%d]:====================\n", i); + // printf(" ACC(g): x=%.3f, y=%.3f, z=%.3f\n", acc_g[0], acc_g[1], acc_g[2]); + // printf(" GYR(dps):x=%.3f, y=%.3f, z=%.3f\n", gyr_dps[0], gyr_dps[1], gyr_dps[2]); + printf(" MAG(Gs): x=%.3f, y=%.3f, z=%.3f\n", mag_gauss[0], mag_gauss[1], mag_gauss[2]); + printf(" TEMP(C): %.3f, PRESS(Pa): %.3f\n", temperature, pressure); + // } + + } + printf("--- End of Packet ---\n\n"); } /** @@ -217,187 +254,89 @@ void start_collect_fuc(void){ * */ void BLE_send_fuc(void){ - BLE_send_data_t data_to_send; - - if (circle_buffer_is_empty(&BLE_send_buff) == 0) { - circle_buffer_read(&BLE_send_buff, &data_to_send); - } else { - // 缓冲区为空,直接返回 - return; - } - - // --- 封装并发送六轴传感器数据 --- - { - // 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(12) = 16字节 - const uint8_t IMU_PACKET_LEN = 16; - const uint8_t IMU_PAYLOAD_LEN = 13; // 类型(1) + 数据(12) - const uint8_t IMU_TYPE = 0x01; + ble_send_data_t send_data; + uint8_t send_buffer[483]; + while(1){ + os_sem_pend(&receiver_ready_sem, 0); //阻塞等待 + circle_buffer_read(&g_ble_send_cb, &send_data); - uint8_t imu_packet[IMU_PACKET_LEN]; + // 逐字节打包数据到 send_buffer, 采用小端模式 + uint8_t *p = send_buffer; + *p++ = send_data.checkout_1; + *p++ = send_data.checkout_2; + *p++ = send_data.index; - // 填充包头 - imu_packet[0] = 0xBB; - imu_packet[1] = 0xBE; - imu_packet[2] = IMU_PAYLOAD_LEN; - imu_packet[3] = IMU_TYPE; - // 拷贝六轴数据 - // memcpy(&imu_packet[4], data_to_send.SC7U22_data, sizeof(data_to_send.SC7U22_data)); - for (int i = 0; i < 6; i++) { - // SC7U22_data[i] 是一个 signed short (2字节) - // 将其低字节放在前面 - imu_packet[4 + i * 2] = (uint8_t)(data_to_send.SC7U22_data[i] & 0xFF); - // 将其高字节放在后面 - imu_packet[4 + i * 2 + 1] = (uint8_t)((data_to_send.SC7U22_data[i] >> 8) & 0xFF); + for (int i = 0; i < MPU_FIFO_LEN; i++) { + sensor_package_t *pkg = &send_data.sensor_package[i]; + + // 1. 打包六轴数据 (6 * int16_t) + for (int j = 0; j < 6; j++) { + *p++ = (uint8_t)(pkg->SC7U22_data[j] & 0xFF); + *p++ = (uint8_t)((pkg->SC7U22_data[j] >> 8) & 0xFF); + } + + // 2. 打包地磁数据 (3 * int32_t) + for (int j = 0; j < 3; j++) { + *p++ = (uint8_t)(pkg->mmc5603nj_buffer[j] & 0xFF); + *p++ = (uint8_t)((pkg->mmc5603nj_buffer[j] >> 8) & 0xFF); + *p++ = (uint8_t)((pkg->mmc5603nj_buffer[j] >> 16) & 0xFF); + *p++ = (uint8_t)((pkg->mmc5603nj_buffer[j] >> 24) & 0xFF); + } + + // 3. 打包温度数据 (int16_t) + *p++ = (uint8_t)(pkg->temperature & 0xFF); + *p++ = (uint8_t)((pkg->temperature >> 8) & 0xFF); + + // 4. 打包气压数据 (uint32_t) + *p++ = (uint8_t)(pkg->pressure & 0xFF); + *p++ = (uint8_t)((pkg->pressure >> 8) & 0xFF); + *p++ = (uint8_t)((pkg->pressure >> 16) & 0xFF); + *p++ = (uint8_t)((pkg->pressure >> 24) & 0xFF); + + #if 0 + float acc_g[3]; + float gyr_dps[3]; + acc_g[0] = (float)send_data.sensor_package[i].SC7U22_data[0] / 2048.0f; + acc_g[1] = (float)send_data.sensor_package[i].SC7U22_data[1] / 2048.0f; + acc_g[2] = (float)send_data.sensor_package[i].SC7U22_data[2] / 2048.0f; + gyr_dps[0] = (float)send_data.sensor_package[i].SC7U22_data[3] * 0.061f; + gyr_dps[1] = (float)send_data.sensor_package[i].SC7U22_data[4] * 0.061f; + gyr_dps[2] = (float)send_data.sensor_package[i].SC7U22_data[5] * 0.061f; + printf(" ACC(g): x=%.3f, y=%.3f, z=%.3f\n", acc_g[0], acc_g[1], acc_g[2]); + printf(" GYR(dps):x=%.3f, y=%.3f, z=%.3f\n", gyr_dps[0], gyr_dps[1], gyr_dps[2]); + #endif } - // xlog("imu %d\n",data_to_send.SC7U22_data[0]); - // xlog("imu_packet: 0x%x 0x%x 0x%x\n",imu_packet[4],imu_packet[5],imu_packet[6]); - send_data_to_ble_client(&imu_packet, IMU_PACKET_LEN); - } - - // --- 封装并发送磁力计数据 --- - { - // 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(9) = 13字节 - const uint8_t MAG_PACKET_LEN = 13; - const uint8_t MAG_PAYLOAD_LEN = 10; // 类型(1) + 数据(9) - const uint8_t MAG_TYPE = 0x02; - uint8_t mag_packet[MAG_PACKET_LEN]; - // 填充包头 - mag_packet[0] = 0xBB; - mag_packet[1] = 0xBE; - mag_packet[2] = MAG_PAYLOAD_LEN; - mag_packet[3] = MAG_TYPE; - // 拷贝磁力计数据 - // memcpy(&mag_packet[4], data_to_send.mmc5603nj_buffer, sizeof(data_to_send.mmc5603nj_buffer)); - for (int i = 0; i < 9; i++) { - mag_packet[4 + i] = data_to_send.mmc5603nj_buffer[i]; - } - // xlog("mag: 0x%x 0x%x 0x%x\n",mag_packet[4],mag_packet[5],mag_packet[6]); - - send_data_to_ble_client(&mag_packet, MAG_PACKET_LEN); - } - - // --- 封装并发送压力机计数据 --- - { - // 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(6) = 10字节 - const uint8_t PT_PACKET_LEN = 10; - const uint8_t PT_PAYLOAD_LEN = 7; // 类型(1) + 数据(6) - const uint8_t PT_TYPE = 0x03; - uint8_t pt_packet[PT_PACKET_LEN]; - // 填充包头 - pt_packet[0] = 0xBB; - pt_packet[1] = 0xBE; - pt_packet[2] = PT_PAYLOAD_LEN; - pt_packet[3] = PT_TYPE; - // 直接发送 int16_t 的二进制补码 - pt_packet[4] = (uint8_t)(data_to_send.temperature & 0xFF); // 低字节 - pt_packet[5] = (uint8_t)((data_to_send.temperature >> 8) & 0xFF); // 高字节 - - // 气压 (保持不变) - pt_packet[6] = (uint8_t)(data_to_send.pressure & 0xFF); - pt_packet[7] = (uint8_t)((data_to_send.pressure >> 8) & 0xFF); - pt_packet[8] = (uint8_t)((data_to_send.pressure >> 16) & 0xFF); - pt_packet[9] = (uint8_t)((data_to_send.pressure >> 24) & 0xFF); - - send_data_to_ble_client(&pt_packet, PT_PACKET_LEN); - } - - - // --- 封装并发送速度数据 --- - { - // 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(2) = 6字节 - const uint8_t SPEED_PACKET_LEN = 6; - const uint8_t SPEED_PAYLOAD_LEN = 3; // 类型(1) + 数据(2) - const uint8_t SPEED_TYPE = 0x04; - - uint8_t speed_packet[SPEED_PACKET_LEN]; - - // 填充包头 - speed_packet[0] = 0xBB; - speed_packet[1] = 0xBE; - // 填充长度 - speed_packet[2] = SPEED_PAYLOAD_LEN; - // 填充类型 - speed_packet[3] = SPEED_TYPE; - - // 小端模式 - speed_packet[4] = (uint8_t)(data_to_send.speed_cms & 0xFF); // 低字节 - speed_packet[5] = (uint8_t)((data_to_send.speed_cms >> 8) & 0xFF); // 高字节 - - send_data_to_ble_client(&speed_packet, SPEED_PACKET_LEN); - } - - // --- 封装并发送数据 --- - { - // 协议定义: 包头(2) + 长度(1) + 类型(1) + 数据(5) = 9字节 - const uint8_t OTHER_PACKET_LEN = 9; - const uint8_t OTHER_PAYLOAD_LEN = 6; // 类型(1) + 数据(5) - const uint8_t OTHER_TYPE = 0x05; - - uint8_t oher_packet[OTHER_PACKET_LEN]; - - // 填充包头 - oher_packet[0] = 0xBB; - oher_packet[1] = 0xBE; - // 填充长度 - oher_packet[2] = OTHER_PAYLOAD_LEN; - // 填充类型 - oher_packet[3] = OTHER_TYPE; - - // 小端模式 - oher_packet[4] = (uint8_t)data_to_send.foot_state; // 数据来源 - - oher_packet[5] = (uint8_t)((data_to_send.timestamp_ms >> 0) & 0xFF); // LSB - oher_packet[6] = (uint8_t)((data_to_send.timestamp_ms >> 8) & 0xFF); - oher_packet[7] = (uint8_t)((data_to_send.timestamp_ms >> 16) & 0xFF); - oher_packet[8] = (uint8_t)((data_to_send.timestamp_ms >> 24) & 0xFF); // MSB - send_data_to_ble_client(&oher_packet, OTHER_PACKET_LEN); + // send_data_to_ble_client(send_buffer, 3 + sizeof(send_data.sensor_package)); // 发送数据 + data_log(send_buffer); } } -void stop_BLE_send_fuc(void){ - if (circle_buffer_is_empty(&BLE_send_buff)) { - close_process(&BLE_send_fuc_id,"BLE_send_fuc"); - close_process(&stop_ble_send_fuc_id,"stop_BLE_send_fuc"); - } -} + + // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ -/** - * @brief 六轴静态校验 - * - */ -void start_calibration(void){ - create_process(&SC7U22_calibration_id,"SC7U22_calibration",NULL,SC7U22_static_calibration,10); -} - -void stop_calibration(void){ - close_process(&SC7U22_calibration_id, "SC7U22_calibration"); -} /** * @brief 开始采集传感器数据并通过ble发送 * */ void start_clloct(void){ - reset_ms_timer(); - create_process(&start_collect_fuc_id,"start_collect",NULL,start_collect_fuc,10); - create_process(&BLE_send_fuc_id,"BLE_send_fuc",NULL,BLE_send_fuc,5); + os_task_create(sensor_collect_task,NULL,5,1024,32,"sensor_collect_task"); + os_task_create(BLE_send_fuc,NULL,5,1024,32,"BLE_send_fuc"); } - /** * @brief 停止采集和ble发送 * */ void stop_clloct(void){ - close_process(&start_collect_fuc_id,"start_collect"); - close_process(&BLE_send_fuc_id,"BLE_send_fuc"); - // create_process(&stop_ble_send_fuc_id,"stop_BLE_send_fuc",NULL,stop_BLE_send_fuc,500); //等缓冲区内容发送完,才停止ble发送任务 + os_task_del_req("sensor_collect_task"); + os_task_del_req("BLE_send_fuc"); } /** @@ -422,9 +361,9 @@ void xtell_task_create(void){ xlog("xtell_task_create\n"); - circle_buffer_init(&BLE_send_buff, BLE_send_data, SENSOR_DATA_BUFFER_SIZE, sizeof(BLE_send_data_t)); - + circle_buffer_init(&g_ble_send_cb, g_sensor_data_storage, SENSOR_DATA_BUFFER_SIZE, sizeof(ble_send_data_t)); + os_sem_create(&receiver_ready_sem, 0); } @@ -434,66 +373,6 @@ void xtell_task_create(void){ //test // -/** - * @brief 开始采集传感器数据和计算速度 - * - */ -void sensor_task(void){ - while(1){ - // xlog("=======sensor_read_data START\n"); - static signed short combined_raw_data[6]; - static int initialized = 0; - static int calibration_done = 0; - char status = 0; - BLE_send_data_t BLE_send_data_tmp; - uint8_t mmc5603nj_buffer[9]; - signed short acc_data_buf[3]; - signed short gyr_data_buf[3]; - float angle[3]; - float quaternion_output[3]; - - float temperature = 0; - float pressure = 0; - - // -- 读数据 -- - SL_SC7U22_RawData_Read(acc_data_buf,gyr_data_buf); - mmc5603nj_read_origin_data(mmc5603nj_buffer); - // bmp280_read_originanl_data(&BLE_send_data_tmp.adc_P, &BLE_send_data_tmp.adc_T); - bmp280_read_data(&temperature, &pressure); - - memcpy(&combined_raw_data[0], acc_data_buf, 3 * sizeof(signed short)); - memcpy(&combined_raw_data[3], gyr_data_buf, 3 * sizeof(signed short)); - - // -- 四元数 -- - status = Q_SL_SC7U22_Angle_Output(0, combined_raw_data, angle,NULL, 0, quaternion_output); - - // -- 速度计算 -- - memcpy(acc_data_buf, &combined_raw_data[0], 3 * sizeof(signed short)); - memcpy(gyr_data_buf, &combined_raw_data[3], 3 * sizeof(signed short)); - uint16_t speed = sensor_processing_task(acc_data_buf,gyr_data_buf,angle, quaternion_output); - - // -- 数据包装进结构体 -- - memcpy(&BLE_send_data_tmp.SC7U22_data[0], acc_data_buf, 3 * sizeof(signed short)); - memcpy(&BLE_send_data_tmp.SC7U22_data[3], gyr_data_buf, 3 * sizeof(signed short)); - memcpy(BLE_send_data_tmp.mmc5603nj_buffer, mmc5603nj_buffer, 9); - BLE_send_data_tmp.temperature = (int16_t)(temperature * 1000.0f); - BLE_send_data_tmp.pressure = (int32_t)(pressure * 1000.0f); - BLE_send_data_tmp.speed_cms = speed; - extern u8 foot_init; - BLE_send_data_tmp.foot_state = foot_init; - BLE_send_data_tmp.timestamp_ms = get_ms_timer(); - - // -- 放进缓冲区 -- - if(circle_buffer_is_full(&BLE_send_buff) == 0){ - circle_buffer_write(&BLE_send_buff, &BLE_send_data_tmp); - } - - // xlog("=======sensor_read_data END\n"); - os_time_dly(1); - } - - -} #define BUFF_LEN 500 static signed char acc_data_buf[BUFF_LEN] = {0}; // 1. 定义一个全局的信号量 @@ -556,6 +435,12 @@ void test_func(void){ for(int i = 0;i diff --git a/apps/earphone/xtell_Sensor/sensor/MMC56.c b/apps/earphone/xtell_Sensor/sensor/MMC56.c index a5276b2..ed036cc 100644 --- a/apps/earphone/xtell_Sensor/sensor/MMC56.c +++ b/apps/earphone/xtell_Sensor/sensor/MMC56.c @@ -1,3 +1,7 @@ +/* + MMC5603nj + 1-255的采样率,这里设置为200Hz,5ms +*/ #include "MMC56.h" #include "math.h" @@ -41,13 +45,15 @@ int mmc5603nj_init(void) { // 设置20位分辨率 (BW[1:0] = 11) // 同时确保所有轴都使能 (X/Y/Z_inhibit = 0) + // mmc5603nj_write_reg(MMC_INCTRL1, 0x03); mmc5603nj_write_reg(MMC_INCTRL1, 0x03); os_time_dly(1); // 设置内部控制寄存器2 // CMM_EN = 1 (使能连续模式功能) - // HPOWER = 1 (高功耗模式,更稳定) - mmc5603nj_write_reg(MMC_INCTRL2, 0x90); // 0b10010000 + // HPOWER = 0 + // mmc5603nj_write_reg(MMC_INCTRL2, 0x10); // 0b00010000 + mmc5603nj_write_reg(MMC_INCTRL2, 0x10); // 0b10010000 // 设置自动SET/RESET功能 // AUTO_SR_EN = 1 @@ -56,7 +62,8 @@ int mmc5603nj_init(void) { g_continuous_mode_enabled = 0; printf("MMC5603NJ initialized successfully.\n"); - mmc5603nj_enable_continuous_mode(0x04); + // mmc5603nj_enable_continuous_mode(0xC8); //200Hz的采样率,最高支持255 + mmc5603nj_enable_continuous_mode(0xCF); return 1; } @@ -195,7 +202,7 @@ void mmc5603nj_read_mag_data(mmc5603nj_mag_data_t *mag_data) { } while ((status & 0x40) == 0 && timeout > 0); if (timeout == 0) { - printf("Error: Magnetic measurement timeout!\n"); + // printf("Error: Magnetic measurement timeout!\n"); mag_data->x = mag_data->y = mag_data->z = 0.0f; return; } diff --git a/apps/earphone/xtell_Sensor/sensor/SC7U22.c b/apps/earphone/xtell_Sensor/sensor/SC7U22.c index b4304ac..833b623 100644 --- a/apps/earphone/xtell_Sensor/sensor/SC7U22.c +++ b/apps/earphone/xtell_Sensor/sensor/SC7U22.c @@ -62,7 +62,7 @@ unsigned char SL_SC7U22_I2c_Spi_Read(unsigned char sl_spi_iic, unsigned char reg static void sl_delay(unsigned char sl_i) { - os_time_dly(sl_i); + delay((int)sl_i); } char iic_read_len; @@ -131,10 +131,12 @@ unsigned char SL_SC7U22_Config(void) // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0x06);//ACC_CONF 0x07=50Hz 0x06=25Hz // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xA8);//高性能模式,连续4个数据平均1次,100Hz -- lmx - SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xBC);//ACC_CON 高性能模式,1600Hz -- lmx - // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xBB);//ACC_CON 高性能模式,800Hz -- lmx + // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xBC);//ACC_CON 高性能模式,1600Hz -- lmx + - SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xA8);//ACC_CON 高性能模式,100Hz,平均数4 -- lmx + // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0xA8);//ACC_CON 高性能模式,100Hz,平均数4 -- lmx + + SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0x8A);//ACC_CON 高性能模式,400Hz -- lmx #if ACC_RANGE==2 SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x41, 0x00);//ACC_RANGE 00:±2G @@ -153,9 +155,11 @@ unsigned char SL_SC7U22_Config(void) // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0x8C);//GYR_CONF 1600Hz -- lmx // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xAC);//GYR_CONF 1600Hz -- lmx // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xAB);//GYR_CONF 800Hz -- lmx - SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xE8);//GYR_CONF 100Hz, 噪声优化开启,4个平均一次 -- lmx + // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xE8);//GYR_CONF 100Hz, 噪声优化开启,4个平均一次 -- lmx - SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x43, 0x00);//GYR_RANGE 2000dps + SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xCA);//GYR_CONF 噪声优化开启,高性能模式,400Hz -- lmx + + // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x43, 0x00);//GYR_RANGE 2000dps SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x43, 0x00);//GYR_RANGE 2000dps SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x04, 0x50);//COM_CFG @@ -306,7 +310,8 @@ unsigned short SL_SC7U22_FIFO_Read(signed short *accx_buf,signed short *accy_buf unsigned char header[2]; unsigned short j; -#if SL_Sensor_Algo_Release_Enable==0x00 //user can set to zero +// #if SL_Sensor_Algo_Release_Enable==0x00 //user can set to zero +#if 0//lmx #if SL_SC7U22_WAIT_FIFO_LEN_ENABLE==0x00 while((fifo_num1&0x20)!=0x20) { @@ -352,7 +357,7 @@ unsigned short SL_SC7U22_FIFO_Read(signed short *accx_buf,signed short *accy_buf SL_SC7U22_I2c_Spi_Read(SL_SPI_IIC_INTERFACE, 0x21, fifo_num*2, SL_SC7U22_FIFO_DATA);//读取FIFO数据 BYTE NUM // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x1D, 0x00);//BY PASS MODE // SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x1D, 0x20);//Stream MODE - xlog("SC7U22_FIFO_NUM1:%d\n",fifo_num); + // xlog("SC7U22_FIFO_NUM1:%d\n",fifo_num); #if SL_Sensor_Algo_Release_Enable==0x00 // xlog("0x1F:0x%x 0x20:0x%x\n",fifo_num1,fifo_num2); // xlog("SC7U22_FIFO_NUM1:%d\n",fifo_num); @@ -400,9 +405,12 @@ unsigned short SL_SC7U22_FIFO_Read(signed short *accx_buf,signed short *accy_buf { i = i + 2; } - } - + } + fifo_len = Acc_FIFO_Num; + // xlog("Acc_FIFO_Num:%d,Gyr_FIFO_Num:%d\n",Acc_FIFO_Num,Gyr_FIFO_Num); + SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x1D,0x00); + SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x1D,0x20); return fifo_len; } #endif diff --git a/apps/earphone/xtell_Sensor/sensor/SC7U22.h b/apps/earphone/xtell_Sensor/sensor/SC7U22.h index e33a056..bc45da3 100644 --- a/apps/earphone/xtell_Sensor/sensor/SC7U22.h +++ b/apps/earphone/xtell_Sensor/sensor/SC7U22.h @@ -14,7 +14,7 @@ Copyright (c) 2022 Silan MEMS. All Rights Reserved. //是否使能串口打印调试 #define SL_Sensor_Algo_Release_Enable 0x00 //是否开启FIFO模式,默认STREAM模式 -#define SL_SC7U22_FIFO_ENABLE 0x00 +#define SL_SC7U22_FIFO_ENABLE 0x01 /***使用前请根据实际情况配置以下参数******/ diff --git a/apps/earphone/xtell_Sensor/xtell.h b/apps/earphone/xtell_Sensor/xtell.h index dc77190..e197c79 100644 --- a/apps/earphone/xtell_Sensor/xtell.h +++ b/apps/earphone/xtell_Sensor/xtell.h @@ -1,7 +1,7 @@ #ifndef XTELL_H #define XTELL_H #include "system/includes.h" - +#include "generic/typedef.h" // #define KS_BLE 1 #define XTELL_TEST 1 diff --git a/apps/earphone/xtell_Sensor/xtell_handler.c b/apps/earphone/xtell_Sensor/xtell_handler.c index af91c2f..09b91fa 100644 --- a/apps/earphone/xtell_Sensor/xtell_handler.c +++ b/apps/earphone/xtell_Sensor/xtell_handler.c @@ -191,6 +191,106 @@ static int state_machine(struct application *app, enum app_state state, struct i /////////////////////////////////////////////////////////////////////////////////////////////////// //handle +void le_user_app_event(u8* buffer){ + if (buffer[0] == 0xBE && buffer[1] == 0xBB) { + if(buffer[2] == 0x01){ //后面的数据长度 1 + switch (buffer[3]){ + case 0x01: + // extern void gsensor_test(void); + // create_process(&gsensor_test_id,"gsensor_test",NULL,gsensor_test,1000); + xlog("ota_test"); + cpu_reset(); + break; + case 0xff: //测试 + u8 device_buff[10]; + u8 founds = 0; + extern void i2c_scanner_probe(u8* device_addr, u8* found_number); + i2c_scanner_probe(device_buff,&founds); + for(int i = 0;i < founds;i++){ + send_data_to_ble_client(&device_buff,founds); + } + break; + case 0x02: + extern void test_func(void); + test_func(); + break; + default: + break; + } + }else if(buffer[2] == 0x02){ //后面数据长度为2 + switch (buffer[3]){ //数据包类型 + case 0x00: //数据包类型为:指定传感器初始化 + u8 send2_0[5] = {0xBB,0xBE,0x02,0x00,0x00}; + if(buffer[4] == 0x01){ //六轴 + // stop_calibration(); + if (SL_SC7U22_Config() == 0) { + SC7U22_init = 0x10; + }else{ + SC7U22_init = 0x11; + } + send2_0[4] = SC7U22_init; + send_data_to_ble_client(&send2_0,5); + // start_calibration(); + }else if(buffer[4] == 0x02){ //地磁 + if(mmc5603nj_init() == 0){ + MMC5603nj_init = 0x20; + send2_0[4] = MMC5603nj_init; //地磁初始化失败 + send_data_to_ble_client(&send2_0,5); + return; + } + MMC5603nj_init = 0x21; + send2_0[4] = MMC5603nj_init; //地磁初始化成功 + send_data_to_ble_client(&send2_0,5); + }else if(buffer[4] == 0x03){ //气压计初始化 + if(bmp280_init() != 0){ + //初始化失败 + BMP280_init = 0x30; + send2_0[4] = BMP280_init; + send_data_to_ble_client(&send2_0,5); + return; + } + BMP280_init = 0x31; + send2_0[4] = BMP280_init; //气压计初始化成功 + send_data_to_ble_client(&send2_0,5); + } + break; + case 0x01: //设置传感器采集对象:左脚or右脚 + u8 send2_1[9] = {0xBB,0xBE,0x06,0x05,0x00,0x00,0x00,0x00,0x00}; + if(buffer[4] == 0x01){ //设定数据来源是左脚 + foot_init = 0x41; + }else if(buffer[4] == 0x02){//设定数据来源是右脚 + foot_init = 0x42; + } + send2_1[4] = foot_init; + send_data_to_ble_client(&send2_1,9); + break; + case 0x02: //数据包类型为:获取指定传感器初始化状态 + u8 send2_2[5] = {0xBB,0xBE,0x02,0x00,0x00}; + if(buffer[4] == 0x01){ //六轴 + send2_2[4] = SC7U22_init; + }else if(buffer[4] == 0x02){ //地磁 + send2_2[4] = MMC5603nj_init; + }else if(buffer[4] == 0x03){ //气压计 + send2_2[4] = BMP280_init; + } + send_data_to_ble_client(&send2_2,5); + break; + case 0x03: //开始/停止滑雪计算 + if(buffer[4] == 0x01){ //开始滑雪计算 + if(SC7U22_init == 0x10 || MMC5603nj_init == 0x20 || BMP280_init == 0x30){ //传感器未进行初始化 + u8 send2_3[5] = {0xBB,0xBE,0x02,0x00,0x00}; + send_data_to_ble_client(&send2_3,5); + return; + } + start_clloct(); + }else if(buffer[4] == 0x02){ //停止滑雪计算 + stop_clloct(); + } + break; + } + } + } +} void le_user_app_send_event(size_t command, unsigned char* data, size_t size) @@ -246,14 +346,15 @@ void le_user_app_event_handler(struct sys_event* event){ case 0x00: //数据包类型为:指定传感器初始化 u8 send2_0[5] = {0xBB,0xBE,0x02,0x00,0x00}; if(event->u.app.buffer[4] == 0x01){ //六轴 - stop_calibration(); + // stop_calibration(); if (SL_SC7U22_Config() == 0) { - send2_0[4] = 0x00; //初始化失败 - SC7U22_init = 0x10; - send_data_to_ble_client(&send2_0,5); - return; + SC7U22_init = 0x10; //初始化失败 + }else{ + SC7U22_init = 0x11; } - start_calibration(); + send2_0[4] = SC7U22_init; + send_data_to_ble_client(&send2_0,5); + // start_calibration(); }else if(event->u.app.buffer[4] == 0x02){ //地磁 if(mmc5603nj_init() == 0){ MMC5603nj_init = 0x20; diff --git a/cpu/br28/tools/app.bin b/cpu/br28/tools/app.bin index 5d2988e..0803cca 100644 Binary files a/cpu/br28/tools/app.bin and b/cpu/br28/tools/app.bin differ diff --git a/cpu/br28/tools/data_code.bin b/cpu/br28/tools/data_code.bin index e278184..51bab63 100644 Binary files a/cpu/br28/tools/data_code.bin and b/cpu/br28/tools/data_code.bin differ diff --git a/cpu/br28/tools/download/earphone/jl_isd.bin b/cpu/br28/tools/download/earphone/jl_isd.bin index 600948c..69e734b 100644 Binary files a/cpu/br28/tools/download/earphone/jl_isd.bin and b/cpu/br28/tools/download/earphone/jl_isd.bin differ diff --git a/cpu/br28/tools/sdk.elf.resolution.txt b/cpu/br28/tools/sdk.elf.resolution.txt index db50389..6b95139 100644 --- a/cpu/br28/tools/sdk.elf.resolution.txt +++ b/cpu/br28/tools/sdk.elf.resolution.txt @@ -1318,7 +1318,7 @@ objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,sm_passkey_input,l -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,little_endian_read_16,l -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,att_get_ccc_config,l --r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,test_func,l +-r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,le_user_app_event,l -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,att_set_ccc_config,l -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,ble_vendor_get_peer_rssi,l -r=objs/apps/common/third_party_profile/jieli/trans_data_demo/le_trans_data.c.o,set_app_connect_type,l @@ -5299,20 +5299,19 @@ objs/apps/earphone/xtell_Sensor/xtell_app_main.c.o -r=objs/apps/earphone/xtell_Sensor/xtell_app_main.c.o,app_var,l -r=objs/apps/earphone/xtell_Sensor/xtell_app_main.c.o,config_update_mode,l objs/apps/earphone/xtell_Sensor/xtell_handler.c.o --r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,le_user_app_send_event,pl --r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,sys_event_notify,l --r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,le_user_app_event_handler,pl +-r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,le_user_app_event,pl -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,printf,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,i2c_scanner_probe,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,send_data_to_ble_client,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,test_func,l --r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,stop_calibration,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,SL_SC7U22_Config,l --r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,start_calibration,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,mmc5603nj_init,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,bmp280_init,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,start_clloct,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,stop_clloct,l +-r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,le_user_app_send_event,pl +-r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,sys_event_notify,l +-r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,le_user_app_event_handler,pl -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,p33_soft_reset,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,clk_set,l -r=objs/apps/earphone/xtell_Sensor/xtell_handler.c.o,clk_get,l @@ -5368,48 +5367,42 @@ objs/apps/earphone/xtell_Sensor/send_data.c.o -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,sys_timer_get_ms,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,printf,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,get_ms_timer,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SC7U22_static_calibration,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,set_SC7U22_Error_Flag,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SL_SC7U22_RawData_Read,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,Q_SL_SC7U22_Angle_Output,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,close_process,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,send_data_to_ble_client,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,start_collect_fuc,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,mmc5603nj_read_origin_data,l +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,sensor_collect_task,pl +-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,bmp280_read_data,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,sensor_processing_task,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,circle_buffer_is_full,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_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,BLE_send_fuc,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,circle_buffer_is_empty,l +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_sem_pend,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,circle_buffer_read,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,stop_BLE_send_fuc,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,start_calibration,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,create_process,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,stop_calibration,pl -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,start_clloct,pl +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_task_create,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,stop_clloct,pl +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_task_del_req,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,xtell_task_create,pl -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,hw_iic_init,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,circle_buffer_init,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,sensor_task,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_time_dly,l +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_sem_create,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,on_ble_can_send,pl -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_sem_post,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,data_send_task,pl +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,send_data_to_ble_client,l -r=objs/apps/earphone/xtell_Sensor/send_data.c.o,test_func,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,os_task_create,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SC7U22_init,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,SC7U22_calibration_id,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,foot_init,l --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,BLE_send_fuc_id,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,start_collect_fuc_id,pl --r=objs/apps/earphone/xtell_Sensor/send_data.c.o,BLE_send_data,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,bmp280_init,l +-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,puts,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 +-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,os_mutex_create,l +-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_deinit,pl +-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,os_mutex_del,l -r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_write,pl +-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,os_mutex_pend,l -r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_is_full,pl +-r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,os_mutex_post,l -r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_read,pl -r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_is_empty,pl -r=objs/apps/earphone/xtell_Sensor/buffer/circle_buffer.c.o,circle_buffer_get_size,pl @@ -5446,65 +5439,19 @@ objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_SOFT_RESET,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,os_time_dly,l -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_TimeStamp_Read,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_RawData_Read,pl +-r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_FIFO_Read,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_Open_Close_SET,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_IN_SLEEP_SET,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_WakeUp_SET,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_Angle_Output,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,asinf,l --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,atanf,l --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Original_SL_SC7U22_Angle_Output,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,atan2f,l --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,sqrtf,l --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,fabsf,l --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,get_SC7U22_Error_Flag,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,set_SC7U22_Error_Flag,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Q_SL_SC7U22_Angle_Output,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,gravity_sensor_command,l -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,_gravity_sensor_get_ndata,l +-r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,delay,l -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,iic_write_result,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,iic_read_len,pl -r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,xt_Check_Flag,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,angle,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,angle_dot,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,angle0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,angle_dot0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Q_angle,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Q_gyro,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,R_angle,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,dt,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,P,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,P0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,P1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,P2,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Pdot0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Pdot1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Pdot2,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,C_0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,C_1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,C_2,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,q_bias0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,angle_err0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,PCt0_0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,PCt0_1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,E0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,K0_0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,K0_1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,t0_0,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,t0_1,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_Error_Flag,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_Error_cnt,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_Error_cnt2,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Temp_Accgyro,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Error_Accgyro,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Sum_Avg_Accgyro,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Kp,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Ki,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Q_dt,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Error_Mag_f,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Sum_Avg_Mag_f,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Temp_AccGyro,pl --r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Temp_Mag,pl +-r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,SL_SC7U22_FIFO_DATA,pl +-r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Acc_FIFO_Num,pl +-r=objs/apps/earphone/xtell_Sensor/sensor/SC7U22.c.o,Gyr_FIFO_Num,pl objs/apps/earphone/xtell_Sensor/calculate/skiing_tracker.c.o -r=objs/apps/earphone/xtell_Sensor/calculate/skiing_tracker.c.o,clear_speed,pl -r=objs/apps/earphone/xtell_Sensor/calculate/skiing_tracker.c.o,start_detection,pl