NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_airspeeds.h
Go to the documentation of this file.
1 // MESSAGE AIRSPEEDS PACKING
2 
3 #define MAVLINK_MSG_ID_AIRSPEEDS 182
4 
5 typedef struct __mavlink_airspeeds_t
6 {
7  uint32_t time_boot_ms;
8  int16_t airspeed_imu;
9  int16_t airspeed_pitot;
12  int16_t aoa;
13  int16_t aoy;
15 
16 #define MAVLINK_MSG_ID_AIRSPEEDS_LEN 16
17 #define MAVLINK_MSG_ID_182_LEN 16
18 
19 #define MAVLINK_MSG_ID_AIRSPEEDS_CRC 154
20 #define MAVLINK_MSG_ID_182_CRC 154
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_AIRSPEEDS { \
25  "AIRSPEEDS", \
26  7, \
27  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_airspeeds_t, time_boot_ms) }, \
28  { "airspeed_imu", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_airspeeds_t, airspeed_imu) }, \
29  { "airspeed_pitot", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_airspeeds_t, airspeed_pitot) }, \
30  { "airspeed_hot_wire", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_airspeeds_t, airspeed_hot_wire) }, \
31  { "airspeed_ultrasonic", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_airspeeds_t, airspeed_ultrasonic) }, \
32  { "aoa", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_airspeeds_t, aoa) }, \
33  { "aoy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_airspeeds_t, aoy) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_airspeeds_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_uint32_t(buf, 0, time_boot_ms);
59  _mav_put_int16_t(buf, 4, airspeed_imu);
60  _mav_put_int16_t(buf, 6, airspeed_pitot);
61  _mav_put_int16_t(buf, 8, airspeed_hot_wire);
62  _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
63  _mav_put_int16_t(buf, 12, aoa);
64  _mav_put_int16_t(buf, 14, aoy);
65 
67 #else
68  mavlink_airspeeds_t packet;
69  packet.time_boot_ms = time_boot_ms;
70  packet.airspeed_imu = airspeed_imu;
71  packet.airspeed_pitot = airspeed_pitot;
72  packet.airspeed_hot_wire = airspeed_hot_wire;
73  packet.airspeed_ultrasonic = airspeed_ultrasonic;
74  packet.aoa = aoa;
75  packet.aoy = aoy;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_airspeeds_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint32_t time_boot_ms,int16_t airspeed_imu,int16_t airspeed_pitot,int16_t airspeed_hot_wire,int16_t airspeed_ultrasonic,int16_t aoa,int16_t aoy)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_uint32_t(buf, 0, time_boot_ms);
110  _mav_put_int16_t(buf, 4, airspeed_imu);
111  _mav_put_int16_t(buf, 6, airspeed_pitot);
112  _mav_put_int16_t(buf, 8, airspeed_hot_wire);
113  _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
114  _mav_put_int16_t(buf, 12, aoa);
115  _mav_put_int16_t(buf, 14, aoy);
116 
118 #else
119  mavlink_airspeeds_t packet;
120  packet.time_boot_ms = time_boot_ms;
121  packet.airspeed_imu = airspeed_imu;
122  packet.airspeed_pitot = airspeed_pitot;
123  packet.airspeed_hot_wire = airspeed_hot_wire;
124  packet.airspeed_ultrasonic = airspeed_ultrasonic;
125  packet.aoa = aoa;
126  packet.aoy = aoy;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_airspeeds_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds)
148 {
149  return mavlink_msg_airspeeds_pack(system_id, component_id, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy);
150 }
151 
161 static inline uint16_t mavlink_msg_airspeeds_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds)
162 {
163  return mavlink_msg_airspeeds_pack_chan(system_id, component_id, chan, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_airspeeds_send(mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_uint32_t(buf, 0, time_boot_ms);
185  _mav_put_int16_t(buf, 4, airspeed_imu);
186  _mav_put_int16_t(buf, 6, airspeed_pitot);
187  _mav_put_int16_t(buf, 8, airspeed_hot_wire);
188  _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
189  _mav_put_int16_t(buf, 12, aoa);
190  _mav_put_int16_t(buf, 14, aoy);
191 
192 #if MAVLINK_CRC_EXTRA
193  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
196 #endif
197 #else
198  mavlink_airspeeds_t packet;
199  packet.time_boot_ms = time_boot_ms;
200  packet.airspeed_imu = airspeed_imu;
201  packet.airspeed_pitot = airspeed_pitot;
202  packet.airspeed_hot_wire = airspeed_hot_wire;
203  packet.airspeed_ultrasonic = airspeed_ultrasonic;
204  packet.aoa = aoa;
205  packet.aoy = aoy;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_AIRSPEEDS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static inline void mavlink_msg_airspeeds_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_uint32_t(buf, 0, time_boot_ms);
228  _mav_put_int16_t(buf, 4, airspeed_imu);
229  _mav_put_int16_t(buf, 6, airspeed_pitot);
230  _mav_put_int16_t(buf, 8, airspeed_hot_wire);
231  _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
232  _mav_put_int16_t(buf, 12, aoa);
233  _mav_put_int16_t(buf, 14, aoy);
234 
235 #if MAVLINK_CRC_EXTRA
236  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
239 #endif
240 #else
241  mavlink_airspeeds_t *packet = (mavlink_airspeeds_t *)msgbuf;
242  packet->time_boot_ms = time_boot_ms;
243  packet->airspeed_imu = airspeed_imu;
244  packet->airspeed_pitot = airspeed_pitot;
245  packet->airspeed_hot_wire = airspeed_hot_wire;
246  packet->airspeed_ultrasonic = airspeed_ultrasonic;
247  packet->aoa = aoa;
248  packet->aoy = aoy;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE AIRSPEEDS UNPACKING
262 
263 
269 static inline uint32_t mavlink_msg_airspeeds_get_time_boot_ms(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint32_t(msg, 0);
272 }
273 
279 static inline int16_t mavlink_msg_airspeeds_get_airspeed_imu(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_int16_t(msg, 4);
282 }
283 
289 static inline int16_t mavlink_msg_airspeeds_get_airspeed_pitot(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_int16_t(msg, 6);
292 }
293 
299 static inline int16_t mavlink_msg_airspeeds_get_airspeed_hot_wire(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_int16_t(msg, 8);
302 }
303 
309 static inline int16_t mavlink_msg_airspeeds_get_airspeed_ultrasonic(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_int16_t(msg, 10);
312 }
313 
319 static inline int16_t mavlink_msg_airspeeds_get_aoa(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_int16_t(msg, 12);
322 }
323 
329 static inline int16_t mavlink_msg_airspeeds_get_aoy(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_int16_t(msg, 14);
332 }
333 
340 static inline void mavlink_msg_airspeeds_decode(const mavlink_message_t* msg, mavlink_airspeeds_t* airspeeds)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  airspeeds->time_boot_ms = mavlink_msg_airspeeds_get_time_boot_ms(msg);
344  airspeeds->airspeed_imu = mavlink_msg_airspeeds_get_airspeed_imu(msg);
345  airspeeds->airspeed_pitot = mavlink_msg_airspeeds_get_airspeed_pitot(msg);
346  airspeeds->airspeed_hot_wire = mavlink_msg_airspeeds_get_airspeed_hot_wire(msg);
347  airspeeds->airspeed_ultrasonic = mavlink_msg_airspeeds_get_airspeed_ultrasonic(msg);
348  airspeeds->aoa = mavlink_msg_airspeeds_get_aoa(msg);
349  airspeeds->aoy = mavlink_msg_airspeeds_get_aoy(msg);
350 #else
351  memcpy(airspeeds, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_AIRSPEEDS_LEN);
352 #endif
353 }
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141