NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_rc_channels_raw.h
Go to the documentation of this file.
1 // MESSAGE RC_CHANNELS_RAW PACKING
2 
3 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW 35
4 
6 {
7  uint32_t time_boot_ms;
8  uint16_t chan1_raw;
9  uint16_t chan2_raw;
10  uint16_t chan3_raw;
11  uint16_t chan4_raw;
12  uint16_t chan5_raw;
13  uint16_t chan6_raw;
14  uint16_t chan7_raw;
15  uint16_t chan8_raw;
16  uint8_t port;
17  uint8_t rssi;
19 
20 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN 22
21 #define MAVLINK_MSG_ID_35_LEN 22
22 
23 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC 244
24 #define MAVLINK_MSG_ID_35_CRC 244
25 
26 
27 
28 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW { \
29  "RC_CHANNELS_RAW", \
30  11, \
31  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_raw_t, time_boot_ms) }, \
32  { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_raw_t, chan1_raw) }, \
33  { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_raw_t, chan2_raw) }, \
34  { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_raw_t, chan3_raw) }, \
35  { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_raw_t, chan4_raw) }, \
36  { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_raw_t, chan5_raw) }, \
37  { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_raw_t, chan6_raw) }, \
38  { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_raw_t, chan7_raw) }, \
39  { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_raw_t, chan8_raw) }, \
40  { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_raw_t, port) }, \
41  { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_raw_t, rssi) }, \
42  } \
43 }
44 
45 
65 static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66  uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
67 {
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70  _mav_put_uint32_t(buf, 0, time_boot_ms);
71  _mav_put_uint16_t(buf, 4, chan1_raw);
72  _mav_put_uint16_t(buf, 6, chan2_raw);
73  _mav_put_uint16_t(buf, 8, chan3_raw);
74  _mav_put_uint16_t(buf, 10, chan4_raw);
75  _mav_put_uint16_t(buf, 12, chan5_raw);
76  _mav_put_uint16_t(buf, 14, chan6_raw);
77  _mav_put_uint16_t(buf, 16, chan7_raw);
78  _mav_put_uint16_t(buf, 18, chan8_raw);
79  _mav_put_uint8_t(buf, 20, port);
80  _mav_put_uint8_t(buf, 21, rssi);
81 
83 #else
85  packet.time_boot_ms = time_boot_ms;
86  packet.chan1_raw = chan1_raw;
87  packet.chan2_raw = chan2_raw;
88  packet.chan3_raw = chan3_raw;
89  packet.chan4_raw = chan4_raw;
90  packet.chan5_raw = chan5_raw;
91  packet.chan6_raw = chan6_raw;
92  packet.chan7_raw = chan7_raw;
93  packet.chan8_raw = chan8_raw;
94  packet.port = port;
95  packet.rssi = rssi;
96 
98 #endif
99 
100  msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
101 #if MAVLINK_CRC_EXTRA
103 #else
104  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
105 #endif
106 }
107 
127 static inline uint16_t mavlink_msg_rc_channels_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
128  mavlink_message_t* msg,
129  uint32_t time_boot_ms,uint8_t port,uint16_t chan1_raw,uint16_t chan2_raw,uint16_t chan3_raw,uint16_t chan4_raw,uint16_t chan5_raw,uint16_t chan6_raw,uint16_t chan7_raw,uint16_t chan8_raw,uint8_t rssi)
130 {
131 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
133  _mav_put_uint32_t(buf, 0, time_boot_ms);
134  _mav_put_uint16_t(buf, 4, chan1_raw);
135  _mav_put_uint16_t(buf, 6, chan2_raw);
136  _mav_put_uint16_t(buf, 8, chan3_raw);
137  _mav_put_uint16_t(buf, 10, chan4_raw);
138  _mav_put_uint16_t(buf, 12, chan5_raw);
139  _mav_put_uint16_t(buf, 14, chan6_raw);
140  _mav_put_uint16_t(buf, 16, chan7_raw);
141  _mav_put_uint16_t(buf, 18, chan8_raw);
142  _mav_put_uint8_t(buf, 20, port);
143  _mav_put_uint8_t(buf, 21, rssi);
144 
146 #else
148  packet.time_boot_ms = time_boot_ms;
149  packet.chan1_raw = chan1_raw;
150  packet.chan2_raw = chan2_raw;
151  packet.chan3_raw = chan3_raw;
152  packet.chan4_raw = chan4_raw;
153  packet.chan5_raw = chan5_raw;
154  packet.chan6_raw = chan6_raw;
155  packet.chan7_raw = chan7_raw;
156  packet.chan8_raw = chan8_raw;
157  packet.port = port;
158  packet.rssi = rssi;
159 
161 #endif
162 
163  msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
164 #if MAVLINK_CRC_EXTRA
166 #else
167  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
168 #endif
169 }
170 
179 static inline uint16_t mavlink_msg_rc_channels_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rc_channels_raw_t* rc_channels_raw)
180 {
181  return mavlink_msg_rc_channels_raw_pack(system_id, component_id, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi);
182 }
183 
193 static inline uint16_t mavlink_msg_rc_channels_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rc_channels_raw_t* rc_channels_raw)
194 {
195  return mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, chan, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi);
196 }
197 
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
215 
216 static inline void mavlink_msg_rc_channels_raw_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
217 {
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
220  _mav_put_uint32_t(buf, 0, time_boot_ms);
221  _mav_put_uint16_t(buf, 4, chan1_raw);
222  _mav_put_uint16_t(buf, 6, chan2_raw);
223  _mav_put_uint16_t(buf, 8, chan3_raw);
224  _mav_put_uint16_t(buf, 10, chan4_raw);
225  _mav_put_uint16_t(buf, 12, chan5_raw);
226  _mav_put_uint16_t(buf, 14, chan6_raw);
227  _mav_put_uint16_t(buf, 16, chan7_raw);
228  _mav_put_uint16_t(buf, 18, chan8_raw);
229  _mav_put_uint8_t(buf, 20, port);
230  _mav_put_uint8_t(buf, 21, rssi);
231 
232 #if MAVLINK_CRC_EXTRA
234 #else
235  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
236 #endif
237 #else
239  packet.time_boot_ms = time_boot_ms;
240  packet.chan1_raw = chan1_raw;
241  packet.chan2_raw = chan2_raw;
242  packet.chan3_raw = chan3_raw;
243  packet.chan4_raw = chan4_raw;
244  packet.chan5_raw = chan5_raw;
245  packet.chan6_raw = chan6_raw;
246  packet.chan7_raw = chan7_raw;
247  packet.chan8_raw = chan8_raw;
248  packet.port = port;
249  packet.rssi = rssi;
250 
251 #if MAVLINK_CRC_EXTRA
252  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
253 #else
254  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
255 #endif
256 #endif
257 }
258 
259 #if MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
260 /*
261  This varient of _send() can be used to save stack space by re-using
262  memory from the receive buffer. The caller provides a
263  mavlink_message_t which is the size of a full mavlink message. This
264  is usually the receive buffer for the channel, and allows a reply to an
265  incoming message with minimum stack space usage.
266  */
267 static inline void mavlink_msg_rc_channels_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
268 {
269 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270  char *buf = (char *)msgbuf;
271  _mav_put_uint32_t(buf, 0, time_boot_ms);
272  _mav_put_uint16_t(buf, 4, chan1_raw);
273  _mav_put_uint16_t(buf, 6, chan2_raw);
274  _mav_put_uint16_t(buf, 8, chan3_raw);
275  _mav_put_uint16_t(buf, 10, chan4_raw);
276  _mav_put_uint16_t(buf, 12, chan5_raw);
277  _mav_put_uint16_t(buf, 14, chan6_raw);
278  _mav_put_uint16_t(buf, 16, chan7_raw);
279  _mav_put_uint16_t(buf, 18, chan8_raw);
280  _mav_put_uint8_t(buf, 20, port);
281  _mav_put_uint8_t(buf, 21, rssi);
282 
283 #if MAVLINK_CRC_EXTRA
285 #else
286  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
287 #endif
288 #else
290  packet->time_boot_ms = time_boot_ms;
291  packet->chan1_raw = chan1_raw;
292  packet->chan2_raw = chan2_raw;
293  packet->chan3_raw = chan3_raw;
294  packet->chan4_raw = chan4_raw;
295  packet->chan5_raw = chan5_raw;
296  packet->chan6_raw = chan6_raw;
297  packet->chan7_raw = chan7_raw;
298  packet->chan8_raw = chan8_raw;
299  packet->port = port;
300  packet->rssi = rssi;
301 
302 #if MAVLINK_CRC_EXTRA
303  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
304 #else
305  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
306 #endif
307 #endif
308 }
309 #endif
310 
311 #endif
312 
313 // MESSAGE RC_CHANNELS_RAW UNPACKING
314 
315 
321 static inline uint32_t mavlink_msg_rc_channels_raw_get_time_boot_ms(const mavlink_message_t* msg)
322 {
323  return _MAV_RETURN_uint32_t(msg, 0);
324 }
325 
331 static inline uint8_t mavlink_msg_rc_channels_raw_get_port(const mavlink_message_t* msg)
332 {
333  return _MAV_RETURN_uint8_t(msg, 20);
334 }
335 
341 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan1_raw(const mavlink_message_t* msg)
342 {
343  return _MAV_RETURN_uint16_t(msg, 4);
344 }
345 
351 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan2_raw(const mavlink_message_t* msg)
352 {
353  return _MAV_RETURN_uint16_t(msg, 6);
354 }
355 
361 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan3_raw(const mavlink_message_t* msg)
362 {
363  return _MAV_RETURN_uint16_t(msg, 8);
364 }
365 
371 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan4_raw(const mavlink_message_t* msg)
372 {
373  return _MAV_RETURN_uint16_t(msg, 10);
374 }
375 
381 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan5_raw(const mavlink_message_t* msg)
382 {
383  return _MAV_RETURN_uint16_t(msg, 12);
384 }
385 
391 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan6_raw(const mavlink_message_t* msg)
392 {
393  return _MAV_RETURN_uint16_t(msg, 14);
394 }
395 
401 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan7_raw(const mavlink_message_t* msg)
402 {
403  return _MAV_RETURN_uint16_t(msg, 16);
404 }
405 
411 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan8_raw(const mavlink_message_t* msg)
412 {
413  return _MAV_RETURN_uint16_t(msg, 18);
414 }
415 
421 static inline uint8_t mavlink_msg_rc_channels_raw_get_rssi(const mavlink_message_t* msg)
422 {
423  return _MAV_RETURN_uint8_t(msg, 21);
424 }
425 
432 static inline void mavlink_msg_rc_channels_raw_decode(const mavlink_message_t* msg, mavlink_rc_channels_raw_t* rc_channels_raw)
433 {
434 #if MAVLINK_NEED_BYTE_SWAP
435  rc_channels_raw->time_boot_ms = mavlink_msg_rc_channels_raw_get_time_boot_ms(msg);
436  rc_channels_raw->chan1_raw = mavlink_msg_rc_channels_raw_get_chan1_raw(msg);
437  rc_channels_raw->chan2_raw = mavlink_msg_rc_channels_raw_get_chan2_raw(msg);
438  rc_channels_raw->chan3_raw = mavlink_msg_rc_channels_raw_get_chan3_raw(msg);
439  rc_channels_raw->chan4_raw = mavlink_msg_rc_channels_raw_get_chan4_raw(msg);
440  rc_channels_raw->chan5_raw = mavlink_msg_rc_channels_raw_get_chan5_raw(msg);
441  rc_channels_raw->chan6_raw = mavlink_msg_rc_channels_raw_get_chan6_raw(msg);
442  rc_channels_raw->chan7_raw = mavlink_msg_rc_channels_raw_get_chan7_raw(msg);
443  rc_channels_raw->chan8_raw = mavlink_msg_rc_channels_raw_get_chan8_raw(msg);
444  rc_channels_raw->port = mavlink_msg_rc_channels_raw_get_port(msg);
445  rc_channels_raw->rssi = mavlink_msg_rc_channels_raw_get_rssi(msg);
446 #else
447  memcpy(rc_channels_raw, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
448 #endif
449 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141