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.

313 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE RAW_PRESSURE PACKING
  3. #define MAVLINK_MSG_ID_RAW_PRESSURE 28
  4. MAVPACKED(
  5. typedef struct __mavlink_raw_pressure_t {
  6. uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.*/
  7. int16_t press_abs; /*< Absolute pressure (raw)*/
  8. int16_t press_diff1; /*< Differential pressure 1 (raw, 0 if nonexistent)*/
  9. int16_t press_diff2; /*< Differential pressure 2 (raw, 0 if nonexistent)*/
  10. int16_t temperature; /*< Raw Temperature measurement (raw)*/
  11. }) mavlink_raw_pressure_t;
  12. #define MAVLINK_MSG_ID_RAW_PRESSURE_LEN 16
  13. #define MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN 16
  14. #define MAVLINK_MSG_ID_28_LEN 16
  15. #define MAVLINK_MSG_ID_28_MIN_LEN 16
  16. #define MAVLINK_MSG_ID_RAW_PRESSURE_CRC 67
  17. #define MAVLINK_MSG_ID_28_CRC 67
  18. #if MAVLINK_COMMAND_24BIT
  19. #define MAVLINK_MESSAGE_INFO_RAW_PRESSURE { \
  20. 28, \
  21. "RAW_PRESSURE", \
  22. 5, \
  23. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_raw_pressure_t, time_usec) }, \
  24. { "press_abs", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_raw_pressure_t, press_abs) }, \
  25. { "press_diff1", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_raw_pressure_t, press_diff1) }, \
  26. { "press_diff2", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_raw_pressure_t, press_diff2) }, \
  27. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_raw_pressure_t, temperature) }, \
  28. } \
  29. }
  30. #else
  31. #define MAVLINK_MESSAGE_INFO_RAW_PRESSURE { \
  32. "RAW_PRESSURE", \
  33. 5, \
  34. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_raw_pressure_t, time_usec) }, \
  35. { "press_abs", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_raw_pressure_t, press_abs) }, \
  36. { "press_diff1", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_raw_pressure_t, press_diff1) }, \
  37. { "press_diff2", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_raw_pressure_t, press_diff2) }, \
  38. { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_raw_pressure_t, temperature) }, \
  39. } \
  40. }
  41. #endif
  42. /**
  43. * @brief Pack a raw_pressure message
  44. * @param system_id ID of this system
  45. * @param component_id ID of this component (e.g. 200 for IMU)
  46. * @param msg The MAVLink message to compress the data into
  47. *
  48. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  49. * @param press_abs Absolute pressure (raw)
  50. * @param press_diff1 Differential pressure 1 (raw, 0 if nonexistent)
  51. * @param press_diff2 Differential pressure 2 (raw, 0 if nonexistent)
  52. * @param temperature Raw Temperature measurement (raw)
  53. * @return length of the message in bytes (excluding serial stream start sign)
  54. */
  55. static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  56. uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
  57. {
  58. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  59. char buf[MAVLINK_MSG_ID_RAW_PRESSURE_LEN];
  60. _mav_put_uint64_t(buf, 0, time_usec);
  61. _mav_put_int16_t(buf, 8, press_abs);
  62. _mav_put_int16_t(buf, 10, press_diff1);
  63. _mav_put_int16_t(buf, 12, press_diff2);
  64. _mav_put_int16_t(buf, 14, temperature);
  65. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_PRESSURE_LEN);
  66. #else
  67. mavlink_raw_pressure_t packet;
  68. packet.time_usec = time_usec;
  69. packet.press_abs = press_abs;
  70. packet.press_diff1 = press_diff1;
  71. packet.press_diff2 = press_diff2;
  72. packet.temperature = temperature;
  73. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RAW_PRESSURE_LEN);
  74. #endif
  75. msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
  76. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  77. }
  78. /**
  79. * @brief Pack a raw_pressure message on a channel
  80. * @param system_id ID of this system
  81. * @param component_id ID of this component (e.g. 200 for IMU)
  82. * @param chan The MAVLink channel this message will be sent over
  83. * @param msg The MAVLink message to compress the data into
  84. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  85. * @param press_abs Absolute pressure (raw)
  86. * @param press_diff1 Differential pressure 1 (raw, 0 if nonexistent)
  87. * @param press_diff2 Differential pressure 2 (raw, 0 if nonexistent)
  88. * @param temperature Raw Temperature measurement (raw)
  89. * @return length of the message in bytes (excluding serial stream start sign)
  90. */
  91. static inline uint16_t mavlink_msg_raw_pressure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  92. mavlink_message_t* msg,
  93. uint64_t time_usec,int16_t press_abs,int16_t press_diff1,int16_t press_diff2,int16_t temperature)
  94. {
  95. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  96. char buf[MAVLINK_MSG_ID_RAW_PRESSURE_LEN];
  97. _mav_put_uint64_t(buf, 0, time_usec);
  98. _mav_put_int16_t(buf, 8, press_abs);
  99. _mav_put_int16_t(buf, 10, press_diff1);
  100. _mav_put_int16_t(buf, 12, press_diff2);
  101. _mav_put_int16_t(buf, 14, temperature);
  102. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_PRESSURE_LEN);
  103. #else
  104. mavlink_raw_pressure_t packet;
  105. packet.time_usec = time_usec;
  106. packet.press_abs = press_abs;
  107. packet.press_diff1 = press_diff1;
  108. packet.press_diff2 = press_diff2;
  109. packet.temperature = temperature;
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RAW_PRESSURE_LEN);
  111. #endif
  112. msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
  113. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  114. }
  115. /**
  116. * @brief Encode a raw_pressure struct
  117. *
  118. * @param system_id ID of this system
  119. * @param component_id ID of this component (e.g. 200 for IMU)
  120. * @param msg The MAVLink message to compress the data into
  121. * @param raw_pressure C-struct to read the message contents from
  122. */
  123. static inline uint16_t mavlink_msg_raw_pressure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_raw_pressure_t* raw_pressure)
  124. {
  125. return mavlink_msg_raw_pressure_pack(system_id, component_id, msg, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature);
  126. }
  127. /**
  128. * @brief Encode a raw_pressure struct on a channel
  129. *
  130. * @param system_id ID of this system
  131. * @param component_id ID of this component (e.g. 200 for IMU)
  132. * @param chan The MAVLink channel this message will be sent over
  133. * @param msg The MAVLink message to compress the data into
  134. * @param raw_pressure C-struct to read the message contents from
  135. */
  136. static inline uint16_t mavlink_msg_raw_pressure_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_raw_pressure_t* raw_pressure)
  137. {
  138. return mavlink_msg_raw_pressure_pack_chan(system_id, component_id, chan, msg, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature);
  139. }
  140. /**
  141. * @brief Send a raw_pressure message
  142. * @param chan MAVLink channel to send the message
  143. *
  144. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  145. * @param press_abs Absolute pressure (raw)
  146. * @param press_diff1 Differential pressure 1 (raw, 0 if nonexistent)
  147. * @param press_diff2 Differential pressure 2 (raw, 0 if nonexistent)
  148. * @param temperature Raw Temperature measurement (raw)
  149. */
  150. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  151. static inline void mavlink_msg_raw_pressure_send(mavlink_channel_t chan, uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
  152. {
  153. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  154. char buf[MAVLINK_MSG_ID_RAW_PRESSURE_LEN];
  155. _mav_put_uint64_t(buf, 0, time_usec);
  156. _mav_put_int16_t(buf, 8, press_abs);
  157. _mav_put_int16_t(buf, 10, press_diff1);
  158. _mav_put_int16_t(buf, 12, press_diff2);
  159. _mav_put_int16_t(buf, 14, temperature);
  160. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, buf, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  161. #else
  162. mavlink_raw_pressure_t packet;
  163. packet.time_usec = time_usec;
  164. packet.press_abs = press_abs;
  165. packet.press_diff1 = press_diff1;
  166. packet.press_diff2 = press_diff2;
  167. packet.temperature = temperature;
  168. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, (const char *)&packet, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  169. #endif
  170. }
  171. /**
  172. * @brief Send a raw_pressure message
  173. * @param chan MAVLink channel to send the message
  174. * @param struct The MAVLink struct to serialize
  175. */
  176. static inline void mavlink_msg_raw_pressure_send_struct(mavlink_channel_t chan, const mavlink_raw_pressure_t* raw_pressure)
  177. {
  178. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  179. mavlink_msg_raw_pressure_send(chan, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature);
  180. #else
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, (const char *)raw_pressure, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  182. #endif
  183. }
  184. #if MAVLINK_MSG_ID_RAW_PRESSURE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  185. /*
  186. This varient of _send() can be used to save stack space by re-using
  187. memory from the receive buffer. The caller provides a
  188. mavlink_message_t which is the size of a full mavlink message. This
  189. is usually the receive buffer for the channel, and allows a reply to an
  190. incoming message with minimum stack space usage.
  191. */
  192. static inline void mavlink_msg_raw_pressure_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
  193. {
  194. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  195. char *buf = (char *)msgbuf;
  196. _mav_put_uint64_t(buf, 0, time_usec);
  197. _mav_put_int16_t(buf, 8, press_abs);
  198. _mav_put_int16_t(buf, 10, press_diff1);
  199. _mav_put_int16_t(buf, 12, press_diff2);
  200. _mav_put_int16_t(buf, 14, temperature);
  201. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, buf, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  202. #else
  203. mavlink_raw_pressure_t *packet = (mavlink_raw_pressure_t *)msgbuf;
  204. packet->time_usec = time_usec;
  205. packet->press_abs = press_abs;
  206. packet->press_diff1 = press_diff1;
  207. packet->press_diff2 = press_diff2;
  208. packet->temperature = temperature;
  209. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, (const char *)packet, MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_LEN, MAVLINK_MSG_ID_RAW_PRESSURE_CRC);
  210. #endif
  211. }
  212. #endif
  213. #endif
  214. // MESSAGE RAW_PRESSURE UNPACKING
  215. /**
  216. * @brief Get field time_usec from raw_pressure message
  217. *
  218. * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  219. */
  220. static inline uint64_t mavlink_msg_raw_pressure_get_time_usec(const mavlink_message_t* msg)
  221. {
  222. return _MAV_RETURN_uint64_t(msg, 0);
  223. }
  224. /**
  225. * @brief Get field press_abs from raw_pressure message
  226. *
  227. * @return Absolute pressure (raw)
  228. */
  229. static inline int16_t mavlink_msg_raw_pressure_get_press_abs(const mavlink_message_t* msg)
  230. {
  231. return _MAV_RETURN_int16_t(msg, 8);
  232. }
  233. /**
  234. * @brief Get field press_diff1 from raw_pressure message
  235. *
  236. * @return Differential pressure 1 (raw, 0 if nonexistent)
  237. */
  238. static inline int16_t mavlink_msg_raw_pressure_get_press_diff1(const mavlink_message_t* msg)
  239. {
  240. return _MAV_RETURN_int16_t(msg, 10);
  241. }
  242. /**
  243. * @brief Get field press_diff2 from raw_pressure message
  244. *
  245. * @return Differential pressure 2 (raw, 0 if nonexistent)
  246. */
  247. static inline int16_t mavlink_msg_raw_pressure_get_press_diff2(const mavlink_message_t* msg)
  248. {
  249. return _MAV_RETURN_int16_t(msg, 12);
  250. }
  251. /**
  252. * @brief Get field temperature from raw_pressure message
  253. *
  254. * @return Raw Temperature measurement (raw)
  255. */
  256. static inline int16_t mavlink_msg_raw_pressure_get_temperature(const mavlink_message_t* msg)
  257. {
  258. return _MAV_RETURN_int16_t(msg, 14);
  259. }
  260. /**
  261. * @brief Decode a raw_pressure message into a struct
  262. *
  263. * @param msg The message to decode
  264. * @param raw_pressure C-struct to decode the message contents into
  265. */
  266. static inline void mavlink_msg_raw_pressure_decode(const mavlink_message_t* msg, mavlink_raw_pressure_t* raw_pressure)
  267. {
  268. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  269. raw_pressure->time_usec = mavlink_msg_raw_pressure_get_time_usec(msg);
  270. raw_pressure->press_abs = mavlink_msg_raw_pressure_get_press_abs(msg);
  271. raw_pressure->press_diff1 = mavlink_msg_raw_pressure_get_press_diff1(msg);
  272. raw_pressure->press_diff2 = mavlink_msg_raw_pressure_get_press_diff2(msg);
  273. raw_pressure->temperature = mavlink_msg_raw_pressure_get_temperature(msg);
  274. #else
  275. uint8_t len = msg->len < MAVLINK_MSG_ID_RAW_PRESSURE_LEN? msg->len : MAVLINK_MSG_ID_RAW_PRESSURE_LEN;
  276. memset(raw_pressure, 0, MAVLINK_MSG_ID_RAW_PRESSURE_LEN);
  277. memcpy(raw_pressure, _MAV_PAYLOAD(msg), len);
  278. #endif
  279. }