#include "hal_protocol.h" #include "hal_esb.h" #include "hal_uart.h" /********************** 外部函数声明区 *************************/ void Send_IMU_Data(IMU_DAT_t* p) { static uint8_t buf[64]; int L = 0; buf[L++] = (uint8_t)(p->h.press>>8); buf[L++] = (uint8_t)(p->h.press>>0); buf[L++] = (uint8_t)(p->h.acc[0]>>8); buf[L++] = (uint8_t)(p->h.acc[0]>>0); buf[L++] = (uint8_t)(p->h.acc[1]>>8); buf[L++] = (uint8_t)(p->h.acc[1]>>0); buf[L++] = (uint8_t)(p->h.acc[2]>>8); buf[L++] = (uint8_t)(p->h.acc[2]>>0); buf[L++] = (uint8_t)(p->h.gyr[0]>>8); buf[L++] = (uint8_t)(p->h.gyr[0]>>0); buf[L++] = (uint8_t)(p->h.gyr[1]>>8); buf[L++] = (uint8_t)(p->h.gyr[1]>>0); buf[L++] = (uint8_t)(p->h.gyr[2]>>8); buf[L++] = (uint8_t)(p->h.gyr[2]>>0); buf[L++] = (uint8_t)(p->h.mag[0]>>8); buf[L++] = (uint8_t)(p->h.mag[0]>>0); buf[L++] = (uint8_t)(p->h.mag[1]>>8); buf[L++] = (uint8_t)(p->h.mag[1]>>0); buf[L++] = (uint8_t)(p->h.mag[2]>>8); buf[L++] = (uint8_t)(p->h.mag[2]>>0); ESB_Tx_Send(0,buf,L,1,0,0,0); } void send_protocol(uint8_t dex,uint8_t cmd,uint8_t* dat,uint8_t len) { if(IS_HOST){ UART0_Send(cmd,dat,len); }else{ ESB_Send(cmd,dat,len); } }