Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_scaled_imu2.h
blob2106cefd1ea0085c84b7509e2d2441e356f6cb29
1 #pragma once
2 // MESSAGE SCALED_IMU2 PACKING
4 #define MAVLINK_MSG_ID_SCALED_IMU2 116
7 typedef struct __mavlink_scaled_imu2_t {
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 int16_t xacc; /*< [mG] X acceleration*/
10 int16_t yacc; /*< [mG] Y acceleration*/
11 int16_t zacc; /*< [mG] Z acceleration*/
12 int16_t xgyro; /*< [mrad/s] Angular speed around X axis*/
13 int16_t ygyro; /*< [mrad/s] Angular speed around Y axis*/
14 int16_t zgyro; /*< [mrad/s] Angular speed around Z axis*/
15 int16_t xmag; /*< [mgauss] X Magnetic field*/
16 int16_t ymag; /*< [mgauss] Y Magnetic field*/
17 int16_t zmag; /*< [mgauss] Z Magnetic field*/
18 int16_t temperature; /*< [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).*/
19 } mavlink_scaled_imu2_t;
21 #define MAVLINK_MSG_ID_SCALED_IMU2_LEN 24
22 #define MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN 22
23 #define MAVLINK_MSG_ID_116_LEN 24
24 #define MAVLINK_MSG_ID_116_MIN_LEN 22
26 #define MAVLINK_MSG_ID_SCALED_IMU2_CRC 76
27 #define MAVLINK_MSG_ID_116_CRC 76
31 #if MAVLINK_COMMAND_24BIT
32 #define MAVLINK_MESSAGE_INFO_SCALED_IMU2 { \
33 116, \
34 "SCALED_IMU2", \
35 11, \
36 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu2_t, time_boot_ms) }, \
37 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu2_t, xacc) }, \
38 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu2_t, yacc) }, \
39 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu2_t, zacc) }, \
40 { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu2_t, xgyro) }, \
41 { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu2_t, ygyro) }, \
42 { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu2_t, zgyro) }, \
43 { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu2_t, xmag) }, \
44 { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu2_t, ymag) }, \
45 { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu2_t, zmag) }, \
46 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_scaled_imu2_t, temperature) }, \
47 } \
49 #else
50 #define MAVLINK_MESSAGE_INFO_SCALED_IMU2 { \
51 "SCALED_IMU2", \
52 11, \
53 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu2_t, time_boot_ms) }, \
54 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu2_t, xacc) }, \
55 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu2_t, yacc) }, \
56 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu2_t, zacc) }, \
57 { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu2_t, xgyro) }, \
58 { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu2_t, ygyro) }, \
59 { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu2_t, zgyro) }, \
60 { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu2_t, xmag) }, \
61 { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu2_t, ymag) }, \
62 { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu2_t, zmag) }, \
63 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_scaled_imu2_t, temperature) }, \
64 } \
66 #endif
68 /**
69 * @brief Pack a scaled_imu2 message
70 * @param system_id ID of this system
71 * @param component_id ID of this component (e.g. 200 for IMU)
72 * @param msg The MAVLink message to compress the data into
74 * @param time_boot_ms [ms] Timestamp (time since system boot).
75 * @param xacc [mG] X acceleration
76 * @param yacc [mG] Y acceleration
77 * @param zacc [mG] Z acceleration
78 * @param xgyro [mrad/s] Angular speed around X axis
79 * @param ygyro [mrad/s] Angular speed around Y axis
80 * @param zgyro [mrad/s] Angular speed around Z axis
81 * @param xmag [mgauss] X Magnetic field
82 * @param ymag [mgauss] Y Magnetic field
83 * @param zmag [mgauss] Z Magnetic field
84 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
85 * @return length of the message in bytes (excluding serial stream start sign)
87 static inline uint16_t mavlink_msg_scaled_imu2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
88 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)
90 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91 char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
92 _mav_put_uint32_t(buf, 0, time_boot_ms);
93 _mav_put_int16_t(buf, 4, xacc);
94 _mav_put_int16_t(buf, 6, yacc);
95 _mav_put_int16_t(buf, 8, zacc);
96 _mav_put_int16_t(buf, 10, xgyro);
97 _mav_put_int16_t(buf, 12, ygyro);
98 _mav_put_int16_t(buf, 14, zgyro);
99 _mav_put_int16_t(buf, 16, xmag);
100 _mav_put_int16_t(buf, 18, ymag);
101 _mav_put_int16_t(buf, 20, zmag);
102 _mav_put_int16_t(buf, 22, temperature);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
105 #else
106 mavlink_scaled_imu2_t packet;
107 packet.time_boot_ms = time_boot_ms;
108 packet.xacc = xacc;
109 packet.yacc = yacc;
110 packet.zacc = zacc;
111 packet.xgyro = xgyro;
112 packet.ygyro = ygyro;
113 packet.zgyro = zgyro;
114 packet.xmag = xmag;
115 packet.ymag = ymag;
116 packet.zmag = zmag;
117 packet.temperature = temperature;
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
120 #endif
122 msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
123 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
127 * @brief Pack a scaled_imu2 message on a channel
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param chan The MAVLink channel this message will be sent over
131 * @param msg The MAVLink message to compress the data into
132 * @param time_boot_ms [ms] Timestamp (time since system boot).
133 * @param xacc [mG] X acceleration
134 * @param yacc [mG] Y acceleration
135 * @param zacc [mG] Z acceleration
136 * @param xgyro [mrad/s] Angular speed around X axis
137 * @param ygyro [mrad/s] Angular speed around Y axis
138 * @param zgyro [mrad/s] Angular speed around Z axis
139 * @param xmag [mgauss] X Magnetic field
140 * @param ymag [mgauss] Y Magnetic field
141 * @param zmag [mgauss] Z Magnetic field
142 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
143 * @return length of the message in bytes (excluding serial stream start sign)
145 static inline uint16_t mavlink_msg_scaled_imu2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146 mavlink_message_t* msg,
147 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)
149 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
150 char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
151 _mav_put_uint32_t(buf, 0, time_boot_ms);
152 _mav_put_int16_t(buf, 4, xacc);
153 _mav_put_int16_t(buf, 6, yacc);
154 _mav_put_int16_t(buf, 8, zacc);
155 _mav_put_int16_t(buf, 10, xgyro);
156 _mav_put_int16_t(buf, 12, ygyro);
157 _mav_put_int16_t(buf, 14, zgyro);
158 _mav_put_int16_t(buf, 16, xmag);
159 _mav_put_int16_t(buf, 18, ymag);
160 _mav_put_int16_t(buf, 20, zmag);
161 _mav_put_int16_t(buf, 22, temperature);
163 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
164 #else
165 mavlink_scaled_imu2_t packet;
166 packet.time_boot_ms = time_boot_ms;
167 packet.xacc = xacc;
168 packet.yacc = yacc;
169 packet.zacc = zacc;
170 packet.xgyro = xgyro;
171 packet.ygyro = ygyro;
172 packet.zgyro = zgyro;
173 packet.xmag = xmag;
174 packet.ymag = ymag;
175 packet.zmag = zmag;
176 packet.temperature = temperature;
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
179 #endif
181 msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
182 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
186 * @brief Encode a scaled_imu2 struct
188 * @param system_id ID of this system
189 * @param component_id ID of this component (e.g. 200 for IMU)
190 * @param msg The MAVLink message to compress the data into
191 * @param scaled_imu2 C-struct to read the message contents from
193 static inline uint16_t mavlink_msg_scaled_imu2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2)
195 return mavlink_msg_scaled_imu2_pack(system_id, component_id, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag, scaled_imu2->temperature);
199 * @brief Encode a scaled_imu2 struct on a channel
201 * @param system_id ID of this system
202 * @param component_id ID of this component (e.g. 200 for IMU)
203 * @param chan The MAVLink channel this message will be sent over
204 * @param msg The MAVLink message to compress the data into
205 * @param scaled_imu2 C-struct to read the message contents from
207 static inline uint16_t mavlink_msg_scaled_imu2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2)
209 return mavlink_msg_scaled_imu2_pack_chan(system_id, component_id, chan, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag, scaled_imu2->temperature);
213 * @brief Send a scaled_imu2 message
214 * @param chan MAVLink channel to send the message
216 * @param time_boot_ms [ms] Timestamp (time since system boot).
217 * @param xacc [mG] X acceleration
218 * @param yacc [mG] Y acceleration
219 * @param zacc [mG] Z acceleration
220 * @param xgyro [mrad/s] Angular speed around X axis
221 * @param ygyro [mrad/s] Angular speed around Y axis
222 * @param zgyro [mrad/s] Angular speed around Z axis
223 * @param xmag [mgauss] X Magnetic field
224 * @param ymag [mgauss] Y Magnetic field
225 * @param zmag [mgauss] Z Magnetic field
226 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
228 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
230 static inline void mavlink_msg_scaled_imu2_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)
232 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
233 char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
234 _mav_put_uint32_t(buf, 0, time_boot_ms);
235 _mav_put_int16_t(buf, 4, xacc);
236 _mav_put_int16_t(buf, 6, yacc);
237 _mav_put_int16_t(buf, 8, zacc);
238 _mav_put_int16_t(buf, 10, xgyro);
239 _mav_put_int16_t(buf, 12, ygyro);
240 _mav_put_int16_t(buf, 14, zgyro);
241 _mav_put_int16_t(buf, 16, xmag);
242 _mav_put_int16_t(buf, 18, ymag);
243 _mav_put_int16_t(buf, 20, zmag);
244 _mav_put_int16_t(buf, 22, temperature);
246 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
247 #else
248 mavlink_scaled_imu2_t packet;
249 packet.time_boot_ms = time_boot_ms;
250 packet.xacc = xacc;
251 packet.yacc = yacc;
252 packet.zacc = zacc;
253 packet.xgyro = xgyro;
254 packet.ygyro = ygyro;
255 packet.zgyro = zgyro;
256 packet.xmag = xmag;
257 packet.ymag = ymag;
258 packet.zmag = zmag;
259 packet.temperature = temperature;
261 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
262 #endif
266 * @brief Send a scaled_imu2 message
267 * @param chan MAVLink channel to send the message
268 * @param struct The MAVLink struct to serialize
270 static inline void mavlink_msg_scaled_imu2_send_struct(mavlink_channel_t chan, const mavlink_scaled_imu2_t* scaled_imu2)
272 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
273 mavlink_msg_scaled_imu2_send(chan, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag, scaled_imu2->temperature);
274 #else
275 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)scaled_imu2, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
276 #endif
279 #if MAVLINK_MSG_ID_SCALED_IMU2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
281 This varient of _send() can be used to save stack space by re-using
282 memory from the receive buffer. The caller provides a
283 mavlink_message_t which is the size of a full mavlink message. This
284 is usually the receive buffer for the channel, and allows a reply to an
285 incoming message with minimum stack space usage.
287 static inline void mavlink_msg_scaled_imu2_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)
289 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 char *buf = (char *)msgbuf;
291 _mav_put_uint32_t(buf, 0, time_boot_ms);
292 _mav_put_int16_t(buf, 4, xacc);
293 _mav_put_int16_t(buf, 6, yacc);
294 _mav_put_int16_t(buf, 8, zacc);
295 _mav_put_int16_t(buf, 10, xgyro);
296 _mav_put_int16_t(buf, 12, ygyro);
297 _mav_put_int16_t(buf, 14, zgyro);
298 _mav_put_int16_t(buf, 16, xmag);
299 _mav_put_int16_t(buf, 18, ymag);
300 _mav_put_int16_t(buf, 20, zmag);
301 _mav_put_int16_t(buf, 22, temperature);
303 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
304 #else
305 mavlink_scaled_imu2_t *packet = (mavlink_scaled_imu2_t *)msgbuf;
306 packet->time_boot_ms = time_boot_ms;
307 packet->xacc = xacc;
308 packet->yacc = yacc;
309 packet->zacc = zacc;
310 packet->xgyro = xgyro;
311 packet->ygyro = ygyro;
312 packet->zgyro = zgyro;
313 packet->xmag = xmag;
314 packet->ymag = ymag;
315 packet->zmag = zmag;
316 packet->temperature = temperature;
318 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)packet, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
319 #endif
321 #endif
323 #endif
325 // MESSAGE SCALED_IMU2 UNPACKING
329 * @brief Get field time_boot_ms from scaled_imu2 message
331 * @return [ms] Timestamp (time since system boot).
333 static inline uint32_t mavlink_msg_scaled_imu2_get_time_boot_ms(const mavlink_message_t* msg)
335 return _MAV_RETURN_uint32_t(msg, 0);
339 * @brief Get field xacc from scaled_imu2 message
341 * @return [mG] X acceleration
343 static inline int16_t mavlink_msg_scaled_imu2_get_xacc(const mavlink_message_t* msg)
345 return _MAV_RETURN_int16_t(msg, 4);
349 * @brief Get field yacc from scaled_imu2 message
351 * @return [mG] Y acceleration
353 static inline int16_t mavlink_msg_scaled_imu2_get_yacc(const mavlink_message_t* msg)
355 return _MAV_RETURN_int16_t(msg, 6);
359 * @brief Get field zacc from scaled_imu2 message
361 * @return [mG] Z acceleration
363 static inline int16_t mavlink_msg_scaled_imu2_get_zacc(const mavlink_message_t* msg)
365 return _MAV_RETURN_int16_t(msg, 8);
369 * @brief Get field xgyro from scaled_imu2 message
371 * @return [mrad/s] Angular speed around X axis
373 static inline int16_t mavlink_msg_scaled_imu2_get_xgyro(const mavlink_message_t* msg)
375 return _MAV_RETURN_int16_t(msg, 10);
379 * @brief Get field ygyro from scaled_imu2 message
381 * @return [mrad/s] Angular speed around Y axis
383 static inline int16_t mavlink_msg_scaled_imu2_get_ygyro(const mavlink_message_t* msg)
385 return _MAV_RETURN_int16_t(msg, 12);
389 * @brief Get field zgyro from scaled_imu2 message
391 * @return [mrad/s] Angular speed around Z axis
393 static inline int16_t mavlink_msg_scaled_imu2_get_zgyro(const mavlink_message_t* msg)
395 return _MAV_RETURN_int16_t(msg, 14);
399 * @brief Get field xmag from scaled_imu2 message
401 * @return [mgauss] X Magnetic field
403 static inline int16_t mavlink_msg_scaled_imu2_get_xmag(const mavlink_message_t* msg)
405 return _MAV_RETURN_int16_t(msg, 16);
409 * @brief Get field ymag from scaled_imu2 message
411 * @return [mgauss] Y Magnetic field
413 static inline int16_t mavlink_msg_scaled_imu2_get_ymag(const mavlink_message_t* msg)
415 return _MAV_RETURN_int16_t(msg, 18);
419 * @brief Get field zmag from scaled_imu2 message
421 * @return [mgauss] Z Magnetic field
423 static inline int16_t mavlink_msg_scaled_imu2_get_zmag(const mavlink_message_t* msg)
425 return _MAV_RETURN_int16_t(msg, 20);
429 * @brief Get field temperature from scaled_imu2 message
431 * @return [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
433 static inline int16_t mavlink_msg_scaled_imu2_get_temperature(const mavlink_message_t* msg)
435 return _MAV_RETURN_int16_t(msg, 22);
439 * @brief Decode a scaled_imu2 message into a struct
441 * @param msg The message to decode
442 * @param scaled_imu2 C-struct to decode the message contents into
444 static inline void mavlink_msg_scaled_imu2_decode(const mavlink_message_t* msg, mavlink_scaled_imu2_t* scaled_imu2)
446 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
447 scaled_imu2->time_boot_ms = mavlink_msg_scaled_imu2_get_time_boot_ms(msg);
448 scaled_imu2->xacc = mavlink_msg_scaled_imu2_get_xacc(msg);
449 scaled_imu2->yacc = mavlink_msg_scaled_imu2_get_yacc(msg);
450 scaled_imu2->zacc = mavlink_msg_scaled_imu2_get_zacc(msg);
451 scaled_imu2->xgyro = mavlink_msg_scaled_imu2_get_xgyro(msg);
452 scaled_imu2->ygyro = mavlink_msg_scaled_imu2_get_ygyro(msg);
453 scaled_imu2->zgyro = mavlink_msg_scaled_imu2_get_zgyro(msg);
454 scaled_imu2->xmag = mavlink_msg_scaled_imu2_get_xmag(msg);
455 scaled_imu2->ymag = mavlink_msg_scaled_imu2_get_ymag(msg);
456 scaled_imu2->zmag = mavlink_msg_scaled_imu2_get_zmag(msg);
457 scaled_imu2->temperature = mavlink_msg_scaled_imu2_get_temperature(msg);
458 #else
459 uint8_t len = msg->len < MAVLINK_MSG_ID_SCALED_IMU2_LEN? msg->len : MAVLINK_MSG_ID_SCALED_IMU2_LEN;
460 memset(scaled_imu2, 0, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
461 memcpy(scaled_imu2, _MAV_PAYLOAD(msg), len);
462 #endif