Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_rc_channels_override.h
blob6e41b75e3e365a2b72f8a2b8c3690a5d34b0849f
1 // MESSAGE RC_CHANNELS_OVERRIDE PACKING
3 #define MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE 70
5 typedef struct __mavlink_rc_channels_override_t {
6 uint16_t chan1_raw; ///< RC channel 1 value, in microseconds
7 uint16_t chan2_raw; ///< RC channel 2 value, in microseconds
8 uint16_t chan3_raw; ///< RC channel 3 value, in microseconds
9 uint16_t chan4_raw; ///< RC channel 4 value, in microseconds
10 uint16_t chan5_raw; ///< RC channel 5 value, in microseconds
11 uint16_t chan6_raw; ///< RC channel 6 value, in microseconds
12 uint16_t chan7_raw; ///< RC channel 7 value, in microseconds
13 uint16_t chan8_raw; ///< RC channel 8 value, in microseconds
14 uint8_t target_system; ///< System ID
15 uint8_t target_component; ///< Component ID
16 } mavlink_rc_channels_override_t;
18 #define MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN 18
19 #define MAVLINK_MSG_ID_70_LEN 18
22 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE \
23 { \
24 "RC_CHANNELS_OVERRIDE", \
25 10, \
26 { \
27 { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_rc_channels_override_t, chan1_raw) }, \
28 { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_rc_channels_override_t, chan2_raw) }, \
29 { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_override_t, chan3_raw) }, \
30 { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_override_t, chan4_raw) }, \
31 { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_override_t, chan5_raw) }, \
32 { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_override_t, chan6_raw) }, \
33 { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_override_t, chan7_raw) }, \
34 { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_override_t, chan8_raw) }, \
35 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_rc_channels_override_t, target_system) }, \
36 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_rc_channels_override_t, target_component) }, \
37 } \
41 /**
42 * @brief Pack a rc_channels_override message
43 * @param system_id ID of this system
44 * @param component_id ID of this component (e.g. 200 for IMU)
45 * @param msg The MAVLink message to compress the data into
47 * @param target_system System ID
48 * @param target_component Component ID
49 * @param chan1_raw RC channel 1 value, in microseconds
50 * @param chan2_raw RC channel 2 value, in microseconds
51 * @param chan3_raw RC channel 3 value, in microseconds
52 * @param chan4_raw RC channel 4 value, in microseconds
53 * @param chan5_raw RC channel 5 value, in microseconds
54 * @param chan6_raw RC channel 6 value, in microseconds
55 * @param chan7_raw RC channel 7 value, in microseconds
56 * @param chan8_raw RC channel 8 value, in microseconds
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_rc_channels_override_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
60 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)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf[18];
64 _mav_put_uint16_t(buf, 0, chan1_raw);
65 _mav_put_uint16_t(buf, 2, chan2_raw);
66 _mav_put_uint16_t(buf, 4, chan3_raw);
67 _mav_put_uint16_t(buf, 6, chan4_raw);
68 _mav_put_uint16_t(buf, 8, chan5_raw);
69 _mav_put_uint16_t(buf, 10, chan6_raw);
70 _mav_put_uint16_t(buf, 12, chan7_raw);
71 _mav_put_uint16_t(buf, 14, chan8_raw);
72 _mav_put_uint8_t(buf, 16, target_system);
73 _mav_put_uint8_t(buf, 17, target_component);
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 18);
76 #else
77 mavlink_rc_channels_override_t packet;
78 packet.chan1_raw = chan1_raw;
79 packet.chan2_raw = chan2_raw;
80 packet.chan3_raw = chan3_raw;
81 packet.chan4_raw = chan4_raw;
82 packet.chan5_raw = chan5_raw;
83 packet.chan6_raw = chan6_raw;
84 packet.chan7_raw = chan7_raw;
85 packet.chan8_raw = chan8_raw;
86 packet.target_system = target_system;
87 packet.target_component = target_component;
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 18);
90 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE;
93 return mavlink_finalize_message(msg, system_id, component_id, 18, 124);
96 /**
97 * @brief Pack a rc_channels_override message on a channel
98 * @param system_id ID of this system
99 * @param component_id ID of this component (e.g. 200 for IMU)
100 * @param chan The MAVLink channel this message was sent over
101 * @param msg The MAVLink message to compress the data into
102 * @param target_system System ID
103 * @param target_component Component ID
104 * @param chan1_raw RC channel 1 value, in microseconds
105 * @param chan2_raw RC channel 2 value, in microseconds
106 * @param chan3_raw RC channel 3 value, in microseconds
107 * @param chan4_raw RC channel 4 value, in microseconds
108 * @param chan5_raw RC channel 5 value, in microseconds
109 * @param chan6_raw RC channel 6 value, in microseconds
110 * @param chan7_raw RC channel 7 value, in microseconds
111 * @param chan8_raw RC channel 8 value, in microseconds
112 * @return length of the message in bytes (excluding serial stream start sign)
114 static inline uint16_t mavlink_msg_rc_channels_override_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
115 mavlink_message_t *msg,
116 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)
118 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119 char buf[18];
120 _mav_put_uint16_t(buf, 0, chan1_raw);
121 _mav_put_uint16_t(buf, 2, chan2_raw);
122 _mav_put_uint16_t(buf, 4, chan3_raw);
123 _mav_put_uint16_t(buf, 6, chan4_raw);
124 _mav_put_uint16_t(buf, 8, chan5_raw);
125 _mav_put_uint16_t(buf, 10, chan6_raw);
126 _mav_put_uint16_t(buf, 12, chan7_raw);
127 _mav_put_uint16_t(buf, 14, chan8_raw);
128 _mav_put_uint8_t(buf, 16, target_system);
129 _mav_put_uint8_t(buf, 17, target_component);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 18);
132 #else
133 mavlink_rc_channels_override_t packet;
134 packet.chan1_raw = chan1_raw;
135 packet.chan2_raw = chan2_raw;
136 packet.chan3_raw = chan3_raw;
137 packet.chan4_raw = chan4_raw;
138 packet.chan5_raw = chan5_raw;
139 packet.chan6_raw = chan6_raw;
140 packet.chan7_raw = chan7_raw;
141 packet.chan8_raw = chan8_raw;
142 packet.target_system = target_system;
143 packet.target_component = target_component;
145 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 18);
146 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
148 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE;
149 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 18, 124);
153 * @brief Encode a rc_channels_override struct into a message
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param msg The MAVLink message to compress the data into
158 * @param rc_channels_override C-struct to read the message contents from
160 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)
162 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);
166 * @brief Send a rc_channels_override message
167 * @param chan MAVLink channel to send the message
169 * @param target_system System ID
170 * @param target_component Component ID
171 * @param chan1_raw RC channel 1 value, in microseconds
172 * @param chan2_raw RC channel 2 value, in microseconds
173 * @param chan3_raw RC channel 3 value, in microseconds
174 * @param chan4_raw RC channel 4 value, in microseconds
175 * @param chan5_raw RC channel 5 value, in microseconds
176 * @param chan6_raw RC channel 6 value, in microseconds
177 * @param chan7_raw RC channel 7 value, in microseconds
178 * @param chan8_raw RC channel 8 value, in microseconds
180 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
182 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)
184 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
185 char buf[18];
186 _mav_put_uint16_t(buf, 0, chan1_raw);
187 _mav_put_uint16_t(buf, 2, chan2_raw);
188 _mav_put_uint16_t(buf, 4, chan3_raw);
189 _mav_put_uint16_t(buf, 6, chan4_raw);
190 _mav_put_uint16_t(buf, 8, chan5_raw);
191 _mav_put_uint16_t(buf, 10, chan6_raw);
192 _mav_put_uint16_t(buf, 12, chan7_raw);
193 _mav_put_uint16_t(buf, 14, chan8_raw);
194 _mav_put_uint8_t(buf, 16, target_system);
195 _mav_put_uint8_t(buf, 17, target_component);
197 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, buf, 18, 124);
198 #else
199 mavlink_rc_channels_override_t packet;
200 packet.chan1_raw = chan1_raw;
201 packet.chan2_raw = chan2_raw;
202 packet.chan3_raw = chan3_raw;
203 packet.chan4_raw = chan4_raw;
204 packet.chan5_raw = chan5_raw;
205 packet.chan6_raw = chan6_raw;
206 packet.chan7_raw = chan7_raw;
207 packet.chan8_raw = chan8_raw;
208 packet.target_system = target_system;
209 packet.target_component = target_component;
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, (const char *)&packet, 18, 124);
212 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
215 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
217 // MESSAGE RC_CHANNELS_OVERRIDE UNPACKING
221 * @brief Get field target_system from rc_channels_override message
223 * @return System ID
225 static inline uint8_t mavlink_msg_rc_channels_override_get_target_system(const mavlink_message_t *msg)
227 return _MAV_RETURN_uint8_t(msg, 16);
231 * @brief Get field target_component from rc_channels_override message
233 * @return Component ID
235 static inline uint8_t mavlink_msg_rc_channels_override_get_target_component(const mavlink_message_t *msg)
237 return _MAV_RETURN_uint8_t(msg, 17);
241 * @brief Get field chan1_raw from rc_channels_override message
243 * @return RC channel 1 value, in microseconds
245 static inline uint16_t mavlink_msg_rc_channels_override_get_chan1_raw(const mavlink_message_t *msg)
247 return _MAV_RETURN_uint16_t(msg, 0);
251 * @brief Get field chan2_raw from rc_channels_override message
253 * @return RC channel 2 value, in microseconds
255 static inline uint16_t mavlink_msg_rc_channels_override_get_chan2_raw(const mavlink_message_t *msg)
257 return _MAV_RETURN_uint16_t(msg, 2);
261 * @brief Get field chan3_raw from rc_channels_override message
263 * @return RC channel 3 value, in microseconds
265 static inline uint16_t mavlink_msg_rc_channels_override_get_chan3_raw(const mavlink_message_t *msg)
267 return _MAV_RETURN_uint16_t(msg, 4);
271 * @brief Get field chan4_raw from rc_channels_override message
273 * @return RC channel 4 value, in microseconds
275 static inline uint16_t mavlink_msg_rc_channels_override_get_chan4_raw(const mavlink_message_t *msg)
277 return _MAV_RETURN_uint16_t(msg, 6);
281 * @brief Get field chan5_raw from rc_channels_override message
283 * @return RC channel 5 value, in microseconds
285 static inline uint16_t mavlink_msg_rc_channels_override_get_chan5_raw(const mavlink_message_t *msg)
287 return _MAV_RETURN_uint16_t(msg, 8);
291 * @brief Get field chan6_raw from rc_channels_override message
293 * @return RC channel 6 value, in microseconds
295 static inline uint16_t mavlink_msg_rc_channels_override_get_chan6_raw(const mavlink_message_t *msg)
297 return _MAV_RETURN_uint16_t(msg, 10);
301 * @brief Get field chan7_raw from rc_channels_override message
303 * @return RC channel 7 value, in microseconds
305 static inline uint16_t mavlink_msg_rc_channels_override_get_chan7_raw(const mavlink_message_t *msg)
307 return _MAV_RETURN_uint16_t(msg, 12);
311 * @brief Get field chan8_raw from rc_channels_override message
313 * @return RC channel 8 value, in microseconds
315 static inline uint16_t mavlink_msg_rc_channels_override_get_chan8_raw(const mavlink_message_t *msg)
317 return _MAV_RETURN_uint16_t(msg, 14);
321 * @brief Decode a rc_channels_override message into a struct
323 * @param msg The message to decode
324 * @param rc_channels_override C-struct to decode the message contents into
326 static inline void mavlink_msg_rc_channels_override_decode(const mavlink_message_t *msg, mavlink_rc_channels_override_t *rc_channels_override)
328 #if MAVLINK_NEED_BYTE_SWAP
329 rc_channels_override->chan1_raw = mavlink_msg_rc_channels_override_get_chan1_raw(msg);
330 rc_channels_override->chan2_raw = mavlink_msg_rc_channels_override_get_chan2_raw(msg);
331 rc_channels_override->chan3_raw = mavlink_msg_rc_channels_override_get_chan3_raw(msg);
332 rc_channels_override->chan4_raw = mavlink_msg_rc_channels_override_get_chan4_raw(msg);
333 rc_channels_override->chan5_raw = mavlink_msg_rc_channels_override_get_chan5_raw(msg);
334 rc_channels_override->chan6_raw = mavlink_msg_rc_channels_override_get_chan6_raw(msg);
335 rc_channels_override->chan7_raw = mavlink_msg_rc_channels_override_get_chan7_raw(msg);
336 rc_channels_override->chan8_raw = mavlink_msg_rc_channels_override_get_chan8_raw(msg);
337 rc_channels_override->target_system = mavlink_msg_rc_channels_override_get_target_system(msg);
338 rc_channels_override->target_component = mavlink_msg_rc_channels_override_get_target_component(msg);
339 #else
340 memcpy(rc_channels_override, _MAV_PAYLOAD(msg), 18);
341 #endif