Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_hil_sensor.h
blob8672f8b8a3b95e4606a80e6d95f6dbae072cebd3
1 // MESSAGE HIL_SENSOR PACKING
3 #define MAVLINK_MSG_ID_HIL_SENSOR 107
5 typedef struct __mavlink_hil_sensor_t
7 uint64_t time_usec; ///< Timestamp (microseconds, synced to UNIX time or since system boot)
8 float xacc; ///< X acceleration (m/s^2)
9 float yacc; ///< Y acceleration (m/s^2)
10 float zacc; ///< Z acceleration (m/s^2)
11 float xgyro; ///< Angular speed around X axis in body frame (rad / sec)
12 float ygyro; ///< Angular speed around Y axis in body frame (rad / sec)
13 float zgyro; ///< Angular speed around Z axis in body frame (rad / sec)
14 float xmag; ///< X Magnetic field (Gauss)
15 float ymag; ///< Y Magnetic field (Gauss)
16 float zmag; ///< Z Magnetic field (Gauss)
17 float abs_pressure; ///< Absolute pressure in millibar
18 float diff_pressure; ///< Differential pressure (airspeed) in millibar
19 float pressure_alt; ///< Altitude calculated from pressure
20 float temperature; ///< Temperature in degrees celsius
21 uint32_t fields_updated; ///< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
22 } mavlink_hil_sensor_t;
24 #define MAVLINK_MSG_ID_HIL_SENSOR_LEN 64
25 #define MAVLINK_MSG_ID_107_LEN 64
27 #define MAVLINK_MSG_ID_HIL_SENSOR_CRC 108
28 #define MAVLINK_MSG_ID_107_CRC 108
32 #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \
33 "HIL_SENSOR", \
34 15, \
35 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \
36 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \
37 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \
38 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \
39 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \
40 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \
41 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \
42 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \
43 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \
44 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \
45 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \
46 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \
47 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \
48 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \
49 { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \
50 } \
54 /**
55 * @brief Pack a hil_sensor message
56 * @param system_id ID of this system
57 * @param component_id ID of this component (e.g. 200 for IMU)
58 * @param msg The MAVLink message to compress the data into
60 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
61 * @param xacc X acceleration (m/s^2)
62 * @param yacc Y acceleration (m/s^2)
63 * @param zacc Z acceleration (m/s^2)
64 * @param xgyro Angular speed around X axis in body frame (rad / sec)
65 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
66 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
67 * @param xmag X Magnetic field (Gauss)
68 * @param ymag Y Magnetic field (Gauss)
69 * @param zmag Z Magnetic field (Gauss)
70 * @param abs_pressure Absolute pressure in millibar
71 * @param diff_pressure Differential pressure (airspeed) in millibar
72 * @param pressure_alt Altitude calculated from pressure
73 * @param temperature Temperature in degrees celsius
74 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
78 uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated)
80 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
81 char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
82 _mav_put_uint64_t(buf, 0, time_usec);
83 _mav_put_float(buf, 8, xacc);
84 _mav_put_float(buf, 12, yacc);
85 _mav_put_float(buf, 16, zacc);
86 _mav_put_float(buf, 20, xgyro);
87 _mav_put_float(buf, 24, ygyro);
88 _mav_put_float(buf, 28, zgyro);
89 _mav_put_float(buf, 32, xmag);
90 _mav_put_float(buf, 36, ymag);
91 _mav_put_float(buf, 40, zmag);
92 _mav_put_float(buf, 44, abs_pressure);
93 _mav_put_float(buf, 48, diff_pressure);
94 _mav_put_float(buf, 52, pressure_alt);
95 _mav_put_float(buf, 56, temperature);
96 _mav_put_uint32_t(buf, 60, fields_updated);
98 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
99 #else
100 mavlink_hil_sensor_t packet;
101 packet.time_usec = time_usec;
102 packet.xacc = xacc;
103 packet.yacc = yacc;
104 packet.zacc = zacc;
105 packet.xgyro = xgyro;
106 packet.ygyro = ygyro;
107 packet.zgyro = zgyro;
108 packet.xmag = xmag;
109 packet.ymag = ymag;
110 packet.zmag = zmag;
111 packet.abs_pressure = abs_pressure;
112 packet.diff_pressure = diff_pressure;
113 packet.pressure_alt = pressure_alt;
114 packet.temperature = temperature;
115 packet.fields_updated = fields_updated;
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
118 #endif
120 msg->msgid = MAVLINK_MSG_ID_HIL_SENSOR;
121 #if MAVLINK_CRC_EXTRA
122 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
123 #else
124 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
125 #endif
129 * @brief Pack a hil_sensor message on a channel
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 time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
135 * @param xacc X acceleration (m/s^2)
136 * @param yacc Y acceleration (m/s^2)
137 * @param zacc Z acceleration (m/s^2)
138 * @param xgyro Angular speed around X axis in body frame (rad / sec)
139 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
140 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
141 * @param xmag X Magnetic field (Gauss)
142 * @param ymag Y Magnetic field (Gauss)
143 * @param zmag Z Magnetic field (Gauss)
144 * @param abs_pressure Absolute pressure in millibar
145 * @param diff_pressure Differential pressure (airspeed) in millibar
146 * @param pressure_alt Altitude calculated from pressure
147 * @param temperature Temperature in degrees celsius
148 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
149 * @return length of the message in bytes (excluding serial stream start sign)
151 static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
152 mavlink_message_t* msg,
153 uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint32_t fields_updated)
155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
157 _mav_put_uint64_t(buf, 0, time_usec);
158 _mav_put_float(buf, 8, xacc);
159 _mav_put_float(buf, 12, yacc);
160 _mav_put_float(buf, 16, zacc);
161 _mav_put_float(buf, 20, xgyro);
162 _mav_put_float(buf, 24, ygyro);
163 _mav_put_float(buf, 28, zgyro);
164 _mav_put_float(buf, 32, xmag);
165 _mav_put_float(buf, 36, ymag);
166 _mav_put_float(buf, 40, zmag);
167 _mav_put_float(buf, 44, abs_pressure);
168 _mav_put_float(buf, 48, diff_pressure);
169 _mav_put_float(buf, 52, pressure_alt);
170 _mav_put_float(buf, 56, temperature);
171 _mav_put_uint32_t(buf, 60, fields_updated);
173 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
174 #else
175 mavlink_hil_sensor_t packet;
176 packet.time_usec = time_usec;
177 packet.xacc = xacc;
178 packet.yacc = yacc;
179 packet.zacc = zacc;
180 packet.xgyro = xgyro;
181 packet.ygyro = ygyro;
182 packet.zgyro = zgyro;
183 packet.xmag = xmag;
184 packet.ymag = ymag;
185 packet.zmag = zmag;
186 packet.abs_pressure = abs_pressure;
187 packet.diff_pressure = diff_pressure;
188 packet.pressure_alt = pressure_alt;
189 packet.temperature = temperature;
190 packet.fields_updated = fields_updated;
192 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
193 #endif
195 msg->msgid = MAVLINK_MSG_ID_HIL_SENSOR;
196 #if MAVLINK_CRC_EXTRA
197 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
198 #else
199 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
200 #endif
204 * @brief Encode a hil_sensor struct
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param msg The MAVLink message to compress the data into
209 * @param hil_sensor C-struct to read the message contents from
211 static inline uint16_t mavlink_msg_hil_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_sensor_t* hil_sensor)
213 return mavlink_msg_hil_sensor_pack(system_id, component_id, msg, hil_sensor->time_usec, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->temperature, hil_sensor->fields_updated);
217 * @brief Encode a hil_sensor struct on a channel
219 * @param system_id ID of this system
220 * @param component_id ID of this component (e.g. 200 for IMU)
221 * @param chan The MAVLink channel this message will be sent over
222 * @param msg The MAVLink message to compress the data into
223 * @param hil_sensor C-struct to read the message contents from
225 static inline uint16_t mavlink_msg_hil_sensor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_sensor_t* hil_sensor)
227 return mavlink_msg_hil_sensor_pack_chan(system_id, component_id, chan, msg, hil_sensor->time_usec, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->temperature, hil_sensor->fields_updated);
231 * @brief Send a hil_sensor message
232 * @param chan MAVLink channel to send the message
234 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
235 * @param xacc X acceleration (m/s^2)
236 * @param yacc Y acceleration (m/s^2)
237 * @param zacc Z acceleration (m/s^2)
238 * @param xgyro Angular speed around X axis in body frame (rad / sec)
239 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
240 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
241 * @param xmag X Magnetic field (Gauss)
242 * @param ymag Y Magnetic field (Gauss)
243 * @param zmag Z Magnetic field (Gauss)
244 * @param abs_pressure Absolute pressure in millibar
245 * @param diff_pressure Differential pressure (airspeed) in millibar
246 * @param pressure_alt Altitude calculated from pressure
247 * @param temperature Temperature in degrees celsius
248 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
250 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
252 static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated)
254 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
255 char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
256 _mav_put_uint64_t(buf, 0, time_usec);
257 _mav_put_float(buf, 8, xacc);
258 _mav_put_float(buf, 12, yacc);
259 _mav_put_float(buf, 16, zacc);
260 _mav_put_float(buf, 20, xgyro);
261 _mav_put_float(buf, 24, ygyro);
262 _mav_put_float(buf, 28, zgyro);
263 _mav_put_float(buf, 32, xmag);
264 _mav_put_float(buf, 36, ymag);
265 _mav_put_float(buf, 40, zmag);
266 _mav_put_float(buf, 44, abs_pressure);
267 _mav_put_float(buf, 48, diff_pressure);
268 _mav_put_float(buf, 52, pressure_alt);
269 _mav_put_float(buf, 56, temperature);
270 _mav_put_uint32_t(buf, 60, fields_updated);
272 #if MAVLINK_CRC_EXTRA
273 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
274 #else
275 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
276 #endif
277 #else
278 mavlink_hil_sensor_t packet;
279 packet.time_usec = time_usec;
280 packet.xacc = xacc;
281 packet.yacc = yacc;
282 packet.zacc = zacc;
283 packet.xgyro = xgyro;
284 packet.ygyro = ygyro;
285 packet.zgyro = zgyro;
286 packet.xmag = xmag;
287 packet.ymag = ymag;
288 packet.zmag = zmag;
289 packet.abs_pressure = abs_pressure;
290 packet.diff_pressure = diff_pressure;
291 packet.pressure_alt = pressure_alt;
292 packet.temperature = temperature;
293 packet.fields_updated = fields_updated;
295 #if MAVLINK_CRC_EXTRA
296 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
297 #else
298 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
299 #endif
300 #endif
303 #if MAVLINK_MSG_ID_HIL_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
305 This varient of _send() can be used to save stack space by re-using
306 memory from the receive buffer. The caller provides a
307 mavlink_message_t which is the size of a full mavlink message. This
308 is usually the receive buffer for the channel, and allows a reply to an
309 incoming message with minimum stack space usage.
311 static inline void mavlink_msg_hil_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated)
313 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
314 char *buf = (char *)msgbuf;
315 _mav_put_uint64_t(buf, 0, time_usec);
316 _mav_put_float(buf, 8, xacc);
317 _mav_put_float(buf, 12, yacc);
318 _mav_put_float(buf, 16, zacc);
319 _mav_put_float(buf, 20, xgyro);
320 _mav_put_float(buf, 24, ygyro);
321 _mav_put_float(buf, 28, zgyro);
322 _mav_put_float(buf, 32, xmag);
323 _mav_put_float(buf, 36, ymag);
324 _mav_put_float(buf, 40, zmag);
325 _mav_put_float(buf, 44, abs_pressure);
326 _mav_put_float(buf, 48, diff_pressure);
327 _mav_put_float(buf, 52, pressure_alt);
328 _mav_put_float(buf, 56, temperature);
329 _mav_put_uint32_t(buf, 60, fields_updated);
331 #if MAVLINK_CRC_EXTRA
332 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
333 #else
334 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
335 #endif
336 #else
337 mavlink_hil_sensor_t *packet = (mavlink_hil_sensor_t *)msgbuf;
338 packet->time_usec = time_usec;
339 packet->xacc = xacc;
340 packet->yacc = yacc;
341 packet->zacc = zacc;
342 packet->xgyro = xgyro;
343 packet->ygyro = ygyro;
344 packet->zgyro = zgyro;
345 packet->xmag = xmag;
346 packet->ymag = ymag;
347 packet->zmag = zmag;
348 packet->abs_pressure = abs_pressure;
349 packet->diff_pressure = diff_pressure;
350 packet->pressure_alt = pressure_alt;
351 packet->temperature = temperature;
352 packet->fields_updated = fields_updated;
354 #if MAVLINK_CRC_EXTRA
355 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC);
356 #else
357 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, (const char *)packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
358 #endif
359 #endif
361 #endif
363 #endif
365 // MESSAGE HIL_SENSOR UNPACKING
369 * @brief Get field time_usec from hil_sensor message
371 * @return Timestamp (microseconds, synced to UNIX time or since system boot)
373 static inline uint64_t mavlink_msg_hil_sensor_get_time_usec(const mavlink_message_t* msg)
375 return _MAV_RETURN_uint64_t(msg, 0);
379 * @brief Get field xacc from hil_sensor message
381 * @return X acceleration (m/s^2)
383 static inline float mavlink_msg_hil_sensor_get_xacc(const mavlink_message_t* msg)
385 return _MAV_RETURN_float(msg, 8);
389 * @brief Get field yacc from hil_sensor message
391 * @return Y acceleration (m/s^2)
393 static inline float mavlink_msg_hil_sensor_get_yacc(const mavlink_message_t* msg)
395 return _MAV_RETURN_float(msg, 12);
399 * @brief Get field zacc from hil_sensor message
401 * @return Z acceleration (m/s^2)
403 static inline float mavlink_msg_hil_sensor_get_zacc(const mavlink_message_t* msg)
405 return _MAV_RETURN_float(msg, 16);
409 * @brief Get field xgyro from hil_sensor message
411 * @return Angular speed around X axis in body frame (rad / sec)
413 static inline float mavlink_msg_hil_sensor_get_xgyro(const mavlink_message_t* msg)
415 return _MAV_RETURN_float(msg, 20);
419 * @brief Get field ygyro from hil_sensor message
421 * @return Angular speed around Y axis in body frame (rad / sec)
423 static inline float mavlink_msg_hil_sensor_get_ygyro(const mavlink_message_t* msg)
425 return _MAV_RETURN_float(msg, 24);
429 * @brief Get field zgyro from hil_sensor message
431 * @return Angular speed around Z axis in body frame (rad / sec)
433 static inline float mavlink_msg_hil_sensor_get_zgyro(const mavlink_message_t* msg)
435 return _MAV_RETURN_float(msg, 28);
439 * @brief Get field xmag from hil_sensor message
441 * @return X Magnetic field (Gauss)
443 static inline float mavlink_msg_hil_sensor_get_xmag(const mavlink_message_t* msg)
445 return _MAV_RETURN_float(msg, 32);
449 * @brief Get field ymag from hil_sensor message
451 * @return Y Magnetic field (Gauss)
453 static inline float mavlink_msg_hil_sensor_get_ymag(const mavlink_message_t* msg)
455 return _MAV_RETURN_float(msg, 36);
459 * @brief Get field zmag from hil_sensor message
461 * @return Z Magnetic field (Gauss)
463 static inline float mavlink_msg_hil_sensor_get_zmag(const mavlink_message_t* msg)
465 return _MAV_RETURN_float(msg, 40);
469 * @brief Get field abs_pressure from hil_sensor message
471 * @return Absolute pressure in millibar
473 static inline float mavlink_msg_hil_sensor_get_abs_pressure(const mavlink_message_t* msg)
475 return _MAV_RETURN_float(msg, 44);
479 * @brief Get field diff_pressure from hil_sensor message
481 * @return Differential pressure (airspeed) in millibar
483 static inline float mavlink_msg_hil_sensor_get_diff_pressure(const mavlink_message_t* msg)
485 return _MAV_RETURN_float(msg, 48);
489 * @brief Get field pressure_alt from hil_sensor message
491 * @return Altitude calculated from pressure
493 static inline float mavlink_msg_hil_sensor_get_pressure_alt(const mavlink_message_t* msg)
495 return _MAV_RETURN_float(msg, 52);
499 * @brief Get field temperature from hil_sensor message
501 * @return Temperature in degrees celsius
503 static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message_t* msg)
505 return _MAV_RETURN_float(msg, 56);
509 * @brief Get field fields_updated from hil_sensor message
511 * @return Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
513 static inline uint32_t mavlink_msg_hil_sensor_get_fields_updated(const mavlink_message_t* msg)
515 return _MAV_RETURN_uint32_t(msg, 60);
519 * @brief Decode a hil_sensor message into a struct
521 * @param msg The message to decode
522 * @param hil_sensor C-struct to decode the message contents into
524 static inline void mavlink_msg_hil_sensor_decode(const mavlink_message_t* msg, mavlink_hil_sensor_t* hil_sensor)
526 #if MAVLINK_NEED_BYTE_SWAP
527 hil_sensor->time_usec = mavlink_msg_hil_sensor_get_time_usec(msg);
528 hil_sensor->xacc = mavlink_msg_hil_sensor_get_xacc(msg);
529 hil_sensor->yacc = mavlink_msg_hil_sensor_get_yacc(msg);
530 hil_sensor->zacc = mavlink_msg_hil_sensor_get_zacc(msg);
531 hil_sensor->xgyro = mavlink_msg_hil_sensor_get_xgyro(msg);
532 hil_sensor->ygyro = mavlink_msg_hil_sensor_get_ygyro(msg);
533 hil_sensor->zgyro = mavlink_msg_hil_sensor_get_zgyro(msg);
534 hil_sensor->xmag = mavlink_msg_hil_sensor_get_xmag(msg);
535 hil_sensor->ymag = mavlink_msg_hil_sensor_get_ymag(msg);
536 hil_sensor->zmag = mavlink_msg_hil_sensor_get_zmag(msg);
537 hil_sensor->abs_pressure = mavlink_msg_hil_sensor_get_abs_pressure(msg);
538 hil_sensor->diff_pressure = mavlink_msg_hil_sensor_get_diff_pressure(msg);
539 hil_sensor->pressure_alt = mavlink_msg_hil_sensor_get_pressure_alt(msg);
540 hil_sensor->temperature = mavlink_msg_hil_sensor_get_temperature(msg);
541 hil_sensor->fields_updated = mavlink_msg_hil_sensor_get_fields_updated(msg);
542 #else
543 memcpy(hil_sensor, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_SENSOR_LEN);
544 #endif