///********************** 头文件 *************************/ #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>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); // } //}