2
0

mavlink_msg_scaled_imu3.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. #pragma once
  2. // MESSAGE SCALED_IMU3 PACKING
  3. #define MAVLINK_MSG_ID_SCALED_IMU3 129
  4. typedef struct __mavlink_scaled_imu3_t {
  5. uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
  6. int16_t xacc; /*< [mG] X acceleration*/
  7. int16_t yacc; /*< [mG] Y acceleration*/
  8. int16_t zacc; /*< [mG] Z acceleration*/
  9. int16_t xgyro; /*< [mrad/s] Angular speed around X axis*/
  10. int16_t ygyro; /*< [mrad/s] Angular speed around Y axis*/
  11. int16_t zgyro; /*< [mrad/s] Angular speed around Z axis*/
  12. int16_t xmag; /*< [mgauss] X Magnetic field*/
  13. int16_t ymag; /*< [mgauss] Y Magnetic field*/
  14. int16_t zmag; /*< [mgauss] Z Magnetic field*/
  15. int16_t temperature; /*< [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).*/
  16. } mavlink_scaled_imu3_t;
  17. #define MAVLINK_MSG_ID_SCALED_IMU3_LEN 24
  18. #define MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN 22
  19. #define MAVLINK_MSG_ID_129_LEN 24
  20. #define MAVLINK_MSG_ID_129_MIN_LEN 22
  21. #define MAVLINK_MSG_ID_SCALED_IMU3_CRC 46
  22. #define MAVLINK_MSG_ID_129_CRC 46
  23. #if MAVLINK_COMMAND_24BIT
  24. #define MAVLINK_MESSAGE_INFO_SCALED_IMU3 { \
  25. 129, \
  26. "SCALED_IMU3", \
  27. 11, \
  28. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu3_t, time_boot_ms) }, \
  29. { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu3_t, xacc) }, \
  30. { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu3_t, yacc) }, \
  31. { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu3_t, zacc) }, \
  32. { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu3_t, xgyro) }, \
  33. { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu3_t, ygyro) }, \
  34. { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu3_t, zgyro) }, \
  35. { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu3_t, xmag) }, \
  36. { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu3_t, ymag) }, \
  37. { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu3_t, zmag) }, \
  38. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_scaled_imu3_t, temperature) }, \
  39. } \
  40. }
  41. #else
  42. #define MAVLINK_MESSAGE_INFO_SCALED_IMU3 { \
  43. "SCALED_IMU3", \
  44. 11, \
  45. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu3_t, time_boot_ms) }, \
  46. { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu3_t, xacc) }, \
  47. { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu3_t, yacc) }, \
  48. { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu3_t, zacc) }, \
  49. { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu3_t, xgyro) }, \
  50. { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu3_t, ygyro) }, \
  51. { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu3_t, zgyro) }, \
  52. { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu3_t, xmag) }, \
  53. { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu3_t, ymag) }, \
  54. { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu3_t, zmag) }, \
  55. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_scaled_imu3_t, temperature) }, \
  56. } \
  57. }
  58. #endif
  59. /**
  60. * @brief Pack a scaled_imu3 message
  61. * @param system_id ID of this system
  62. * @param component_id ID of this component (e.g. 200 for IMU)
  63. * @param msg The MAVLink message to compress the data into
  64. *
  65. * @param time_boot_ms [ms] Timestamp (time since system boot).
  66. * @param xacc [mG] X acceleration
  67. * @param yacc [mG] Y acceleration
  68. * @param zacc [mG] Z acceleration
  69. * @param xgyro [mrad/s] Angular speed around X axis
  70. * @param ygyro [mrad/s] Angular speed around Y axis
  71. * @param zgyro [mrad/s] Angular speed around Z axis
  72. * @param xmag [mgauss] X Magnetic field
  73. * @param ymag [mgauss] Y Magnetic field
  74. * @param zmag [mgauss] Z Magnetic field
  75. * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
  76. * @return length of the message in bytes (excluding serial stream start sign)
  77. */
  78. static inline uint16_t mavlink_msg_scaled_imu3_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  79. uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature)
  80. {
  81. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  82. char buf[MAVLINK_MSG_ID_SCALED_IMU3_LEN];
  83. _mav_put_uint32_t(buf, 0, time_boot_ms);
  84. _mav_put_int16_t(buf, 4, xacc);
  85. _mav_put_int16_t(buf, 6, yacc);
  86. _mav_put_int16_t(buf, 8, zacc);
  87. _mav_put_int16_t(buf, 10, xgyro);
  88. _mav_put_int16_t(buf, 12, ygyro);
  89. _mav_put_int16_t(buf, 14, zgyro);
  90. _mav_put_int16_t(buf, 16, xmag);
  91. _mav_put_int16_t(buf, 18, ymag);
  92. _mav_put_int16_t(buf, 20, zmag);
  93. _mav_put_int16_t(buf, 22, temperature);
  94. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  95. #else
  96. mavlink_scaled_imu3_t packet;
  97. packet.time_boot_ms = time_boot_ms;
  98. packet.xacc = xacc;
  99. packet.yacc = yacc;
  100. packet.zacc = zacc;
  101. packet.xgyro = xgyro;
  102. packet.ygyro = ygyro;
  103. packet.zgyro = zgyro;
  104. packet.xmag = xmag;
  105. packet.ymag = ymag;
  106. packet.zmag = zmag;
  107. packet.temperature = temperature;
  108. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  109. #endif
  110. msg->msgid = MAVLINK_MSG_ID_SCALED_IMU3;
  111. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  112. }
  113. /**
  114. * @brief Pack a scaled_imu3 message
  115. * @param system_id ID of this system
  116. * @param component_id ID of this component (e.g. 200 for IMU)
  117. * @param status MAVLink status structure
  118. * @param msg The MAVLink message to compress the data into
  119. *
  120. * @param time_boot_ms [ms] Timestamp (time since system boot).
  121. * @param xacc [mG] X acceleration
  122. * @param yacc [mG] Y acceleration
  123. * @param zacc [mG] Z acceleration
  124. * @param xgyro [mrad/s] Angular speed around X axis
  125. * @param ygyro [mrad/s] Angular speed around Y axis
  126. * @param zgyro [mrad/s] Angular speed around Z axis
  127. * @param xmag [mgauss] X Magnetic field
  128. * @param ymag [mgauss] Y Magnetic field
  129. * @param zmag [mgauss] Z Magnetic field
  130. * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
  131. * @return length of the message in bytes (excluding serial stream start sign)
  132. */
  133. static inline uint16_t mavlink_msg_scaled_imu3_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  134. uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature)
  135. {
  136. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  137. char buf[MAVLINK_MSG_ID_SCALED_IMU3_LEN];
  138. _mav_put_uint32_t(buf, 0, time_boot_ms);
  139. _mav_put_int16_t(buf, 4, xacc);
  140. _mav_put_int16_t(buf, 6, yacc);
  141. _mav_put_int16_t(buf, 8, zacc);
  142. _mav_put_int16_t(buf, 10, xgyro);
  143. _mav_put_int16_t(buf, 12, ygyro);
  144. _mav_put_int16_t(buf, 14, zgyro);
  145. _mav_put_int16_t(buf, 16, xmag);
  146. _mav_put_int16_t(buf, 18, ymag);
  147. _mav_put_int16_t(buf, 20, zmag);
  148. _mav_put_int16_t(buf, 22, temperature);
  149. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  150. #else
  151. mavlink_scaled_imu3_t packet;
  152. packet.time_boot_ms = time_boot_ms;
  153. packet.xacc = xacc;
  154. packet.yacc = yacc;
  155. packet.zacc = zacc;
  156. packet.xgyro = xgyro;
  157. packet.ygyro = ygyro;
  158. packet.zgyro = zgyro;
  159. packet.xmag = xmag;
  160. packet.ymag = ymag;
  161. packet.zmag = zmag;
  162. packet.temperature = temperature;
  163. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  164. #endif
  165. msg->msgid = MAVLINK_MSG_ID_SCALED_IMU3;
  166. #if MAVLINK_CRC_EXTRA
  167. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  168. #else
  169. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  170. #endif
  171. }
  172. /**
  173. * @brief Pack a scaled_imu3 message on a channel
  174. * @param system_id ID of this system
  175. * @param component_id ID of this component (e.g. 200 for IMU)
  176. * @param chan The MAVLink channel this message will be sent over
  177. * @param msg The MAVLink message to compress the data into
  178. * @param time_boot_ms [ms] Timestamp (time since system boot).
  179. * @param xacc [mG] X acceleration
  180. * @param yacc [mG] Y acceleration
  181. * @param zacc [mG] Z acceleration
  182. * @param xgyro [mrad/s] Angular speed around X axis
  183. * @param ygyro [mrad/s] Angular speed around Y axis
  184. * @param zgyro [mrad/s] Angular speed around Z axis
  185. * @param xmag [mgauss] X Magnetic field
  186. * @param ymag [mgauss] Y Magnetic field
  187. * @param zmag [mgauss] Z Magnetic field
  188. * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
  189. * @return length of the message in bytes (excluding serial stream start sign)
  190. */
  191. static inline uint16_t mavlink_msg_scaled_imu3_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  192. mavlink_message_t* msg,
  193. uint32_t time_boot_ms,int16_t xacc,int16_t yacc,int16_t zacc,int16_t xgyro,int16_t ygyro,int16_t zgyro,int16_t xmag,int16_t ymag,int16_t zmag,int16_t temperature)
  194. {
  195. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  196. char buf[MAVLINK_MSG_ID_SCALED_IMU3_LEN];
  197. _mav_put_uint32_t(buf, 0, time_boot_ms);
  198. _mav_put_int16_t(buf, 4, xacc);
  199. _mav_put_int16_t(buf, 6, yacc);
  200. _mav_put_int16_t(buf, 8, zacc);
  201. _mav_put_int16_t(buf, 10, xgyro);
  202. _mav_put_int16_t(buf, 12, ygyro);
  203. _mav_put_int16_t(buf, 14, zgyro);
  204. _mav_put_int16_t(buf, 16, xmag);
  205. _mav_put_int16_t(buf, 18, ymag);
  206. _mav_put_int16_t(buf, 20, zmag);
  207. _mav_put_int16_t(buf, 22, temperature);
  208. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  209. #else
  210. mavlink_scaled_imu3_t packet;
  211. packet.time_boot_ms = time_boot_ms;
  212. packet.xacc = xacc;
  213. packet.yacc = yacc;
  214. packet.zacc = zacc;
  215. packet.xgyro = xgyro;
  216. packet.ygyro = ygyro;
  217. packet.zgyro = zgyro;
  218. packet.xmag = xmag;
  219. packet.ymag = ymag;
  220. packet.zmag = zmag;
  221. packet.temperature = temperature;
  222. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  223. #endif
  224. msg->msgid = MAVLINK_MSG_ID_SCALED_IMU3;
  225. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  226. }
  227. /**
  228. * @brief Encode a scaled_imu3 struct
  229. *
  230. * @param system_id ID of this system
  231. * @param component_id ID of this component (e.g. 200 for IMU)
  232. * @param msg The MAVLink message to compress the data into
  233. * @param scaled_imu3 C-struct to read the message contents from
  234. */
  235. static inline uint16_t mavlink_msg_scaled_imu3_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_imu3_t* scaled_imu3)
  236. {
  237. return mavlink_msg_scaled_imu3_pack(system_id, component_id, msg, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature);
  238. }
  239. /**
  240. * @brief Encode a scaled_imu3 struct on a channel
  241. *
  242. * @param system_id ID of this system
  243. * @param component_id ID of this component (e.g. 200 for IMU)
  244. * @param chan The MAVLink channel this message will be sent over
  245. * @param msg The MAVLink message to compress the data into
  246. * @param scaled_imu3 C-struct to read the message contents from
  247. */
  248. static inline uint16_t mavlink_msg_scaled_imu3_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_imu3_t* scaled_imu3)
  249. {
  250. return mavlink_msg_scaled_imu3_pack_chan(system_id, component_id, chan, msg, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature);
  251. }
  252. /**
  253. * @brief Encode a scaled_imu3 struct with provided status structure
  254. *
  255. * @param system_id ID of this system
  256. * @param component_id ID of this component (e.g. 200 for IMU)
  257. * @param status MAVLink status structure
  258. * @param msg The MAVLink message to compress the data into
  259. * @param scaled_imu3 C-struct to read the message contents from
  260. */
  261. static inline uint16_t mavlink_msg_scaled_imu3_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_imu3_t* scaled_imu3)
  262. {
  263. return mavlink_msg_scaled_imu3_pack_status(system_id, component_id, _status, msg, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature);
  264. }
  265. /**
  266. * @brief Send a scaled_imu3 message
  267. * @param chan MAVLink channel to send the message
  268. *
  269. * @param time_boot_ms [ms] Timestamp (time since system boot).
  270. * @param xacc [mG] X acceleration
  271. * @param yacc [mG] Y acceleration
  272. * @param zacc [mG] Z acceleration
  273. * @param xgyro [mrad/s] Angular speed around X axis
  274. * @param ygyro [mrad/s] Angular speed around Y axis
  275. * @param zgyro [mrad/s] Angular speed around Z axis
  276. * @param xmag [mgauss] X Magnetic field
  277. * @param ymag [mgauss] Y Magnetic field
  278. * @param zmag [mgauss] Z Magnetic field
  279. * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
  280. */
  281. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  282. static inline void mavlink_msg_scaled_imu3_send(mavlink_channel_t chan, uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature)
  283. {
  284. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  285. char buf[MAVLINK_MSG_ID_SCALED_IMU3_LEN];
  286. _mav_put_uint32_t(buf, 0, time_boot_ms);
  287. _mav_put_int16_t(buf, 4, xacc);
  288. _mav_put_int16_t(buf, 6, yacc);
  289. _mav_put_int16_t(buf, 8, zacc);
  290. _mav_put_int16_t(buf, 10, xgyro);
  291. _mav_put_int16_t(buf, 12, ygyro);
  292. _mav_put_int16_t(buf, 14, zgyro);
  293. _mav_put_int16_t(buf, 16, xmag);
  294. _mav_put_int16_t(buf, 18, ymag);
  295. _mav_put_int16_t(buf, 20, zmag);
  296. _mav_put_int16_t(buf, 22, temperature);
  297. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU3, buf, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  298. #else
  299. mavlink_scaled_imu3_t packet;
  300. packet.time_boot_ms = time_boot_ms;
  301. packet.xacc = xacc;
  302. packet.yacc = yacc;
  303. packet.zacc = zacc;
  304. packet.xgyro = xgyro;
  305. packet.ygyro = ygyro;
  306. packet.zgyro = zgyro;
  307. packet.xmag = xmag;
  308. packet.ymag = ymag;
  309. packet.zmag = zmag;
  310. packet.temperature = temperature;
  311. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU3, (const char *)&packet, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  312. #endif
  313. }
  314. /**
  315. * @brief Send a scaled_imu3 message
  316. * @param chan MAVLink channel to send the message
  317. * @param struct The MAVLink struct to serialize
  318. */
  319. static inline void mavlink_msg_scaled_imu3_send_struct(mavlink_channel_t chan, const mavlink_scaled_imu3_t* scaled_imu3)
  320. {
  321. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  322. mavlink_msg_scaled_imu3_send(chan, scaled_imu3->time_boot_ms, scaled_imu3->xacc, scaled_imu3->yacc, scaled_imu3->zacc, scaled_imu3->xgyro, scaled_imu3->ygyro, scaled_imu3->zgyro, scaled_imu3->xmag, scaled_imu3->ymag, scaled_imu3->zmag, scaled_imu3->temperature);
  323. #else
  324. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU3, (const char *)scaled_imu3, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  325. #endif
  326. }
  327. #if MAVLINK_MSG_ID_SCALED_IMU3_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  328. /*
  329. This variant of _send() can be used to save stack space by re-using
  330. memory from the receive buffer. The caller provides a
  331. mavlink_message_t which is the size of a full mavlink message. This
  332. is usually the receive buffer for the channel, and allows a reply to an
  333. incoming message with minimum stack space usage.
  334. */
  335. static inline void mavlink_msg_scaled_imu3_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int16_t xacc, int16_t yacc, int16_t zacc, int16_t xgyro, int16_t ygyro, int16_t zgyro, int16_t xmag, int16_t ymag, int16_t zmag, int16_t temperature)
  336. {
  337. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  338. char *buf = (char *)msgbuf;
  339. _mav_put_uint32_t(buf, 0, time_boot_ms);
  340. _mav_put_int16_t(buf, 4, xacc);
  341. _mav_put_int16_t(buf, 6, yacc);
  342. _mav_put_int16_t(buf, 8, zacc);
  343. _mav_put_int16_t(buf, 10, xgyro);
  344. _mav_put_int16_t(buf, 12, ygyro);
  345. _mav_put_int16_t(buf, 14, zgyro);
  346. _mav_put_int16_t(buf, 16, xmag);
  347. _mav_put_int16_t(buf, 18, ymag);
  348. _mav_put_int16_t(buf, 20, zmag);
  349. _mav_put_int16_t(buf, 22, temperature);
  350. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU3, buf, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  351. #else
  352. mavlink_scaled_imu3_t *packet = (mavlink_scaled_imu3_t *)msgbuf;
  353. packet->time_boot_ms = time_boot_ms;
  354. packet->xacc = xacc;
  355. packet->yacc = yacc;
  356. packet->zacc = zacc;
  357. packet->xgyro = xgyro;
  358. packet->ygyro = ygyro;
  359. packet->zgyro = zgyro;
  360. packet->xmag = xmag;
  361. packet->ymag = ymag;
  362. packet->zmag = zmag;
  363. packet->temperature = temperature;
  364. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU3, (const char *)packet, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU3_LEN, MAVLINK_MSG_ID_SCALED_IMU3_CRC);
  365. #endif
  366. }
  367. #endif
  368. #endif
  369. // MESSAGE SCALED_IMU3 UNPACKING
  370. /**
  371. * @brief Get field time_boot_ms from scaled_imu3 message
  372. *
  373. * @return [ms] Timestamp (time since system boot).
  374. */
  375. static inline uint32_t mavlink_msg_scaled_imu3_get_time_boot_ms(const mavlink_message_t* msg)
  376. {
  377. return _MAV_RETURN_uint32_t(msg, 0);
  378. }
  379. /**
  380. * @brief Get field xacc from scaled_imu3 message
  381. *
  382. * @return [mG] X acceleration
  383. */
  384. static inline int16_t mavlink_msg_scaled_imu3_get_xacc(const mavlink_message_t* msg)
  385. {
  386. return _MAV_RETURN_int16_t(msg, 4);
  387. }
  388. /**
  389. * @brief Get field yacc from scaled_imu3 message
  390. *
  391. * @return [mG] Y acceleration
  392. */
  393. static inline int16_t mavlink_msg_scaled_imu3_get_yacc(const mavlink_message_t* msg)
  394. {
  395. return _MAV_RETURN_int16_t(msg, 6);
  396. }
  397. /**
  398. * @brief Get field zacc from scaled_imu3 message
  399. *
  400. * @return [mG] Z acceleration
  401. */
  402. static inline int16_t mavlink_msg_scaled_imu3_get_zacc(const mavlink_message_t* msg)
  403. {
  404. return _MAV_RETURN_int16_t(msg, 8);
  405. }
  406. /**
  407. * @brief Get field xgyro from scaled_imu3 message
  408. *
  409. * @return [mrad/s] Angular speed around X axis
  410. */
  411. static inline int16_t mavlink_msg_scaled_imu3_get_xgyro(const mavlink_message_t* msg)
  412. {
  413. return _MAV_RETURN_int16_t(msg, 10);
  414. }
  415. /**
  416. * @brief Get field ygyro from scaled_imu3 message
  417. *
  418. * @return [mrad/s] Angular speed around Y axis
  419. */
  420. static inline int16_t mavlink_msg_scaled_imu3_get_ygyro(const mavlink_message_t* msg)
  421. {
  422. return _MAV_RETURN_int16_t(msg, 12);
  423. }
  424. /**
  425. * @brief Get field zgyro from scaled_imu3 message
  426. *
  427. * @return [mrad/s] Angular speed around Z axis
  428. */
  429. static inline int16_t mavlink_msg_scaled_imu3_get_zgyro(const mavlink_message_t* msg)
  430. {
  431. return _MAV_RETURN_int16_t(msg, 14);
  432. }
  433. /**
  434. * @brief Get field xmag from scaled_imu3 message
  435. *
  436. * @return [mgauss] X Magnetic field
  437. */
  438. static inline int16_t mavlink_msg_scaled_imu3_get_xmag(const mavlink_message_t* msg)
  439. {
  440. return _MAV_RETURN_int16_t(msg, 16);
  441. }
  442. /**
  443. * @brief Get field ymag from scaled_imu3 message
  444. *
  445. * @return [mgauss] Y Magnetic field
  446. */
  447. static inline int16_t mavlink_msg_scaled_imu3_get_ymag(const mavlink_message_t* msg)
  448. {
  449. return _MAV_RETURN_int16_t(msg, 18);
  450. }
  451. /**
  452. * @brief Get field zmag from scaled_imu3 message
  453. *
  454. * @return [mgauss] Z Magnetic field
  455. */
  456. static inline int16_t mavlink_msg_scaled_imu3_get_zmag(const mavlink_message_t* msg)
  457. {
  458. return _MAV_RETURN_int16_t(msg, 20);
  459. }
  460. /**
  461. * @brief Get field temperature from scaled_imu3 message
  462. *
  463. * @return [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
  464. */
  465. static inline int16_t mavlink_msg_scaled_imu3_get_temperature(const mavlink_message_t* msg)
  466. {
  467. return _MAV_RETURN_int16_t(msg, 22);
  468. }
  469. /**
  470. * @brief Decode a scaled_imu3 message into a struct
  471. *
  472. * @param msg The message to decode
  473. * @param scaled_imu3 C-struct to decode the message contents into
  474. */
  475. static inline void mavlink_msg_scaled_imu3_decode(const mavlink_message_t* msg, mavlink_scaled_imu3_t* scaled_imu3)
  476. {
  477. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  478. scaled_imu3->time_boot_ms = mavlink_msg_scaled_imu3_get_time_boot_ms(msg);
  479. scaled_imu3->xacc = mavlink_msg_scaled_imu3_get_xacc(msg);
  480. scaled_imu3->yacc = mavlink_msg_scaled_imu3_get_yacc(msg);
  481. scaled_imu3->zacc = mavlink_msg_scaled_imu3_get_zacc(msg);
  482. scaled_imu3->xgyro = mavlink_msg_scaled_imu3_get_xgyro(msg);
  483. scaled_imu3->ygyro = mavlink_msg_scaled_imu3_get_ygyro(msg);
  484. scaled_imu3->zgyro = mavlink_msg_scaled_imu3_get_zgyro(msg);
  485. scaled_imu3->xmag = mavlink_msg_scaled_imu3_get_xmag(msg);
  486. scaled_imu3->ymag = mavlink_msg_scaled_imu3_get_ymag(msg);
  487. scaled_imu3->zmag = mavlink_msg_scaled_imu3_get_zmag(msg);
  488. scaled_imu3->temperature = mavlink_msg_scaled_imu3_get_temperature(msg);
  489. #else
  490. uint8_t len = msg->len < MAVLINK_MSG_ID_SCALED_IMU3_LEN? msg->len : MAVLINK_MSG_ID_SCALED_IMU3_LEN;
  491. memset(scaled_imu3, 0, MAVLINK_MSG_ID_SCALED_IMU3_LEN);
  492. memcpy(scaled_imu3, _MAV_PAYLOAD(msg), len);
  493. #endif
  494. }