123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- ///********************** 头文件 *************************/
- #include "bsp_interface.h"
- ///********************** 变量区 *************************/
- ////extern int16_t gyro[3];
- ////extern int16_t accel[3];
- //extern uint16_t press;
- /********************** 函数声明区 *************************/
- ////发给匿名飞控
- //void sen_ANO_data_to_host(void)
- //{
- // uint8_t buf[256];
- // uint8_t L=0;
- //
- //
- // int16_t roll = (int16_t)(getRoll()*100);
- // int16_t pitch = (int16_t)(getPitch()*100);
- // int16_t yaw = (int16_t)(getYaw()*100);
- //
- // buf[L++] = 0xAA; //帧头
- // buf[L++] = 0x05; //发送设备
- // buf[L++] = 0xAF; //目标设备
- // buf[L++] = 0x01; //功能字
- // buf[L++] = 0x01; //LEN
- //
- // buf[L++] = (uint8_t)(roll>>0);
- // buf[L++] = (uint8_t)(roll>>8);
- // buf[L++] = (uint8_t)(pitch>>0);
- // buf[L++] = (uint8_t)(pitch>>8);
- // buf[L++] = (uint8_t)(yaw>>0);
- // buf[L++] = (uint8_t)(yaw>>8);
- //
- // buf[L++] = 0;
- // buf[L++] = 0;
- // buf[L++] = 0;
- // buf[L++] = 0;
- //
- // buf[L++] = 0;
- //
- // buf[L++] = 0;
- //
- // buf[L++] = 0;
- //
- //
- //
- //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>8);
- ////
- //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>8);
- ////
- //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_x>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_x>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_y>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_y>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_z>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_z>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>8);
- // buf[L++] = (uint8_t)(roll>>0);
- // buf[L++] = (uint8_t)(roll>>8);
- // buf[L++] = (uint8_t)(pitch>>0);
- // buf[L++] = (uint8_t)(pitch>>8);
- // buf[L++] = (uint8_t)(yaw>>0);
- // buf[L++] = (uint8_t)(yaw>>8);
- //
- // bsp_esb_send(buf,L); //发送出去
- //}
- //void sen_data_to_host(void)
- //{
- // uint8_t buf[256];
- // uint8_t L=0;
- //
- // int32_t roll, pitch, yaw;
- //
- // buf[L++] = (uint8_t)(press>>8);
- // buf[L++] = (uint8_t)(press>>0);
- //
- // roll = (int32_t)(getRoll()*100);
- // pitch = (int32_t)(getPitch()*100);
- // yaw = (int32_t)(getYaw()*100);
- //
- // buf[L++] = (uint8_t)(roll>>24);
- // buf[L++] = (uint8_t)(roll>>16);
- // buf[L++] = (uint8_t)(roll>>8);
- // buf[L++] = (uint8_t)(roll>>0);
- //
- // buf[L++] = (uint8_t)(pitch>>24);
- // buf[L++] = (uint8_t)(pitch>>16);
- // buf[L++] = (uint8_t)(pitch>>8);
- // buf[L++] = (uint8_t)(pitch>>0);
- //
- // buf[L++] = (uint8_t)(yaw>>24);
- // buf[L++] = (uint8_t)(yaw>>16);
- // buf[L++] = (uint8_t)(yaw>>8);
- // buf[L++] = (uint8_t)(yaw>>0);
- ////
- //// buf[L++] = (uint8_t)(accel[0]>>8);
- //// buf[L++] = (uint8_t)(accel[0]>>0);
- ////
- //// buf[L++] = (uint8_t)(accel[1]>>8);
- //// buf[L++] = (uint8_t)(accel[1]>>0);
- ////
- //// buf[L++] = (uint8_t)(accel[2]>>8);
- //// buf[L++] = (uint8_t)(accel[2]>>0);
- ////
- //// buf[L++] = (uint8_t)(gyro[0]>>8);
- //// buf[L++] = (uint8_t)(gyro[0]>>0);
- ////
- //// buf[L++] = (uint8_t)(gyro[1]>>8);
- //// buf[L++] = (uint8_t)(gyro[1]>>0);
- ////
- //// buf[L++] = (uint8_t)(gyro[2]>>8);
- //// buf[L++] = (uint8_t)(gyro[2]>>0);
- //
- // send_protocol(DEX_NUM,CMD_HEART,buf,L);
- //}
- ////发给维特智能上位机显示
- //void sen_wit_motion_data_to_host(void)
- //{
- // uint8_t buf[256];
- // uint8_t L=0;
- //
- //
- // int16_t roll = (int16_t)(getRoll()/180.0f*32768.0f);
- // int16_t pitch = (int16_t)(getPitch()/180.0f*32768.0f);
- // int16_t yaw = (int16_t)(getYaw()/180.0f*32768.0f);
- //
- // buf[L++] = 0x55;
- // buf[L++] = 0x61;
- //
- //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>8);
- ////
- //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>8);
- ////
- //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>0);
- //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_x>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_x>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_y>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_y>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.mag_z>>0);
- // buf[L++] = (uint8_t)(mMPU9250.mag_z>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>8);
- //
- // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>0);
- // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>8);
- // buf[L++] = (uint8_t)(roll>>0);
- // buf[L++] = (uint8_t)(roll>>8);
- // buf[L++] = (uint8_t)(pitch>>0);
- // buf[L++] = (uint8_t)(pitch>>8);
- // buf[L++] = (uint8_t)(yaw>>0);
- // buf[L++] = (uint8_t)(yaw>>8);
- //
- //// bsp_esb_send(buf,L); //发送出去
- // for(int i=0;i<L;i++) app_uart_put(buf[i]);
- //}
- //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);
- // }
- //}
|