bsp_interface.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. ///********************** 头文件 *************************/
  2. #include "bsp_interface.h"
  3. ///********************** 变量区 *************************/
  4. ////extern int16_t gyro[3];
  5. ////extern int16_t accel[3];
  6. //extern uint16_t press;
  7. /********************** 函数声明区 *************************/
  8. ////发给匿名飞控
  9. //void sen_ANO_data_to_host(void)
  10. //{
  11. // uint8_t buf[256];
  12. // uint8_t L=0;
  13. //
  14. //
  15. // int16_t roll = (int16_t)(getRoll()*100);
  16. // int16_t pitch = (int16_t)(getPitch()*100);
  17. // int16_t yaw = (int16_t)(getYaw()*100);
  18. //
  19. // buf[L++] = 0xAA; //帧头
  20. // buf[L++] = 0x05; //发送设备
  21. // buf[L++] = 0xAF; //目标设备
  22. // buf[L++] = 0x01; //功能字
  23. // buf[L++] = 0x01; //LEN
  24. //
  25. // buf[L++] = (uint8_t)(roll>>0);
  26. // buf[L++] = (uint8_t)(roll>>8);
  27. // buf[L++] = (uint8_t)(pitch>>0);
  28. // buf[L++] = (uint8_t)(pitch>>8);
  29. // buf[L++] = (uint8_t)(yaw>>0);
  30. // buf[L++] = (uint8_t)(yaw>>8);
  31. //
  32. // buf[L++] = 0;
  33. // buf[L++] = 0;
  34. // buf[L++] = 0;
  35. // buf[L++] = 0;
  36. //
  37. // buf[L++] = 0;
  38. //
  39. // buf[L++] = 0;
  40. //
  41. // buf[L++] = 0;
  42. //
  43. //
  44. //
  45. //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>0);
  46. //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>8);
  47. ////
  48. //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>0);
  49. //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>8);
  50. ////
  51. //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>0);
  52. //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>8);
  53. //
  54. // buf[L++] = (uint8_t)(mMPU9250.mag_x>>0);
  55. // buf[L++] = (uint8_t)(mMPU9250.mag_x>>8);
  56. //
  57. // buf[L++] = (uint8_t)(mMPU9250.mag_y>>0);
  58. // buf[L++] = (uint8_t)(mMPU9250.mag_y>>8);
  59. //
  60. // buf[L++] = (uint8_t)(mMPU9250.mag_z>>0);
  61. // buf[L++] = (uint8_t)(mMPU9250.mag_z>>8);
  62. //
  63. // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>0);
  64. // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>8);
  65. //
  66. // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>0);
  67. // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>8);
  68. //
  69. // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>0);
  70. // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>8);
  71. // buf[L++] = (uint8_t)(roll>>0);
  72. // buf[L++] = (uint8_t)(roll>>8);
  73. // buf[L++] = (uint8_t)(pitch>>0);
  74. // buf[L++] = (uint8_t)(pitch>>8);
  75. // buf[L++] = (uint8_t)(yaw>>0);
  76. // buf[L++] = (uint8_t)(yaw>>8);
  77. //
  78. // bsp_esb_send(buf,L); //发送出去
  79. //}
  80. //void sen_data_to_host(void)
  81. //{
  82. // uint8_t buf[256];
  83. // uint8_t L=0;
  84. //
  85. // int32_t roll, pitch, yaw;
  86. //
  87. // buf[L++] = (uint8_t)(press>>8);
  88. // buf[L++] = (uint8_t)(press>>0);
  89. //
  90. // roll = (int32_t)(getRoll()*100);
  91. // pitch = (int32_t)(getPitch()*100);
  92. // yaw = (int32_t)(getYaw()*100);
  93. //
  94. // buf[L++] = (uint8_t)(roll>>24);
  95. // buf[L++] = (uint8_t)(roll>>16);
  96. // buf[L++] = (uint8_t)(roll>>8);
  97. // buf[L++] = (uint8_t)(roll>>0);
  98. //
  99. // buf[L++] = (uint8_t)(pitch>>24);
  100. // buf[L++] = (uint8_t)(pitch>>16);
  101. // buf[L++] = (uint8_t)(pitch>>8);
  102. // buf[L++] = (uint8_t)(pitch>>0);
  103. //
  104. // buf[L++] = (uint8_t)(yaw>>24);
  105. // buf[L++] = (uint8_t)(yaw>>16);
  106. // buf[L++] = (uint8_t)(yaw>>8);
  107. // buf[L++] = (uint8_t)(yaw>>0);
  108. ////
  109. //// buf[L++] = (uint8_t)(accel[0]>>8);
  110. //// buf[L++] = (uint8_t)(accel[0]>>0);
  111. ////
  112. //// buf[L++] = (uint8_t)(accel[1]>>8);
  113. //// buf[L++] = (uint8_t)(accel[1]>>0);
  114. ////
  115. //// buf[L++] = (uint8_t)(accel[2]>>8);
  116. //// buf[L++] = (uint8_t)(accel[2]>>0);
  117. ////
  118. //// buf[L++] = (uint8_t)(gyro[0]>>8);
  119. //// buf[L++] = (uint8_t)(gyro[0]>>0);
  120. ////
  121. //// buf[L++] = (uint8_t)(gyro[1]>>8);
  122. //// buf[L++] = (uint8_t)(gyro[1]>>0);
  123. ////
  124. //// buf[L++] = (uint8_t)(gyro[2]>>8);
  125. //// buf[L++] = (uint8_t)(gyro[2]>>0);
  126. //
  127. // send_protocol(DEX_NUM,CMD_HEART,buf,L);
  128. //}
  129. ////发给维特智能上位机显示
  130. //void sen_wit_motion_data_to_host(void)
  131. //{
  132. // uint8_t buf[256];
  133. // uint8_t L=0;
  134. //
  135. //
  136. // int16_t roll = (int16_t)(getRoll()/180.0f*32768.0f);
  137. // int16_t pitch = (int16_t)(getPitch()/180.0f*32768.0f);
  138. // int16_t yaw = (int16_t)(getYaw()/180.0f*32768.0f);
  139. //
  140. // buf[L++] = 0x55;
  141. // buf[L++] = 0x61;
  142. //
  143. //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>0);
  144. //// buf[L++] = (uint8_t)(mMPU9250.acc_x>>8);
  145. ////
  146. //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>0);
  147. //// buf[L++] = (uint8_t)(mMPU9250.acc_y>>8);
  148. ////
  149. //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>0);
  150. //// buf[L++] = (uint8_t)(mMPU9250.acc_z>>8);
  151. //
  152. // buf[L++] = (uint8_t)(mMPU9250.mag_x>>0);
  153. // buf[L++] = (uint8_t)(mMPU9250.mag_x>>8);
  154. //
  155. // buf[L++] = (uint8_t)(mMPU9250.mag_y>>0);
  156. // buf[L++] = (uint8_t)(mMPU9250.mag_y>>8);
  157. //
  158. // buf[L++] = (uint8_t)(mMPU9250.mag_z>>0);
  159. // buf[L++] = (uint8_t)(mMPU9250.mag_z>>8);
  160. //
  161. // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>0);
  162. // buf[L++] = (uint8_t)(mMPU9250.gyro_x>>8);
  163. //
  164. // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>0);
  165. // buf[L++] = (uint8_t)(mMPU9250.gyro_y>>8);
  166. //
  167. // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>0);
  168. // buf[L++] = (uint8_t)(mMPU9250.gyro_z>>8);
  169. // buf[L++] = (uint8_t)(roll>>0);
  170. // buf[L++] = (uint8_t)(roll>>8);
  171. // buf[L++] = (uint8_t)(pitch>>0);
  172. // buf[L++] = (uint8_t)(pitch>>8);
  173. // buf[L++] = (uint8_t)(yaw>>0);
  174. // buf[L++] = (uint8_t)(yaw>>8);
  175. //
  176. //// bsp_esb_send(buf,L); //发送出去
  177. // for(int i=0;i<L;i++) app_uart_put(buf[i]);
  178. //}
  179. //static uint8_t send_motion = 0;
  180. //static uint8_t send_ts = 0;
  181. //static uint8_t send_times = 0;
  182. //void send_motion_to_phone(uint8_t motion,uint16_t ts)
  183. //{
  184. // send_motion = motion;
  185. // send_ts = ts;
  186. // send_times = 10;
  187. //// uint8_t buf[16];
  188. //// uint8_t L=0;
  189. //// buf[L++] = motion;
  190. ////
  191. //// buf[L++] = (uint8_t)(ts>>8);
  192. //// buf[L++] = (uint8_t)(ts>>0);
  193. ////
  194. //// for(int i = 0; i <5; i++)
  195. //// send_protocol(DEX_NUM,CMD_MOTION,buf,L);
  196. //}
  197. //void send_to_phone_process(void)
  198. //{
  199. // uint8_t buf[16];
  200. // uint8_t L=0;
  201. // if(send_times>0){
  202. // send_times--;
  203. // buf[L++] = send_motion;
  204. // buf[L++] = (uint8_t)(send_ts>>8);
  205. // buf[L++] = (uint8_t)(send_ts>>0);
  206. // send_protocol(DEX_NUM,CMD_MOTION,buf,L);
  207. // }
  208. //}