[GYRO] Refactor gyro driver for dual-gyro support
[inav.git] / lib / main / MAVLink / common / mavlink_msg_highres_imu.h
blobbe7e5d33d2961c6d8192088af87d9865d92f8340
1 #pragma once
2 // MESSAGE HIGHRES_IMU PACKING
4 #define MAVLINK_MSG_ID_HIGHRES_IMU 105
6 MAVPACKED(
7 typedef struct __mavlink_highres_imu_t {
8 uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
9 float xacc; /*< X acceleration (m/s^2)*/
10 float yacc; /*< Y acceleration (m/s^2)*/
11 float zacc; /*< Z acceleration (m/s^2)*/
12 float xgyro; /*< Angular speed around X axis (rad / sec)*/
13 float ygyro; /*< Angular speed around Y axis (rad / sec)*/
14 float zgyro; /*< Angular speed around Z axis (rad / sec)*/
15 float xmag; /*< X Magnetic field (Gauss)*/
16 float ymag; /*< Y Magnetic field (Gauss)*/
17 float zmag; /*< Z Magnetic field (Gauss)*/
18 float abs_pressure; /*< Absolute pressure in millibar*/
19 float diff_pressure; /*< Differential pressure in millibar*/
20 float pressure_alt; /*< Altitude calculated from pressure*/
21 float temperature; /*< Temperature in degrees celsius*/
22 uint16_t fields_updated; /*< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/
23 }) mavlink_highres_imu_t;
25 #define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 62
26 #define MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN 62
27 #define MAVLINK_MSG_ID_105_LEN 62
28 #define MAVLINK_MSG_ID_105_MIN_LEN 62
30 #define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
31 #define MAVLINK_MSG_ID_105_CRC 93
35 #if MAVLINK_COMMAND_24BIT
36 #define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
37 105, \
38 "HIGHRES_IMU", \
39 15, \
40 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
41 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
42 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
43 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
44 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
45 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
46 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
47 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
48 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
49 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
50 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
51 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
52 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
53 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
54 { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
55 } \
57 #else
58 #define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
59 "HIGHRES_IMU", \
60 15, \
61 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
62 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
63 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
64 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
65 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
66 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
67 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
68 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
69 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
70 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
71 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
72 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
73 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
74 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
75 { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
76 } \
78 #endif
80 /**
81 * @brief Pack a highres_imu message
82 * @param system_id ID of this system
83 * @param component_id ID of this component (e.g. 200 for IMU)
84 * @param msg The MAVLink message to compress the data into
86 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
87 * @param xacc X acceleration (m/s^2)
88 * @param yacc Y acceleration (m/s^2)
89 * @param zacc Z acceleration (m/s^2)
90 * @param xgyro Angular speed around X axis (rad / sec)
91 * @param ygyro Angular speed around Y axis (rad / sec)
92 * @param zgyro Angular speed around Z axis (rad / sec)
93 * @param xmag X Magnetic field (Gauss)
94 * @param ymag Y Magnetic field (Gauss)
95 * @param zmag Z Magnetic field (Gauss)
96 * @param abs_pressure Absolute pressure in millibar
97 * @param diff_pressure Differential pressure in millibar
98 * @param pressure_alt Altitude calculated from pressure
99 * @param temperature Temperature in degrees celsius
100 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
104 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, uint16_t fields_updated)
106 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107 char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
108 _mav_put_uint64_t(buf, 0, time_usec);
109 _mav_put_float(buf, 8, xacc);
110 _mav_put_float(buf, 12, yacc);
111 _mav_put_float(buf, 16, zacc);
112 _mav_put_float(buf, 20, xgyro);
113 _mav_put_float(buf, 24, ygyro);
114 _mav_put_float(buf, 28, zgyro);
115 _mav_put_float(buf, 32, xmag);
116 _mav_put_float(buf, 36, ymag);
117 _mav_put_float(buf, 40, zmag);
118 _mav_put_float(buf, 44, abs_pressure);
119 _mav_put_float(buf, 48, diff_pressure);
120 _mav_put_float(buf, 52, pressure_alt);
121 _mav_put_float(buf, 56, temperature);
122 _mav_put_uint16_t(buf, 60, fields_updated);
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
125 #else
126 mavlink_highres_imu_t packet;
127 packet.time_usec = time_usec;
128 packet.xacc = xacc;
129 packet.yacc = yacc;
130 packet.zacc = zacc;
131 packet.xgyro = xgyro;
132 packet.ygyro = ygyro;
133 packet.zgyro = zgyro;
134 packet.xmag = xmag;
135 packet.ymag = ymag;
136 packet.zmag = zmag;
137 packet.abs_pressure = abs_pressure;
138 packet.diff_pressure = diff_pressure;
139 packet.pressure_alt = pressure_alt;
140 packet.temperature = temperature;
141 packet.fields_updated = fields_updated;
143 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
144 #endif
146 msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
147 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
151 * @brief Pack a highres_imu message on a channel
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param chan The MAVLink channel this message will be sent over
155 * @param msg The MAVLink message to compress the data into
156 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
157 * @param xacc X acceleration (m/s^2)
158 * @param yacc Y acceleration (m/s^2)
159 * @param zacc Z acceleration (m/s^2)
160 * @param xgyro Angular speed around X axis (rad / sec)
161 * @param ygyro Angular speed around Y axis (rad / sec)
162 * @param zgyro Angular speed around Z axis (rad / sec)
163 * @param xmag X Magnetic field (Gauss)
164 * @param ymag Y Magnetic field (Gauss)
165 * @param zmag Z Magnetic field (Gauss)
166 * @param abs_pressure Absolute pressure in millibar
167 * @param diff_pressure Differential pressure in millibar
168 * @param pressure_alt Altitude calculated from pressure
169 * @param temperature Temperature in degrees celsius
170 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
171 * @return length of the message in bytes (excluding serial stream start sign)
173 static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
174 mavlink_message_t* msg,
175 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,uint16_t fields_updated)
177 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
178 char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
179 _mav_put_uint64_t(buf, 0, time_usec);
180 _mav_put_float(buf, 8, xacc);
181 _mav_put_float(buf, 12, yacc);
182 _mav_put_float(buf, 16, zacc);
183 _mav_put_float(buf, 20, xgyro);
184 _mav_put_float(buf, 24, ygyro);
185 _mav_put_float(buf, 28, zgyro);
186 _mav_put_float(buf, 32, xmag);
187 _mav_put_float(buf, 36, ymag);
188 _mav_put_float(buf, 40, zmag);
189 _mav_put_float(buf, 44, abs_pressure);
190 _mav_put_float(buf, 48, diff_pressure);
191 _mav_put_float(buf, 52, pressure_alt);
192 _mav_put_float(buf, 56, temperature);
193 _mav_put_uint16_t(buf, 60, fields_updated);
195 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
196 #else
197 mavlink_highres_imu_t packet;
198 packet.time_usec = time_usec;
199 packet.xacc = xacc;
200 packet.yacc = yacc;
201 packet.zacc = zacc;
202 packet.xgyro = xgyro;
203 packet.ygyro = ygyro;
204 packet.zgyro = zgyro;
205 packet.xmag = xmag;
206 packet.ymag = ymag;
207 packet.zmag = zmag;
208 packet.abs_pressure = abs_pressure;
209 packet.diff_pressure = diff_pressure;
210 packet.pressure_alt = pressure_alt;
211 packet.temperature = temperature;
212 packet.fields_updated = fields_updated;
214 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
215 #endif
217 msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
218 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
222 * @brief Encode a highres_imu struct
224 * @param system_id ID of this system
225 * @param component_id ID of this component (e.g. 200 for IMU)
226 * @param msg The MAVLink message to compress the data into
227 * @param highres_imu C-struct to read the message contents from
229 static inline uint16_t mavlink_msg_highres_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
231 return mavlink_msg_highres_imu_pack(system_id, component_id, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
235 * @brief Encode a highres_imu struct on a channel
237 * @param system_id ID of this system
238 * @param component_id ID of this component (e.g. 200 for IMU)
239 * @param chan The MAVLink channel this message will be sent over
240 * @param msg The MAVLink message to compress the data into
241 * @param highres_imu C-struct to read the message contents from
243 static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
245 return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
249 * @brief Send a highres_imu message
250 * @param chan MAVLink channel to send the message
252 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
253 * @param xacc X acceleration (m/s^2)
254 * @param yacc Y acceleration (m/s^2)
255 * @param zacc Z acceleration (m/s^2)
256 * @param xgyro Angular speed around X axis (rad / sec)
257 * @param ygyro Angular speed around Y axis (rad / sec)
258 * @param zgyro Angular speed around Z axis (rad / sec)
259 * @param xmag X Magnetic field (Gauss)
260 * @param ymag Y Magnetic field (Gauss)
261 * @param zmag Z Magnetic field (Gauss)
262 * @param abs_pressure Absolute pressure in millibar
263 * @param diff_pressure Differential pressure in millibar
264 * @param pressure_alt Altitude calculated from pressure
265 * @param temperature Temperature in degrees celsius
266 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
268 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
270 static inline void mavlink_msg_highres_imu_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, uint16_t fields_updated)
272 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
273 char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
274 _mav_put_uint64_t(buf, 0, time_usec);
275 _mav_put_float(buf, 8, xacc);
276 _mav_put_float(buf, 12, yacc);
277 _mav_put_float(buf, 16, zacc);
278 _mav_put_float(buf, 20, xgyro);
279 _mav_put_float(buf, 24, ygyro);
280 _mav_put_float(buf, 28, zgyro);
281 _mav_put_float(buf, 32, xmag);
282 _mav_put_float(buf, 36, ymag);
283 _mav_put_float(buf, 40, zmag);
284 _mav_put_float(buf, 44, abs_pressure);
285 _mav_put_float(buf, 48, diff_pressure);
286 _mav_put_float(buf, 52, pressure_alt);
287 _mav_put_float(buf, 56, temperature);
288 _mav_put_uint16_t(buf, 60, fields_updated);
290 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
291 #else
292 mavlink_highres_imu_t packet;
293 packet.time_usec = time_usec;
294 packet.xacc = xacc;
295 packet.yacc = yacc;
296 packet.zacc = zacc;
297 packet.xgyro = xgyro;
298 packet.ygyro = ygyro;
299 packet.zgyro = zgyro;
300 packet.xmag = xmag;
301 packet.ymag = ymag;
302 packet.zmag = zmag;
303 packet.abs_pressure = abs_pressure;
304 packet.diff_pressure = diff_pressure;
305 packet.pressure_alt = pressure_alt;
306 packet.temperature = temperature;
307 packet.fields_updated = fields_updated;
309 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
310 #endif
314 * @brief Send a highres_imu message
315 * @param chan MAVLink channel to send the message
316 * @param struct The MAVLink struct to serialize
318 static inline void mavlink_msg_highres_imu_send_struct(mavlink_channel_t chan, const mavlink_highres_imu_t* highres_imu)
320 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
321 mavlink_msg_highres_imu_send(chan, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
322 #else
323 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)highres_imu, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
324 #endif
327 #if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
329 This varient 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.
335 static inline void mavlink_msg_highres_imu_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, uint16_t fields_updated)
337 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
338 char *buf = (char *)msgbuf;
339 _mav_put_uint64_t(buf, 0, time_usec);
340 _mav_put_float(buf, 8, xacc);
341 _mav_put_float(buf, 12, yacc);
342 _mav_put_float(buf, 16, zacc);
343 _mav_put_float(buf, 20, xgyro);
344 _mav_put_float(buf, 24, ygyro);
345 _mav_put_float(buf, 28, zgyro);
346 _mav_put_float(buf, 32, xmag);
347 _mav_put_float(buf, 36, ymag);
348 _mav_put_float(buf, 40, zmag);
349 _mav_put_float(buf, 44, abs_pressure);
350 _mav_put_float(buf, 48, diff_pressure);
351 _mav_put_float(buf, 52, pressure_alt);
352 _mav_put_float(buf, 56, temperature);
353 _mav_put_uint16_t(buf, 60, fields_updated);
355 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
356 #else
357 mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
358 packet->time_usec = time_usec;
359 packet->xacc = xacc;
360 packet->yacc = yacc;
361 packet->zacc = zacc;
362 packet->xgyro = xgyro;
363 packet->ygyro = ygyro;
364 packet->zgyro = zgyro;
365 packet->xmag = xmag;
366 packet->ymag = ymag;
367 packet->zmag = zmag;
368 packet->abs_pressure = abs_pressure;
369 packet->diff_pressure = diff_pressure;
370 packet->pressure_alt = pressure_alt;
371 packet->temperature = temperature;
372 packet->fields_updated = fields_updated;
374 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
375 #endif
377 #endif
379 #endif
381 // MESSAGE HIGHRES_IMU UNPACKING
385 * @brief Get field time_usec from highres_imu message
387 * @return Timestamp (microseconds, synced to UNIX time or since system boot)
389 static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
391 return _MAV_RETURN_uint64_t(msg, 0);
395 * @brief Get field xacc from highres_imu message
397 * @return X acceleration (m/s^2)
399 static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
401 return _MAV_RETURN_float(msg, 8);
405 * @brief Get field yacc from highres_imu message
407 * @return Y acceleration (m/s^2)
409 static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
411 return _MAV_RETURN_float(msg, 12);
415 * @brief Get field zacc from highres_imu message
417 * @return Z acceleration (m/s^2)
419 static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
421 return _MAV_RETURN_float(msg, 16);
425 * @brief Get field xgyro from highres_imu message
427 * @return Angular speed around X axis (rad / sec)
429 static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
431 return _MAV_RETURN_float(msg, 20);
435 * @brief Get field ygyro from highres_imu message
437 * @return Angular speed around Y axis (rad / sec)
439 static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
441 return _MAV_RETURN_float(msg, 24);
445 * @brief Get field zgyro from highres_imu message
447 * @return Angular speed around Z axis (rad / sec)
449 static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
451 return _MAV_RETURN_float(msg, 28);
455 * @brief Get field xmag from highres_imu message
457 * @return X Magnetic field (Gauss)
459 static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
461 return _MAV_RETURN_float(msg, 32);
465 * @brief Get field ymag from highres_imu message
467 * @return Y Magnetic field (Gauss)
469 static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
471 return _MAV_RETURN_float(msg, 36);
475 * @brief Get field zmag from highres_imu message
477 * @return Z Magnetic field (Gauss)
479 static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
481 return _MAV_RETURN_float(msg, 40);
485 * @brief Get field abs_pressure from highres_imu message
487 * @return Absolute pressure in millibar
489 static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
491 return _MAV_RETURN_float(msg, 44);
495 * @brief Get field diff_pressure from highres_imu message
497 * @return Differential pressure in millibar
499 static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
501 return _MAV_RETURN_float(msg, 48);
505 * @brief Get field pressure_alt from highres_imu message
507 * @return Altitude calculated from pressure
509 static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
511 return _MAV_RETURN_float(msg, 52);
515 * @brief Get field temperature from highres_imu message
517 * @return Temperature in degrees celsius
519 static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
521 return _MAV_RETURN_float(msg, 56);
525 * @brief Get field fields_updated from highres_imu message
527 * @return Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
529 static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
531 return _MAV_RETURN_uint16_t(msg, 60);
535 * @brief Decode a highres_imu message into a struct
537 * @param msg The message to decode
538 * @param highres_imu C-struct to decode the message contents into
540 static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
542 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
543 highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
544 highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
545 highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
546 highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
547 highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
548 highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
549 highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
550 highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
551 highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
552 highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
553 highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
554 highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
555 highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
556 highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
557 highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
558 #else
559 uint8_t len = msg->len < MAVLINK_MSG_ID_HIGHRES_IMU_LEN? msg->len : MAVLINK_MSG_ID_HIGHRES_IMU_LEN;
560 memset(highres_imu, 0, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
561 memcpy(highres_imu, _MAV_PAYLOAD(msg), len);
562 #endif