串口输出原始数据到上位机验证
This commit is contained in:
@ -21,8 +21,8 @@
|
||||
//*********************************************************************************//
|
||||
// UART配置 //
|
||||
//*********************************************************************************//
|
||||
#define TCFG_UART0_ENABLE ENABLE_THIS_MOUDLE //串口打印模块使能
|
||||
// #define TCFG_UART0_ENABLE 0 //串口打印模块使能
|
||||
// #define TCFG_UART0_ENABLE ENABLE_THIS_MOUDLE //串口打印模块使能
|
||||
#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 //串口波特率配置
|
||||
|
||||
@ -74,7 +74,8 @@ typedef struct{
|
||||
typedef struct{
|
||||
uint8_t checkout_1;
|
||||
uint8_t checkout_2;
|
||||
uint8_t index;
|
||||
uint8_t foot; //1:左脚,2:右脚
|
||||
uint8_t package_index;
|
||||
sensor_package_t sensor_package[MPU_FIFO_LEN];//一次蓝牙发送MPU_FIFO_LEN组传感器数据
|
||||
}ble_send_data_t; //一次蓝牙发送的数据内容
|
||||
|
||||
@ -82,8 +83,12 @@ typedef struct{
|
||||
static circle_buffer_t g_ble_send_cb; // 环形缓冲区管理结构体
|
||||
static ble_send_data_t g_sensor_data_storage[SENSOR_DATA_BUFFER_SIZE]; //缓冲区
|
||||
|
||||
|
||||
extern u8 foot_init;
|
||||
static OS_SEM receiver_ready_sem; // 用于启动同步的信号量
|
||||
|
||||
static const uart_bus_t *uart_bus = NULL;
|
||||
|
||||
static u16 test_id = 0;
|
||||
//END -- 变量定义
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -117,8 +122,9 @@ void sensor_collect_task(void){
|
||||
signed short gyry_buf[100];
|
||||
signed short gyrz_buf[100];
|
||||
int fifo_num = 0;
|
||||
static int data_index = 0;
|
||||
u8 index = 1;
|
||||
static int SL_data_index = 0;
|
||||
u8 package_index = 1;
|
||||
int tmp_index = 0;
|
||||
|
||||
while(1){//4组地磁数据、16组六轴数据、1组气压计数据
|
||||
interval++;
|
||||
@ -130,84 +136,94 @@ void sensor_collect_task(void){
|
||||
}
|
||||
// xlog("MAG x: %.2f,y: %.2f,z: %.2f\n",mmc5603nj_buffer.x,mmc5603nj_buffer.y,mmc5603nj_buffer.z);
|
||||
|
||||
fifo_num = SL_SC7U22_FIFO_Read(accx_buf,accy_buf,accz_buf,gyrx_buf,gyry_buf,gyrz_buf); //40ms一次性读取内置fifo的数据
|
||||
for(int i = 0; i < fifo_num; i++){
|
||||
|
||||
SL_SC7U22_FIFO_Read(accx_buf,accy_buf,accz_buf,gyrx_buf,gyry_buf,gyrz_buf); //一次性读取内置fifo的数据
|
||||
for(int i = 0; i < MPU_FIFO_LEN/4; i++){
|
||||
tmp_index = SL_data_index + i;
|
||||
// if(tmp_index >= MPU_FIFO_LEN-1) tmp_index = MPU_FIFO_LEN-1;
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[0] = accx_buf[i]; //acc_x
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[1] = accy_buf[i]; //acc_y
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[2] = accz_buf[i]; //acc_z
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[3] = gyrx_buf[i]; //gyr_x
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[4] = gyry_buf[i]; //gyr_y
|
||||
send_data.sensor_package[tmp_index].SC7U22_data[5] = gyrz_buf[i]; //gyr_z
|
||||
|
||||
// xlog(" Acc_x : %4d, Acc_y : %4d, Acc_z : %4d,\r\n", send_data.sensor_package[tmp_index].SC7U22_data[0], send_data.sensor_package[tmp_index].SC7U22_data[1], send_data.sensor_package[tmp_index].SC7U22_data[2]);
|
||||
#if 0
|
||||
float acc_g[3];
|
||||
float gyr_dps[3];
|
||||
acc_g[0] = (float)send_data.sensor_package[tmp_index].SC7U22_data[0] / 2048.0f;
|
||||
acc_g[1] = (float)send_data.sensor_package[tmp_index].SC7U22_data[1] / 2048.0f;
|
||||
acc_g[2] = (float)send_data.sensor_package[tmp_index].SC7U22_data[2] / 2048.0f;
|
||||
gyr_dps[0] = (float)send_data.sensor_package[tmp_index].SC7U22_data[3] * 0.061f;
|
||||
gyr_dps[1] = (float)send_data.sensor_package[tmp_index].SC7U22_data[4] * 0.061f;
|
||||
gyr_dps[2] = (float)send_data.sensor_package[tmp_index].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
|
||||
}
|
||||
SL_data_index += MPU_FIFO_LEN/4;
|
||||
|
||||
|
||||
if(interval >= 4){
|
||||
interval = 0;
|
||||
SL_data_index = 0;
|
||||
bmp280_read_data(&temperature, &pressure);//每40ms读取一次
|
||||
for(int i = 0;i<MPU_FIFO_LEN;i++){
|
||||
send_data.sensor_package[i].temperature = (int16_t)(temperature * 1000.0f);
|
||||
send_data.sensor_package[i].pressure = (int32_t)(pressure * 1000.0f);
|
||||
}
|
||||
|
||||
// xlog("temperature: %.2f,pressure: %.2f\n",temperature,pressure);
|
||||
// xlog("fifo_num:%d\n",fifo_num);
|
||||
|
||||
send_data.checkout_1 = 0xBE;
|
||||
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); //通知另一个发送任务
|
||||
|
||||
memset(&send_data, 0, sizeof(ble_send_data_t));
|
||||
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<MPU_FIFO_LEN;i++){
|
||||
send_data.sensor_package[i].SC7U22_data[0] = accx_buf[i]; //acc_x
|
||||
send_data.sensor_package[i].SC7U22_data[1] = accy_buf[i]; //acc_y
|
||||
send_data.sensor_package[i].SC7U22_data[2] = accz_buf[i]; //acc_z
|
||||
send_data.sensor_package[i].SC7U22_data[3] = gyrx_buf[i]; //gyr_x
|
||||
send_data.sensor_package[i].SC7U22_data[4] = gyry_buf[i]; //gyr_y
|
||||
send_data.sensor_package[i].SC7U22_data[5] = gyrz_buf[i]; //gyr_z
|
||||
send_data.sensor_package[i].temperature = (int16_t)(temperature * 1000.0f);
|
||||
send_data.sensor_package[i].pressure = (int32_t)(pressure * 1000.0f);
|
||||
|
||||
#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("temperature: %.2f,pressure: %.2f\n",temperature,pressure);
|
||||
// xlog("fifo_num:%d\n",fifo_num);
|
||||
|
||||
send_data.checkout_1 = 0xBE;
|
||||
send_data.checkout_2 = 0xBB;
|
||||
send_data.index = index;
|
||||
// circle_buffer_write(&g_ble_send_cb, &send_data);
|
||||
// os_sem_post(&receiver_ready_sem); //通知另一个发送任务
|
||||
|
||||
memset(&send_data, 0, sizeof(ble_send_data_t));
|
||||
index++;
|
||||
if(index >= 0xFF) index = 1;
|
||||
// xlog("=====================%d============================\n",get_ms_timer());
|
||||
package_index++;
|
||||
if(package_index >= 0xFF) package_index = 1;
|
||||
// xlog("=====================%d============================\n",get_ms_timer());
|
||||
}
|
||||
|
||||
os_time_dly(1); //10ms为单位
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int random = 0;
|
||||
void data_log(uint8_t* data){
|
||||
static u8 imu_airplane[MPU_FIFO_LEN][12];
|
||||
// 检查数据包头部
|
||||
if (data[0] != 0xBE || data[1] != 0xBB) {
|
||||
printf("Error: Invalid data packet header.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//左右脚
|
||||
uint8_t package_foot = data[2];
|
||||
|
||||
// 解析包索引
|
||||
uint8_t index = data[2];
|
||||
printf("--- Parsing Data Packet Index: %d ---\n", index);
|
||||
uint8_t package_index = data[3];
|
||||
printf("--- Parsing Data Packet Index: %d ---\n", package_index);
|
||||
|
||||
uint8_t* p = &data[3]; // 指向数据负载的起始位置
|
||||
uint8_t* p = &data[4]; // 指向数据负载的起始位置
|
||||
|
||||
// 循环解析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_airplane[i][2*j] = p[0];
|
||||
imu_airplane[i][2*j+1] = p[1];
|
||||
// 小端模式: 低字节在前, 高字节在后
|
||||
imu_raw[j] = (int16_t)(((uint16_t)p[1] << 8) | (uint16_t)p[0]);
|
||||
p += 2;
|
||||
@ -244,16 +260,21 @@ void data_log(uint8_t* data){
|
||||
float pressure = (float)press_raw / 1000.0f;
|
||||
|
||||
// 打印解析后的数据
|
||||
// if(i % 4 == 0){
|
||||
printf("Package[%d]:====================\n", i);
|
||||
// if(i % 8 == 0){
|
||||
// printf(" ==================ble index: %d\n", *p);
|
||||
// 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(" 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");
|
||||
// printf("--- End of Packet ---\n\n");
|
||||
|
||||
extern void uartSendData(void *buf, u16 len) ; // 确保u16是uint16_t或unsigned short
|
||||
// uartSendData(imu_airplane, sizeof(imu_airplane));
|
||||
uartSendData(data, 484); // 发送总共17字节
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,7 +283,7 @@ void data_log(uint8_t* data){
|
||||
*/
|
||||
void BLE_send_fuc(void){
|
||||
ble_send_data_t send_data;
|
||||
uint8_t send_buffer[483];
|
||||
uint8_t send_buffer[484];
|
||||
while(1){
|
||||
os_sem_pend(&receiver_ready_sem, 0); //阻塞等待
|
||||
circle_buffer_read(&g_ble_send_cb, &send_data);
|
||||
@ -271,7 +292,8 @@ void BLE_send_fuc(void){
|
||||
uint8_t *p = send_buffer;
|
||||
*p++ = send_data.checkout_1;
|
||||
*p++ = send_data.checkout_2;
|
||||
*p++ = send_data.index;
|
||||
*p++ = send_data.foot;
|
||||
*p++ = send_data.package_index;
|
||||
|
||||
for (int i = 0; i < MPU_FIFO_LEN; i++) {
|
||||
sensor_package_t *pkg = &send_data.sensor_package[i];
|
||||
@ -315,9 +337,11 @@ void BLE_send_fuc(void){
|
||||
}
|
||||
|
||||
|
||||
extern void uartSendData(void *buf, u16 len) ; // 确保u16是uint16_t或unsigned short
|
||||
uartSendData(send_buffer, 484); // 发送总共17字节
|
||||
send_data_to_ble_client(send_buffer, 484); // 发送数据
|
||||
|
||||
// send_data_to_ble_client(send_buffer, 3 + sizeof(send_data.sensor_package)); // 发送数据
|
||||
data_log(send_buffer);
|
||||
// data_log(send_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,8 +366,8 @@ void start_clloct(void){
|
||||
*
|
||||
*/
|
||||
void stop_clloct(void){
|
||||
os_task_del_req("sensor_collect_task");
|
||||
os_task_del_req("BLE_send_fuc");
|
||||
os_task_del("sensor_collect_task");
|
||||
os_task_del("BLE_send_fuc");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -372,10 +396,40 @@ void xtell_task_create(void){
|
||||
|
||||
os_sem_create(&receiver_ready_sem, 0);
|
||||
|
||||
extern void test_uart_init(void);
|
||||
test_uart_init();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 发给上位机
|
||||
*
|
||||
*/
|
||||
void test_uart_init(void){
|
||||
#if TCFG_UART0_ENABLE == 0
|
||||
static u8 buff[40];
|
||||
struct uart_platform_data_t u_arg = {0};
|
||||
u_arg.tx_pin = IO_PORT_DP;
|
||||
u_arg.rx_cbuf = buff;
|
||||
u_arg.rx_cbuf_size = 32;
|
||||
u_arg.frame_length = 6;
|
||||
u_arg.rx_timeout = 100;
|
||||
u_arg.isr_cbfun = NULL;
|
||||
u_arg.baud = 1000000;
|
||||
u_arg.is_9bit = 0;
|
||||
uart_bus = uart_dev_open(&u_arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void uartSendData(void *buf, u16 len) //发送数据的接口。
|
||||
{
|
||||
#if TCFG_UART0_ENABLE == 0
|
||||
if (uart_bus) {
|
||||
uart_bus->write(buf, len); //把数据写到DMA
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//test
|
||||
//
|
||||
@ -385,50 +439,62 @@ static signed char acc_data_buf[BUFF_LEN] = {0};
|
||||
// 1. 定义一个全局的信号量
|
||||
static OS_SEM ble_send_sem;
|
||||
|
||||
void on_ble_can_send(void) {
|
||||
os_sem_post(&ble_send_sem);
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
void data_send_task(void){
|
||||
while(1){
|
||||
// 等待“发送许可”信号量,如果没许可,任务会在此阻塞
|
||||
// os_sem_pend(&ble_send_sem, 1);
|
||||
|
||||
// static signed char acc_data_buf[60] = {
|
||||
// 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22
|
||||
// };
|
||||
|
||||
acc_data_buf[1] = (uint8_t)(j & 0xFF);
|
||||
acc_data_buf[2] = (uint8_t)(j>>8 & 0xFF);
|
||||
acc_data_buf[3] = (uint8_t)(j>>16 & 0xFF);
|
||||
acc_data_buf[4] = (uint8_t)(j>>24 & 0xFF);
|
||||
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];
|
||||
SL_SC7U22_FIFO_Read(accx_buf,accy_buf,accz_buf,gyrx_buf,gyry_buf,gyrz_buf); //一次性读取内置fifo的数据
|
||||
|
||||
acc_data_buf[0] = 0xAA;
|
||||
send_data_to_ble_client(&acc_data_buf, 500);
|
||||
// acc_data_buf[0] = 0xBB;
|
||||
// send_data_to_ble_client(&acc_data_buf, 500);
|
||||
// acc_data_buf[0] = 0xCC;
|
||||
// send_data_to_ble_client(&acc_data_buf, 500);
|
||||
// acc_data_buf[0] = 0xDD;
|
||||
// send_data_to_ble_client(&acc_data_buf, 500);
|
||||
#if 1
|
||||
// 定义新的Packet ID和数据长度
|
||||
#define PACKET_ID_RAW_IMU 0x04
|
||||
#define PACKET_LENGTH_RAW_IMU 12 // 6个传感器值,每个2字节
|
||||
|
||||
// static signed char acc_data_buf[20] = {
|
||||
// 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
// };
|
||||
// send_data_to_ble_client(&acc_data_buf, 20);
|
||||
// send_data_to_ble_client(&acc_data_buf, 20);
|
||||
// send_data_to_ble_client(&acc_data_buf, 20);
|
||||
// xlog("===========time:%d\n",get_ms_timer());
|
||||
// 声明一个发送缓冲区,用于包含帧头、ID、长度、数据和校验和
|
||||
// 帧头 (2) + ID (1) + 长度 (1) + 数据 (12) + 校验和 (1) = 17 字节
|
||||
uint8_t tx_buffer[2 + 1 + 1 + PACKET_LENGTH_RAW_IMU + 1];
|
||||
uint8_t checksum = 0;
|
||||
int i; // 用于循环计算校验和
|
||||
|
||||
j++;
|
||||
os_time_dly(4); //10ms单位
|
||||
// 填充帧头
|
||||
tx_buffer[0] = 0xAA;
|
||||
tx_buffer[1] = 0xFF;
|
||||
|
||||
// 填充Packet ID和长度
|
||||
tx_buffer[2] = PACKET_ID_RAW_IMU;
|
||||
tx_buffer[3] = PACKET_LENGTH_RAW_IMU;
|
||||
|
||||
// 填充原始传感器数据 (与你原先的processing_data内容相同)
|
||||
tx_buffer[4] = (uint8_t)(accx_buf[0] & 0xFF); // accX LSB
|
||||
tx_buffer[5] = (uint8_t)(accx_buf[0] >> 8 & 0xFF); // accX MSB
|
||||
tx_buffer[6] = (uint8_t)(accy_buf[0] & 0xFF); // accY LSB
|
||||
tx_buffer[7] = (uint8_t)(accy_buf[0] >> 8 & 0xFF); // accY MSB
|
||||
tx_buffer[8] = (uint8_t)(accz_buf[0] & 0xFF); // accZ LSB
|
||||
tx_buffer[9] = (uint8_t)(accz_buf[0] >> 8 & 0xFF); // accZ MSB
|
||||
tx_buffer[10] = (uint8_t)(gyrx_buf[0] & 0xFF); // gyrX LSB
|
||||
tx_buffer[11] = (uint8_t)(gyrx_buf[0] >> 8 & 0xFF); // gyrX MSB
|
||||
tx_buffer[12] = (uint8_t)(gyry_buf[0] & 0xFF); // gyrY LSB
|
||||
tx_buffer[13] = (uint8_t)(gyry_buf[0] >> 8 & 0xFF); // gyrY MSB
|
||||
tx_buffer[14] = (uint8_t)(gyrz_buf[0] & 0xFF); // gyrZ LSB
|
||||
tx_buffer[15] = (uint8_t)(gyrz_buf[0] >> 8 & 0xFF); // gyrZ MSB
|
||||
|
||||
// 计算校验和 (从 Packet ID 到所有数据字节的和)
|
||||
checksum = tx_buffer[2] + tx_buffer[3]; // ID + Length
|
||||
for (i = 0; i < PACKET_LENGTH_RAW_IMU; i++) {
|
||||
checksum += tx_buffer[4 + i]; // 加上所有数据字节
|
||||
}
|
||||
tx_buffer[4 + PACKET_LENGTH_RAW_IMU] = checksum; // 校验和是最后一个字节
|
||||
|
||||
// 发送整个缓冲区
|
||||
extern void uartSendData(void *buf, u16 len) ; // 确保u16是uint16_t或unsigned short
|
||||
uartSendData(tx_buffer, sizeof(tx_buffer)); // 发送总共17字节
|
||||
#endif
|
||||
|
||||
}
|
||||
static u16 gtest_id = 0;
|
||||
void test_func(void){
|
||||
@ -448,6 +514,8 @@ void test_func(void){
|
||||
bmp280_init();
|
||||
os_task_create(BLE_send_fuc,NULL,5,1024,32,"BLE_send_fuc");
|
||||
os_task_create(sensor_collect_task,NULL,5,1024,32,"sensor_collect_task");
|
||||
|
||||
// create_process(&test_id, "sensor_test",NULL,data_send_task ,3);
|
||||
// data_send_task();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ unsigned char SL_SC7U22_Config(void)
|
||||
|
||||
// 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
|
||||
SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x40, 0x8B);//ACC_CON 高性能模式,400Hz -- lmx
|
||||
|
||||
#if ACC_RANGE==2
|
||||
SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x41, 0x00);//ACC_RANGE 00:±2G
|
||||
@ -157,7 +157,7 @@ unsigned char SL_SC7U22_Config(void)
|
||||
// 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, 0xCA);//GYR_CONF 噪声优化开启,高性能模式,400Hz -- lmx
|
||||
SL_SC7U22_I2c_Spi_Write(SL_SPI_IIC_INTERFACE, 0x42, 0xCB);//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
|
||||
@ -391,7 +391,7 @@ unsigned short SL_SC7U22_FIFO_Read(signed short *accx_buf,signed short *accy_buf
|
||||
accx_buf[Acc_FIFO_Num] = ((s16)(SL_SC7U22_FIFO_DATA[i + 0] * 256 + SL_SC7U22_FIFO_DATA[i + 1])) ;
|
||||
accy_buf[Acc_FIFO_Num] = ((s16)(SL_SC7U22_FIFO_DATA[i + 2] * 256 + SL_SC7U22_FIFO_DATA[i + 3])) ;
|
||||
accz_buf[Acc_FIFO_Num] = ((s16)(SL_SC7U22_FIFO_DATA[i + 4] * 256 + SL_SC7U22_FIFO_DATA[i + 5])) ;
|
||||
xlog("AccNum : %d ,Acc_x : %4d, Acc_y : %4d, Acc_z : %4d,\r\n",Acc_FIFO_Num, accx_buf[Acc_FIFO_Num], accy_buf[Acc_FIFO_Num], accz_buf[Acc_FIFO_Num]);
|
||||
// xlog("AccNum : %d ,Acc_x : %4d, Acc_y : %4d, Acc_z : %4d,\r\n",Acc_FIFO_Num, accx_buf[Acc_FIFO_Num], accy_buf[Acc_FIFO_Num], accz_buf[Acc_FIFO_Num]);
|
||||
i = i + 6;
|
||||
Acc_FIFO_Num++;
|
||||
}
|
||||
@ -416,7 +416,7 @@ unsigned short SL_SC7U22_FIFO_Read(signed short *accx_buf,signed short *accy_buf
|
||||
fifo_len = Acc_FIFO_Num;
|
||||
else
|
||||
fifo_len = Gyr_FIFO_Num;
|
||||
xlog("Acc_FIFO_Num:%d,Gyr_FIFO_Num:%d\n",Acc_FIFO_Num,Gyr_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);
|
||||
|
||||
@ -83,7 +83,7 @@ extern u8 init_ok;
|
||||
extern u8 sniff_out;
|
||||
unsigned char xtell_bl_state=0; //存放经典蓝牙的连接状态,0断开,1是连接
|
||||
u8 bt_newname =0;
|
||||
unsigned char xt_ble_new_name[9] = "CM-4-F9";
|
||||
unsigned char xt_ble_new_name[9] = "xtell";
|
||||
static u16 play_poweron_ok_timer_id = 0;
|
||||
|
||||
// -- 初始化标志位 --
|
||||
@ -255,7 +255,7 @@ void le_user_app_event(u8* buffer){
|
||||
}
|
||||
break;
|
||||
case 0x01: //设置传感器采集对象:左脚or右脚
|
||||
u8 send2_1[9] = {0xBB,0xBE,0x06,0x05,0x00,0x00,0x00,0x00,0x00};
|
||||
u8 send2_1[5] = {0xBB,0xBE,0x06,0x05,0x00};
|
||||
if(buffer[4] == 0x01){ //设定数据来源是左脚
|
||||
foot_init = 0x41;
|
||||
}else if(buffer[4] == 0x02){//设定数据来源是右脚
|
||||
|
||||
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 -key AC69.key -format all -key 646-AC690X-7603.key
|
||||
..\..\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
|
||||
|
||||
@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.
@ -2260,7 +2260,6 @@ objs/apps/earphone/board/br28/board_jl701n_demo.c.o
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,power_wakeup_index_enable,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gSensor_wkupup_enable,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,debug_uart_init,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,uart_init,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,get_led_config,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,get_tone_config,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,get_sys_default_vol,pl
|
||||
@ -2271,7 +2270,6 @@ objs/apps/earphone/board/br28/board_jl701n_demo.c.o
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,cfg_file_parse,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,devices_init,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,power_set_mode,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_die,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,bredr_set_dut_enble,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,board_set_soft_poweroff,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,soff_gpio_protect,l
|
||||
@ -2283,6 +2281,7 @@ objs/apps/earphone/board/br28/board_jl701n_demo.c.o
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,sleep_enter_callback,pl
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_pull_up,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_pull_down,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_die,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_dieh,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,gpio_set_direction,l
|
||||
-r=objs/apps/earphone/board/br28/board_jl701n_demo.c.o,sleep_enter_callback_common,l
|
||||
@ -5371,28 +5370,32 @@ 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,bmp280_read_data,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
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,BLE_send_fuc,pl
|
||||
-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,send_data_to_ble_client,l
|
||||
-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,os_task_del,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,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,test_uart_init,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/send_data.c.o,uart_dev_open,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,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,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
|
||||
@ -5471,6 +5474,7 @@ objs/apps/earphone/xtell_Sensor/calculate/skiing_tracker.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/calculate/skiing_tracker.c.o,debug1,pl
|
||||
objs/apps/earphone/xtell_Sensor/ano/ano_protocol.c.o
|
||||
-r=objs/apps/earphone/xtell_Sensor/ano/ano_protocol.c.o,ano_protocol_init,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/ano/ano_protocol.c.o,uart_dev_open,l
|
||||
-r=objs/apps/earphone/xtell_Sensor/ano/ano_protocol.c.o,ano_send_inertial_data,pl
|
||||
-r=objs/apps/earphone/xtell_Sensor/ano/ano_protocol.c.o,ano_send_attitude_data,pl
|
||||
objs/apps/earphone/xtell_Sensor/sensor/MMC56.c.o
|
||||
@ -16046,7 +16050,7 @@ cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,task_kill,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,free,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,p33_soft_reset,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,uartSendData,
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,uartSendData,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,const_audio_pcm_debug_v2_en,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.454876.aec_uart_debug.c,config_asser,l
|
||||
cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c
|
||||
@ -16076,7 +16080,7 @@ cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,p33_soft_reset,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,os_sem_pend,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,cbuf_read,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,uartSendData,
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,uartSendData,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,config_asser,l
|
||||
-r=cpu/br28/liba/aec.a.llvm.469924.aec_uart_debug_v2.c,jiffies,l
|
||||
cpu/br28/liba/aec.a.llvm.487808.commproc_ns.c
|
||||
|
||||
Reference in New Issue
Block a user