Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_scaled_imu2.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE SCALED_IMU2 PACKING
3
4#define MAVLINK_MSG_ID_SCALED_IMU2 116
5
6
7typedef 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;
20
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
25
26#define MAVLINK_MSG_ID_SCALED_IMU2_CRC 76
27#define MAVLINK_MSG_ID_116_CRC 76
28
29
30
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 } \
48}
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 } \
65}
66#endif
67
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
73 *
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)
86 */
87static 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)
89{
90#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
103
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;
118
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
120#endif
121
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);
124}
125
126/**
127 * @brief Pack a scaled_imu2 message
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param status MAVLink status structure
131 * @param msg The MAVLink message to compress the data into
132 *
133 * @param time_boot_ms [ms] Timestamp (time since system boot).
134 * @param xacc [mG] X acceleration
135 * @param yacc [mG] Y acceleration
136 * @param zacc [mG] Z acceleration
137 * @param xgyro [mrad/s] Angular speed around X axis
138 * @param ygyro [mrad/s] Angular speed around Y axis
139 * @param zgyro [mrad/s] Angular speed around Z axis
140 * @param xmag [mgauss] X Magnetic field
141 * @param ymag [mgauss] Y Magnetic field
142 * @param zmag [mgauss] Z Magnetic field
143 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
144 * @return length of the message in bytes (excluding serial stream start sign)
145 */
146static inline uint16_t mavlink_msg_scaled_imu2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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)
148{
149#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
162
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;
177
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
179#endif
180
181 msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
182#if MAVLINK_CRC_EXTRA
183 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
184#else
185 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
186#endif
187}
188
189/**
190 * @brief Pack a scaled_imu2 message on a channel
191 * @param system_id ID of this system
192 * @param component_id ID of this component (e.g. 200 for IMU)
193 * @param chan The MAVLink channel this message will be sent over
194 * @param msg The MAVLink message to compress the data into
195 * @param time_boot_ms [ms] Timestamp (time since system boot).
196 * @param xacc [mG] X acceleration
197 * @param yacc [mG] Y acceleration
198 * @param zacc [mG] Z acceleration
199 * @param xgyro [mrad/s] Angular speed around X axis
200 * @param ygyro [mrad/s] Angular speed around Y axis
201 * @param zgyro [mrad/s] Angular speed around Z axis
202 * @param xmag [mgauss] X Magnetic field
203 * @param ymag [mgauss] Y Magnetic field
204 * @param zmag [mgauss] Z Magnetic field
205 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
206 * @return length of the message in bytes (excluding serial stream start sign)
207 */
208static inline uint16_t mavlink_msg_scaled_imu2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
209 mavlink_message_t* msg,
210 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)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
214 _mav_put_uint32_t(buf, 0, time_boot_ms);
215 _mav_put_int16_t(buf, 4, xacc);
216 _mav_put_int16_t(buf, 6, yacc);
217 _mav_put_int16_t(buf, 8, zacc);
218 _mav_put_int16_t(buf, 10, xgyro);
219 _mav_put_int16_t(buf, 12, ygyro);
220 _mav_put_int16_t(buf, 14, zgyro);
221 _mav_put_int16_t(buf, 16, xmag);
222 _mav_put_int16_t(buf, 18, ymag);
223 _mav_put_int16_t(buf, 20, zmag);
224 _mav_put_int16_t(buf, 22, temperature);
225
226 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
227#else
228 mavlink_scaled_imu2_t packet;
229 packet.time_boot_ms = time_boot_ms;
230 packet.xacc = xacc;
231 packet.yacc = yacc;
232 packet.zacc = zacc;
233 packet.xgyro = xgyro;
234 packet.ygyro = ygyro;
235 packet.zgyro = zgyro;
236 packet.xmag = xmag;
237 packet.ymag = ymag;
238 packet.zmag = zmag;
239 packet.temperature = temperature;
240
241 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
242#endif
243
244 msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
245 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);
246}
247
248/**
249 * @brief Encode a scaled_imu2 struct
250 *
251 * @param system_id ID of this system
252 * @param component_id ID of this component (e.g. 200 for IMU)
253 * @param msg The MAVLink message to compress the data into
254 * @param scaled_imu2 C-struct to read the message contents from
255 */
256static 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)
257{
258 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);
259}
260
261/**
262 * @brief Encode a scaled_imu2 struct on a channel
263 *
264 * @param system_id ID of this system
265 * @param component_id ID of this component (e.g. 200 for IMU)
266 * @param chan The MAVLink channel this message will be sent over
267 * @param msg The MAVLink message to compress the data into
268 * @param scaled_imu2 C-struct to read the message contents from
269 */
270static 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)
271{
272 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);
273}
274
275/**
276 * @brief Encode a scaled_imu2 struct with provided status structure
277 *
278 * @param system_id ID of this system
279 * @param component_id ID of this component (e.g. 200 for IMU)
280 * @param status MAVLink status structure
281 * @param msg The MAVLink message to compress the data into
282 * @param scaled_imu2 C-struct to read the message contents from
283 */
284static inline uint16_t mavlink_msg_scaled_imu2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2)
285{
286 return mavlink_msg_scaled_imu2_pack_status(system_id, component_id, _status, 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);
287}
288
289/**
290 * @brief Send a scaled_imu2 message
291 * @param chan MAVLink channel to send the message
292 *
293 * @param time_boot_ms [ms] Timestamp (time since system boot).
294 * @param xacc [mG] X acceleration
295 * @param yacc [mG] Y acceleration
296 * @param zacc [mG] Z acceleration
297 * @param xgyro [mrad/s] Angular speed around X axis
298 * @param ygyro [mrad/s] Angular speed around Y axis
299 * @param zgyro [mrad/s] Angular speed around Z axis
300 * @param xmag [mgauss] X Magnetic field
301 * @param ymag [mgauss] Y Magnetic field
302 * @param zmag [mgauss] Z Magnetic field
303 * @param temperature [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
304 */
305#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
306
307static 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)
308{
309#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
310 char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
311 _mav_put_uint32_t(buf, 0, time_boot_ms);
312 _mav_put_int16_t(buf, 4, xacc);
313 _mav_put_int16_t(buf, 6, yacc);
314 _mav_put_int16_t(buf, 8, zacc);
315 _mav_put_int16_t(buf, 10, xgyro);
316 _mav_put_int16_t(buf, 12, ygyro);
317 _mav_put_int16_t(buf, 14, zgyro);
318 _mav_put_int16_t(buf, 16, xmag);
319 _mav_put_int16_t(buf, 18, ymag);
320 _mav_put_int16_t(buf, 20, zmag);
321 _mav_put_int16_t(buf, 22, temperature);
322
323 _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);
324#else
325 mavlink_scaled_imu2_t packet;
326 packet.time_boot_ms = time_boot_ms;
327 packet.xacc = xacc;
328 packet.yacc = yacc;
329 packet.zacc = zacc;
330 packet.xgyro = xgyro;
331 packet.ygyro = ygyro;
332 packet.zgyro = zgyro;
333 packet.xmag = xmag;
334 packet.ymag = ymag;
335 packet.zmag = zmag;
336 packet.temperature = temperature;
337
338 _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);
339#endif
340}
341
342/**
343 * @brief Send a scaled_imu2 message
344 * @param chan MAVLink channel to send the message
345 * @param struct The MAVLink struct to serialize
346 */
347static inline void mavlink_msg_scaled_imu2_send_struct(mavlink_channel_t chan, const mavlink_scaled_imu2_t* scaled_imu2)
348{
349#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
350 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);
351#else
352 _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);
353#endif
354}
355
356#if MAVLINK_MSG_ID_SCALED_IMU2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
357/*
358 This variant of _send() can be used to save stack space by reusing
359 memory from the receive buffer. The caller provides a
360 mavlink_message_t which is the size of a full mavlink message. This
361 is usually the receive buffer for the channel, and allows a reply to an
362 incoming message with minimum stack space usage.
363 */
364static 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)
365{
366#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
367 char *buf = (char *)msgbuf;
368 _mav_put_uint32_t(buf, 0, time_boot_ms);
369 _mav_put_int16_t(buf, 4, xacc);
370 _mav_put_int16_t(buf, 6, yacc);
371 _mav_put_int16_t(buf, 8, zacc);
372 _mav_put_int16_t(buf, 10, xgyro);
373 _mav_put_int16_t(buf, 12, ygyro);
374 _mav_put_int16_t(buf, 14, zgyro);
375 _mav_put_int16_t(buf, 16, xmag);
376 _mav_put_int16_t(buf, 18, ymag);
377 _mav_put_int16_t(buf, 20, zmag);
378 _mav_put_int16_t(buf, 22, temperature);
379
380 _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);
381#else
382 mavlink_scaled_imu2_t *packet = (mavlink_scaled_imu2_t *)msgbuf;
383 packet->time_boot_ms = time_boot_ms;
384 packet->xacc = xacc;
385 packet->yacc = yacc;
386 packet->zacc = zacc;
387 packet->xgyro = xgyro;
388 packet->ygyro = ygyro;
389 packet->zgyro = zgyro;
390 packet->xmag = xmag;
391 packet->ymag = ymag;
392 packet->zmag = zmag;
393 packet->temperature = temperature;
394
395 _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);
396#endif
397}
398#endif
399
400#endif
401
402// MESSAGE SCALED_IMU2 UNPACKING
403
404
405/**
406 * @brief Get field time_boot_ms from scaled_imu2 message
407 *
408 * @return [ms] Timestamp (time since system boot).
409 */
410static inline uint32_t mavlink_msg_scaled_imu2_get_time_boot_ms(const mavlink_message_t* msg)
411{
412 return _MAV_RETURN_uint32_t(msg, 0);
413}
414
415/**
416 * @brief Get field xacc from scaled_imu2 message
417 *
418 * @return [mG] X acceleration
419 */
420static inline int16_t mavlink_msg_scaled_imu2_get_xacc(const mavlink_message_t* msg)
421{
422 return _MAV_RETURN_int16_t(msg, 4);
423}
424
425/**
426 * @brief Get field yacc from scaled_imu2 message
427 *
428 * @return [mG] Y acceleration
429 */
430static inline int16_t mavlink_msg_scaled_imu2_get_yacc(const mavlink_message_t* msg)
431{
432 return _MAV_RETURN_int16_t(msg, 6);
433}
434
435/**
436 * @brief Get field zacc from scaled_imu2 message
437 *
438 * @return [mG] Z acceleration
439 */
440static inline int16_t mavlink_msg_scaled_imu2_get_zacc(const mavlink_message_t* msg)
441{
442 return _MAV_RETURN_int16_t(msg, 8);
443}
444
445/**
446 * @brief Get field xgyro from scaled_imu2 message
447 *
448 * @return [mrad/s] Angular speed around X axis
449 */
450static inline int16_t mavlink_msg_scaled_imu2_get_xgyro(const mavlink_message_t* msg)
451{
452 return _MAV_RETURN_int16_t(msg, 10);
453}
454
455/**
456 * @brief Get field ygyro from scaled_imu2 message
457 *
458 * @return [mrad/s] Angular speed around Y axis
459 */
460static inline int16_t mavlink_msg_scaled_imu2_get_ygyro(const mavlink_message_t* msg)
461{
462 return _MAV_RETURN_int16_t(msg, 12);
463}
464
465/**
466 * @brief Get field zgyro from scaled_imu2 message
467 *
468 * @return [mrad/s] Angular speed around Z axis
469 */
470static inline int16_t mavlink_msg_scaled_imu2_get_zgyro(const mavlink_message_t* msg)
471{
472 return _MAV_RETURN_int16_t(msg, 14);
473}
474
475/**
476 * @brief Get field xmag from scaled_imu2 message
477 *
478 * @return [mgauss] X Magnetic field
479 */
480static inline int16_t mavlink_msg_scaled_imu2_get_xmag(const mavlink_message_t* msg)
481{
482 return _MAV_RETURN_int16_t(msg, 16);
483}
484
485/**
486 * @brief Get field ymag from scaled_imu2 message
487 *
488 * @return [mgauss] Y Magnetic field
489 */
490static inline int16_t mavlink_msg_scaled_imu2_get_ymag(const mavlink_message_t* msg)
491{
492 return _MAV_RETURN_int16_t(msg, 18);
493}
494
495/**
496 * @brief Get field zmag from scaled_imu2 message
497 *
498 * @return [mgauss] Z Magnetic field
499 */
500static inline int16_t mavlink_msg_scaled_imu2_get_zmag(const mavlink_message_t* msg)
501{
502 return _MAV_RETURN_int16_t(msg, 20);
503}
504
505/**
506 * @brief Get field temperature from scaled_imu2 message
507 *
508 * @return [cdegC] Temperature, 0: IMU does not provide temperature values. If the IMU is at 0C it must send 1 (0.01C).
509 */
510static inline int16_t mavlink_msg_scaled_imu2_get_temperature(const mavlink_message_t* msg)
511{
512 return _MAV_RETURN_int16_t(msg, 22);
513}
514
515/**
516 * @brief Decode a scaled_imu2 message into a struct
517 *
518 * @param msg The message to decode
519 * @param scaled_imu2 C-struct to decode the message contents into
520 */
521static inline void mavlink_msg_scaled_imu2_decode(const mavlink_message_t* msg, mavlink_scaled_imu2_t* scaled_imu2)
522{
523#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
524 scaled_imu2->time_boot_ms = mavlink_msg_scaled_imu2_get_time_boot_ms(msg);
525 scaled_imu2->xacc = mavlink_msg_scaled_imu2_get_xacc(msg);
526 scaled_imu2->yacc = mavlink_msg_scaled_imu2_get_yacc(msg);
527 scaled_imu2->zacc = mavlink_msg_scaled_imu2_get_zacc(msg);
528 scaled_imu2->xgyro = mavlink_msg_scaled_imu2_get_xgyro(msg);
529 scaled_imu2->ygyro = mavlink_msg_scaled_imu2_get_ygyro(msg);
530 scaled_imu2->zgyro = mavlink_msg_scaled_imu2_get_zgyro(msg);
531 scaled_imu2->xmag = mavlink_msg_scaled_imu2_get_xmag(msg);
532 scaled_imu2->ymag = mavlink_msg_scaled_imu2_get_ymag(msg);
533 scaled_imu2->zmag = mavlink_msg_scaled_imu2_get_zmag(msg);
534 scaled_imu2->temperature = mavlink_msg_scaled_imu2_get_temperature(msg);
535#else
536 uint8_t len = msg->len < MAVLINK_MSG_ID_SCALED_IMU2_LEN? msg->len : MAVLINK_MSG_ID_SCALED_IMU2_LEN;
537 memset(scaled_imu2, 0, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
538 memcpy(scaled_imu2, _MAV_PAYLOAD(msg), len);
539#endif
540}