/********************** 头文件 *************************/ #include "bsp_interface.h" /********************** 变量区 *************************/ extern IMU_DAT_t m_IMU_DAT_t; /********************** 函数声明区 *************************/ void sen_data_buf_to_host(void) { static uint16_t ts = 0; uint8_t buf[256]; uint8_t L=0; buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.press>>0); ts++; send_protocol(DEX_NUM,CMD_HEART,buf,L); } void sen_data_to_host(void) { static uint16_t ts = 0; uint8_t buf[256]; uint8_t L=0; buf[L++] = (uint8_t)(m_IMU_DAT_t.h.press>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.h.press>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[0]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[0]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[1]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[1]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[2]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.pos[2]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[0]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[0]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[1]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[1]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[2]>>8); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.att[2]>>0); buf[L++] = (uint8_t)(m_IMU_DAT_t.s.zupt>>0); ts++; send_protocol(DEX_NUM,CMD_HEART,buf,L); } static uint8_t send_motion = 0; static uint8_t send_ts = 0; static uint8_t send_times = 0; void send_motion_to_phone(uint8_t motion,uint16_t ts) { send_motion = motion; send_ts = ts; send_times = 10; // uint8_t buf[16]; // uint8_t L=0; // buf[L++] = motion; // // buf[L++] = (uint8_t)(ts>>8); // buf[L++] = (uint8_t)(ts>>0); // // for(int i = 0; i <5; i++) // send_protocol(DEX_NUM,CMD_MOTION,buf,L); } void send_to_phone_process(void) { uint8_t buf[16]; uint8_t L=0; if(send_times>0){ send_times--; buf[L++] = send_motion; buf[L++] = (uint8_t)(send_ts>>8); buf[L++] = (uint8_t)(send_ts>>0); send_protocol(DEX_NUM,CMD_MOTION,buf,L); } }