You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
12 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE AP_ADC PACKING
  3. #define MAVLINK_MSG_ID_AP_ADC 153
  4. MAVPACKED(
  5. typedef struct __mavlink_ap_adc_t {
  6. uint16_t adc1; /*< ADC output 1.*/
  7. uint16_t adc2; /*< ADC output 2.*/
  8. uint16_t adc3; /*< ADC output 3.*/
  9. uint16_t adc4; /*< ADC output 4.*/
  10. uint16_t adc5; /*< ADC output 5.*/
  11. uint16_t adc6; /*< ADC output 6.*/
  12. }) mavlink_ap_adc_t;
  13. #define MAVLINK_MSG_ID_AP_ADC_LEN 12
  14. #define MAVLINK_MSG_ID_AP_ADC_MIN_LEN 12
  15. #define MAVLINK_MSG_ID_153_LEN 12
  16. #define MAVLINK_MSG_ID_153_MIN_LEN 12
  17. #define MAVLINK_MSG_ID_AP_ADC_CRC 188
  18. #define MAVLINK_MSG_ID_153_CRC 188
  19. #if MAVLINK_COMMAND_24BIT
  20. #define MAVLINK_MESSAGE_INFO_AP_ADC { \
  21. 153, \
  22. "AP_ADC", \
  23. 6, \
  24. { { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \
  25. { "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \
  26. { "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \
  27. { "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \
  28. { "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \
  29. { "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \
  30. } \
  31. }
  32. #else
  33. #define MAVLINK_MESSAGE_INFO_AP_ADC { \
  34. "AP_ADC", \
  35. 6, \
  36. { { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \
  37. { "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \
  38. { "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \
  39. { "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \
  40. { "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \
  41. { "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \
  42. } \
  43. }
  44. #endif
  45. /**
  46. * @brief Pack a ap_adc message
  47. * @param system_id ID of this system
  48. * @param component_id ID of this component (e.g. 200 for IMU)
  49. * @param msg The MAVLink message to compress the data into
  50. *
  51. * @param adc1 ADC output 1.
  52. * @param adc2 ADC output 2.
  53. * @param adc3 ADC output 3.
  54. * @param adc4 ADC output 4.
  55. * @param adc5 ADC output 5.
  56. * @param adc6 ADC output 6.
  57. * @return length of the message in bytes (excluding serial stream start sign)
  58. */
  59. static inline uint16_t mavlink_msg_ap_adc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  60. uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6)
  61. {
  62. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  63. char buf[MAVLINK_MSG_ID_AP_ADC_LEN];
  64. _mav_put_uint16_t(buf, 0, adc1);
  65. _mav_put_uint16_t(buf, 2, adc2);
  66. _mav_put_uint16_t(buf, 4, adc3);
  67. _mav_put_uint16_t(buf, 6, adc4);
  68. _mav_put_uint16_t(buf, 8, adc5);
  69. _mav_put_uint16_t(buf, 10, adc6);
  70. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AP_ADC_LEN);
  71. #else
  72. mavlink_ap_adc_t packet;
  73. packet.adc1 = adc1;
  74. packet.adc2 = adc2;
  75. packet.adc3 = adc3;
  76. packet.adc4 = adc4;
  77. packet.adc5 = adc5;
  78. packet.adc6 = adc6;
  79. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AP_ADC_LEN);
  80. #endif
  81. msg->msgid = MAVLINK_MSG_ID_AP_ADC;
  82. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  83. }
  84. /**
  85. * @brief Pack a ap_adc message on a channel
  86. * @param system_id ID of this system
  87. * @param component_id ID of this component (e.g. 200 for IMU)
  88. * @param chan The MAVLink channel this message will be sent over
  89. * @param msg The MAVLink message to compress the data into
  90. * @param adc1 ADC output 1.
  91. * @param adc2 ADC output 2.
  92. * @param adc3 ADC output 3.
  93. * @param adc4 ADC output 4.
  94. * @param adc5 ADC output 5.
  95. * @param adc6 ADC output 6.
  96. * @return length of the message in bytes (excluding serial stream start sign)
  97. */
  98. static inline uint16_t mavlink_msg_ap_adc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  99. mavlink_message_t* msg,
  100. uint16_t adc1,uint16_t adc2,uint16_t adc3,uint16_t adc4,uint16_t adc5,uint16_t adc6)
  101. {
  102. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  103. char buf[MAVLINK_MSG_ID_AP_ADC_LEN];
  104. _mav_put_uint16_t(buf, 0, adc1);
  105. _mav_put_uint16_t(buf, 2, adc2);
  106. _mav_put_uint16_t(buf, 4, adc3);
  107. _mav_put_uint16_t(buf, 6, adc4);
  108. _mav_put_uint16_t(buf, 8, adc5);
  109. _mav_put_uint16_t(buf, 10, adc6);
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AP_ADC_LEN);
  111. #else
  112. mavlink_ap_adc_t packet;
  113. packet.adc1 = adc1;
  114. packet.adc2 = adc2;
  115. packet.adc3 = adc3;
  116. packet.adc4 = adc4;
  117. packet.adc5 = adc5;
  118. packet.adc6 = adc6;
  119. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AP_ADC_LEN);
  120. #endif
  121. msg->msgid = MAVLINK_MSG_ID_AP_ADC;
  122. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  123. }
  124. /**
  125. * @brief Encode a ap_adc struct
  126. *
  127. * @param system_id ID of this system
  128. * @param component_id ID of this component (e.g. 200 for IMU)
  129. * @param msg The MAVLink message to compress the data into
  130. * @param ap_adc C-struct to read the message contents from
  131. */
  132. static inline uint16_t mavlink_msg_ap_adc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc)
  133. {
  134. return mavlink_msg_ap_adc_pack(system_id, component_id, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6);
  135. }
  136. /**
  137. * @brief Encode a ap_adc struct on a channel
  138. *
  139. * @param system_id ID of this system
  140. * @param component_id ID of this component (e.g. 200 for IMU)
  141. * @param chan The MAVLink channel this message will be sent over
  142. * @param msg The MAVLink message to compress the data into
  143. * @param ap_adc C-struct to read the message contents from
  144. */
  145. static inline uint16_t mavlink_msg_ap_adc_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc)
  146. {
  147. return mavlink_msg_ap_adc_pack_chan(system_id, component_id, chan, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6);
  148. }
  149. /**
  150. * @brief Send a ap_adc message
  151. * @param chan MAVLink channel to send the message
  152. *
  153. * @param adc1 ADC output 1.
  154. * @param adc2 ADC output 2.
  155. * @param adc3 ADC output 3.
  156. * @param adc4 ADC output 4.
  157. * @param adc5 ADC output 5.
  158. * @param adc6 ADC output 6.
  159. */
  160. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  161. static inline void mavlink_msg_ap_adc_send(mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6)
  162. {
  163. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  164. char buf[MAVLINK_MSG_ID_AP_ADC_LEN];
  165. _mav_put_uint16_t(buf, 0, adc1);
  166. _mav_put_uint16_t(buf, 2, adc2);
  167. _mav_put_uint16_t(buf, 4, adc3);
  168. _mav_put_uint16_t(buf, 6, adc4);
  169. _mav_put_uint16_t(buf, 8, adc5);
  170. _mav_put_uint16_t(buf, 10, adc6);
  171. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  172. #else
  173. mavlink_ap_adc_t packet;
  174. packet.adc1 = adc1;
  175. packet.adc2 = adc2;
  176. packet.adc3 = adc3;
  177. packet.adc4 = adc4;
  178. packet.adc5 = adc5;
  179. packet.adc6 = adc6;
  180. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)&packet, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  181. #endif
  182. }
  183. /**
  184. * @brief Send a ap_adc message
  185. * @param chan MAVLink channel to send the message
  186. * @param struct The MAVLink struct to serialize
  187. */
  188. static inline void mavlink_msg_ap_adc_send_struct(mavlink_channel_t chan, const mavlink_ap_adc_t* ap_adc)
  189. {
  190. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  191. mavlink_msg_ap_adc_send(chan, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6);
  192. #else
  193. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)ap_adc, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  194. #endif
  195. }
  196. #if MAVLINK_MSG_ID_AP_ADC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  197. /*
  198. This varient of _send() can be used to save stack space by re-using
  199. memory from the receive buffer. The caller provides a
  200. mavlink_message_t which is the size of a full mavlink message. This
  201. is usually the receive buffer for the channel, and allows a reply to an
  202. incoming message with minimum stack space usage.
  203. */
  204. static inline void mavlink_msg_ap_adc_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6)
  205. {
  206. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  207. char *buf = (char *)msgbuf;
  208. _mav_put_uint16_t(buf, 0, adc1);
  209. _mav_put_uint16_t(buf, 2, adc2);
  210. _mav_put_uint16_t(buf, 4, adc3);
  211. _mav_put_uint16_t(buf, 6, adc4);
  212. _mav_put_uint16_t(buf, 8, adc5);
  213. _mav_put_uint16_t(buf, 10, adc6);
  214. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  215. #else
  216. mavlink_ap_adc_t *packet = (mavlink_ap_adc_t *)msgbuf;
  217. packet->adc1 = adc1;
  218. packet->adc2 = adc2;
  219. packet->adc3 = adc3;
  220. packet->adc4 = adc4;
  221. packet->adc5 = adc5;
  222. packet->adc6 = adc6;
  223. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)packet, MAVLINK_MSG_ID_AP_ADC_MIN_LEN, MAVLINK_MSG_ID_AP_ADC_LEN, MAVLINK_MSG_ID_AP_ADC_CRC);
  224. #endif
  225. }
  226. #endif
  227. #endif
  228. // MESSAGE AP_ADC UNPACKING
  229. /**
  230. * @brief Get field adc1 from ap_adc message
  231. *
  232. * @return ADC output 1.
  233. */
  234. static inline uint16_t mavlink_msg_ap_adc_get_adc1(const mavlink_message_t* msg)
  235. {
  236. return _MAV_RETURN_uint16_t(msg, 0);
  237. }
  238. /**
  239. * @brief Get field adc2 from ap_adc message
  240. *
  241. * @return ADC output 2.
  242. */
  243. static inline uint16_t mavlink_msg_ap_adc_get_adc2(const mavlink_message_t* msg)
  244. {
  245. return _MAV_RETURN_uint16_t(msg, 2);
  246. }
  247. /**
  248. * @brief Get field adc3 from ap_adc message
  249. *
  250. * @return ADC output 3.
  251. */
  252. static inline uint16_t mavlink_msg_ap_adc_get_adc3(const mavlink_message_t* msg)
  253. {
  254. return _MAV_RETURN_uint16_t(msg, 4);
  255. }
  256. /**
  257. * @brief Get field adc4 from ap_adc message
  258. *
  259. * @return ADC output 4.
  260. */
  261. static inline uint16_t mavlink_msg_ap_adc_get_adc4(const mavlink_message_t* msg)
  262. {
  263. return _MAV_RETURN_uint16_t(msg, 6);
  264. }
  265. /**
  266. * @brief Get field adc5 from ap_adc message
  267. *
  268. * @return ADC output 5.
  269. */
  270. static inline uint16_t mavlink_msg_ap_adc_get_adc5(const mavlink_message_t* msg)
  271. {
  272. return _MAV_RETURN_uint16_t(msg, 8);
  273. }
  274. /**
  275. * @brief Get field adc6 from ap_adc message
  276. *
  277. * @return ADC output 6.
  278. */
  279. static inline uint16_t mavlink_msg_ap_adc_get_adc6(const mavlink_message_t* msg)
  280. {
  281. return _MAV_RETURN_uint16_t(msg, 10);
  282. }
  283. /**
  284. * @brief Decode a ap_adc message into a struct
  285. *
  286. * @param msg The message to decode
  287. * @param ap_adc C-struct to decode the message contents into
  288. */
  289. static inline void mavlink_msg_ap_adc_decode(const mavlink_message_t* msg, mavlink_ap_adc_t* ap_adc)
  290. {
  291. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  292. ap_adc->adc1 = mavlink_msg_ap_adc_get_adc1(msg);
  293. ap_adc->adc2 = mavlink_msg_ap_adc_get_adc2(msg);
  294. ap_adc->adc3 = mavlink_msg_ap_adc_get_adc3(msg);
  295. ap_adc->adc4 = mavlink_msg_ap_adc_get_adc4(msg);
  296. ap_adc->adc5 = mavlink_msg_ap_adc_get_adc5(msg);
  297. ap_adc->adc6 = mavlink_msg_ap_adc_get_adc6(msg);
  298. #else
  299. uint8_t len = msg->len < MAVLINK_MSG_ID_AP_ADC_LEN? msg->len : MAVLINK_MSG_ID_AP_ADC_LEN;
  300. memset(ap_adc, 0, MAVLINK_MSG_ID_AP_ADC_LEN);
  301. memcpy(ap_adc, _MAV_PAYLOAD(msg), len);
  302. #endif
  303. }