NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_rc_channels_override.h
Go to the documentation of this file.
1 // MESSAGE RC_CHANNELS_OVERRIDE PACKING
2 
3 #define MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE 70
4 
6 {
7  uint16_t chan1_raw;
8  uint16_t chan2_raw;
9  uint16_t chan3_raw;
10  uint16_t chan4_raw;
11  uint16_t chan5_raw;
12  uint16_t chan6_raw;
13  uint16_t chan7_raw;
14  uint16_t chan8_raw;
15  uint8_t target_system;
16  uint8_t target_component;
18 
19 #define MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN 18
20 #define MAVLINK_MSG_ID_70_LEN 18
21 
22 #define MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_CRC 124
23 #define MAVLINK_MSG_ID_70_CRC 124
24 
25 
26 
27 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE { \
28  "RC_CHANNELS_OVERRIDE", \
29  10, \
30  { { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_rc_channels_override_t, chan1_raw) }, \
31  { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_rc_channels_override_t, chan2_raw) }, \
32  { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_override_t, chan3_raw) }, \
33  { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_override_t, chan4_raw) }, \
34  { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_override_t, chan5_raw) }, \
35  { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_override_t, chan6_raw) }, \
36  { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_override_t, chan7_raw) }, \
37  { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_override_t, chan8_raw) }, \
38  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_rc_channels_override_t, target_system) }, \
39  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_rc_channels_override_t, target_component) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_rc_channels_override_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  uint8_t target_system, uint8_t target_component, 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)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67  _mav_put_uint16_t(buf, 0, chan1_raw);
68  _mav_put_uint16_t(buf, 2, chan2_raw);
69  _mav_put_uint16_t(buf, 4, chan3_raw);
70  _mav_put_uint16_t(buf, 6, chan4_raw);
71  _mav_put_uint16_t(buf, 8, chan5_raw);
72  _mav_put_uint16_t(buf, 10, chan6_raw);
73  _mav_put_uint16_t(buf, 12, chan7_raw);
74  _mav_put_uint16_t(buf, 14, chan8_raw);
75  _mav_put_uint8_t(buf, 16, target_system);
76  _mav_put_uint8_t(buf, 17, target_component);
77 
79 #else
81  packet.chan1_raw = chan1_raw;
82  packet.chan2_raw = chan2_raw;
83  packet.chan3_raw = chan3_raw;
84  packet.chan4_raw = chan4_raw;
85  packet.chan5_raw = chan5_raw;
86  packet.chan6_raw = chan6_raw;
87  packet.chan7_raw = chan7_raw;
88  packet.chan8_raw = chan8_raw;
89  packet.target_system = target_system;
90  packet.target_component = target_component;
91 
93 #endif
94 
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
100 #endif
101 }
102 
121 static inline uint16_t mavlink_msg_rc_channels_override_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
122  mavlink_message_t* msg,
123  uint8_t target_system,uint8_t target_component,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)
124 {
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
127  _mav_put_uint16_t(buf, 0, chan1_raw);
128  _mav_put_uint16_t(buf, 2, chan2_raw);
129  _mav_put_uint16_t(buf, 4, chan3_raw);
130  _mav_put_uint16_t(buf, 6, chan4_raw);
131  _mav_put_uint16_t(buf, 8, chan5_raw);
132  _mav_put_uint16_t(buf, 10, chan6_raw);
133  _mav_put_uint16_t(buf, 12, chan7_raw);
134  _mav_put_uint16_t(buf, 14, chan8_raw);
135  _mav_put_uint8_t(buf, 16, target_system);
136  _mav_put_uint8_t(buf, 17, target_component);
137 
139 #else
141  packet.chan1_raw = chan1_raw;
142  packet.chan2_raw = chan2_raw;
143  packet.chan3_raw = chan3_raw;
144  packet.chan4_raw = chan4_raw;
145  packet.chan5_raw = chan5_raw;
146  packet.chan6_raw = chan6_raw;
147  packet.chan7_raw = chan7_raw;
148  packet.chan8_raw = chan8_raw;
149  packet.target_system = target_system;
150  packet.target_component = target_component;
151 
153 #endif
154 
156 #if MAVLINK_CRC_EXTRA
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_rc_channels_override_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rc_channels_override_t* rc_channels_override)
172 {
173  return mavlink_msg_rc_channels_override_pack(system_id, component_id, msg, rc_channels_override->target_system, rc_channels_override->target_component, rc_channels_override->chan1_raw, rc_channels_override->chan2_raw, rc_channels_override->chan3_raw, rc_channels_override->chan4_raw, rc_channels_override->chan5_raw, rc_channels_override->chan6_raw, rc_channels_override->chan7_raw, rc_channels_override->chan8_raw);
174 }
175 
185 static inline uint16_t mavlink_msg_rc_channels_override_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rc_channels_override_t* rc_channels_override)
186 {
187  return mavlink_msg_rc_channels_override_pack_chan(system_id, component_id, chan, msg, rc_channels_override->target_system, rc_channels_override->target_component, rc_channels_override->chan1_raw, rc_channels_override->chan2_raw, rc_channels_override->chan3_raw, rc_channels_override->chan4_raw, rc_channels_override->chan5_raw, rc_channels_override->chan6_raw, rc_channels_override->chan7_raw, rc_channels_override->chan8_raw);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_rc_channels_override_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, 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)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211  _mav_put_uint16_t(buf, 0, chan1_raw);
212  _mav_put_uint16_t(buf, 2, chan2_raw);
213  _mav_put_uint16_t(buf, 4, chan3_raw);
214  _mav_put_uint16_t(buf, 6, chan4_raw);
215  _mav_put_uint16_t(buf, 8, chan5_raw);
216  _mav_put_uint16_t(buf, 10, chan6_raw);
217  _mav_put_uint16_t(buf, 12, chan7_raw);
218  _mav_put_uint16_t(buf, 14, chan8_raw);
219  _mav_put_uint8_t(buf, 16, target_system);
220  _mav_put_uint8_t(buf, 17, target_component);
221 
222 #if MAVLINK_CRC_EXTRA
224 #else
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, buf, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
226 #endif
227 #else
229  packet.chan1_raw = chan1_raw;
230  packet.chan2_raw = chan2_raw;
231  packet.chan3_raw = chan3_raw;
232  packet.chan4_raw = chan4_raw;
233  packet.chan5_raw = chan5_raw;
234  packet.chan6_raw = chan6_raw;
235  packet.chan7_raw = chan7_raw;
236  packet.chan8_raw = chan8_raw;
237  packet.target_system = target_system;
238  packet.target_component = target_component;
239 
240 #if MAVLINK_CRC_EXTRA
242 #else
243  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
244 #endif
245 #endif
246 }
247 
248 #if MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
249 /*
250  This varient of _send() can be used to save stack space by re-using
251  memory from the receive buffer. The caller provides a
252  mavlink_message_t which is the size of a full mavlink message. This
253  is usually the receive buffer for the channel, and allows a reply to an
254  incoming message with minimum stack space usage.
255  */
256 static inline void mavlink_msg_rc_channels_override_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, 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)
257 {
258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259  char *buf = (char *)msgbuf;
260  _mav_put_uint16_t(buf, 0, chan1_raw);
261  _mav_put_uint16_t(buf, 2, chan2_raw);
262  _mav_put_uint16_t(buf, 4, chan3_raw);
263  _mav_put_uint16_t(buf, 6, chan4_raw);
264  _mav_put_uint16_t(buf, 8, chan5_raw);
265  _mav_put_uint16_t(buf, 10, chan6_raw);
266  _mav_put_uint16_t(buf, 12, chan7_raw);
267  _mav_put_uint16_t(buf, 14, chan8_raw);
268  _mav_put_uint8_t(buf, 16, target_system);
269  _mav_put_uint8_t(buf, 17, target_component);
270 
271 #if MAVLINK_CRC_EXTRA
273 #else
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, buf, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
275 #endif
276 #else
278  packet->chan1_raw = chan1_raw;
279  packet->chan2_raw = chan2_raw;
280  packet->chan3_raw = chan3_raw;
281  packet->chan4_raw = chan4_raw;
282  packet->chan5_raw = chan5_raw;
283  packet->chan6_raw = chan6_raw;
284  packet->chan7_raw = chan7_raw;
285  packet->chan8_raw = chan8_raw;
286  packet->target_system = target_system;
287  packet->target_component = target_component;
288 
289 #if MAVLINK_CRC_EXTRA
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
293 #endif
294 #endif
295 }
296 #endif
297 
298 #endif
299 
300 // MESSAGE RC_CHANNELS_OVERRIDE UNPACKING
301 
302 
308 static inline uint8_t mavlink_msg_rc_channels_override_get_target_system(const mavlink_message_t* msg)
309 {
310  return _MAV_RETURN_uint8_t(msg, 16);
311 }
312 
318 static inline uint8_t mavlink_msg_rc_channels_override_get_target_component(const mavlink_message_t* msg)
319 {
320  return _MAV_RETURN_uint8_t(msg, 17);
321 }
322 
328 static inline uint16_t mavlink_msg_rc_channels_override_get_chan1_raw(const mavlink_message_t* msg)
329 {
330  return _MAV_RETURN_uint16_t(msg, 0);
331 }
332 
338 static inline uint16_t mavlink_msg_rc_channels_override_get_chan2_raw(const mavlink_message_t* msg)
339 {
340  return _MAV_RETURN_uint16_t(msg, 2);
341 }
342 
348 static inline uint16_t mavlink_msg_rc_channels_override_get_chan3_raw(const mavlink_message_t* msg)
349 {
350  return _MAV_RETURN_uint16_t(msg, 4);
351 }
352 
358 static inline uint16_t mavlink_msg_rc_channels_override_get_chan4_raw(const mavlink_message_t* msg)
359 {
360  return _MAV_RETURN_uint16_t(msg, 6);
361 }
362 
368 static inline uint16_t mavlink_msg_rc_channels_override_get_chan5_raw(const mavlink_message_t* msg)
369 {
370  return _MAV_RETURN_uint16_t(msg, 8);
371 }
372 
378 static inline uint16_t mavlink_msg_rc_channels_override_get_chan6_raw(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_uint16_t(msg, 10);
381 }
382 
388 static inline uint16_t mavlink_msg_rc_channels_override_get_chan7_raw(const mavlink_message_t* msg)
389 {
390  return _MAV_RETURN_uint16_t(msg, 12);
391 }
392 
398 static inline uint16_t mavlink_msg_rc_channels_override_get_chan8_raw(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_uint16_t(msg, 14);
401 }
402 
409 static inline void mavlink_msg_rc_channels_override_decode(const mavlink_message_t* msg, mavlink_rc_channels_override_t* rc_channels_override)
410 {
411 #if MAVLINK_NEED_BYTE_SWAP
412  rc_channels_override->chan1_raw = mavlink_msg_rc_channels_override_get_chan1_raw(msg);
413  rc_channels_override->chan2_raw = mavlink_msg_rc_channels_override_get_chan2_raw(msg);
414  rc_channels_override->chan3_raw = mavlink_msg_rc_channels_override_get_chan3_raw(msg);
415  rc_channels_override->chan4_raw = mavlink_msg_rc_channels_override_get_chan4_raw(msg);
416  rc_channels_override->chan5_raw = mavlink_msg_rc_channels_override_get_chan5_raw(msg);
417  rc_channels_override->chan6_raw = mavlink_msg_rc_channels_override_get_chan6_raw(msg);
418  rc_channels_override->chan7_raw = mavlink_msg_rc_channels_override_get_chan7_raw(msg);
419  rc_channels_override->chan8_raw = mavlink_msg_rc_channels_override_get_chan8_raw(msg);
420  rc_channels_override->target_system = mavlink_msg_rc_channels_override_get_target_system(msg);
421  rc_channels_override->target_component = mavlink_msg_rc_channels_override_get_target_component(msg);
422 #else
423  memcpy(rc_channels_override, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN);
424 #endif
425 }
#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