[GYRO] Refactor gyro driver for dual-gyro support
[inav.git] / lib / main / MAVLink / common / mavlink_msg_rc_channels_raw.h
blob87d1b4a82f79ff5879d9fcc873f57ad5846bf98c
1 #pragma once
2 // MESSAGE RC_CHANNELS_RAW PACKING
4 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW 35
6 MAVPACKED(
7 typedef struct __mavlink_rc_channels_raw_t {
8 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
9 uint16_t chan1_raw; /*< RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
10 uint16_t chan2_raw; /*< RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
11 uint16_t chan3_raw; /*< RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
12 uint16_t chan4_raw; /*< RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
13 uint16_t chan5_raw; /*< RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
14 uint16_t chan6_raw; /*< RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
15 uint16_t chan7_raw; /*< RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
16 uint16_t chan8_raw; /*< RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
17 uint8_t port; /*< Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.*/
18 uint8_t rssi; /*< Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.*/
19 }) mavlink_rc_channels_raw_t;
21 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN 22
22 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN 22
23 #define MAVLINK_MSG_ID_35_LEN 22
24 #define MAVLINK_MSG_ID_35_MIN_LEN 22
26 #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC 244
27 #define MAVLINK_MSG_ID_35_CRC 244
31 #if MAVLINK_COMMAND_24BIT
32 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW { \
33 35, \
34 "RC_CHANNELS_RAW", \
35 11, \
36 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_raw_t, time_boot_ms) }, \
37 { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_raw_t, chan1_raw) }, \
38 { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_raw_t, chan2_raw) }, \
39 { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_raw_t, chan3_raw) }, \
40 { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_raw_t, chan4_raw) }, \
41 { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_raw_t, chan5_raw) }, \
42 { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_raw_t, chan6_raw) }, \
43 { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_raw_t, chan7_raw) }, \
44 { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_raw_t, chan8_raw) }, \
45 { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_raw_t, port) }, \
46 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_raw_t, rssi) }, \
47 } \
49 #else
50 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW { \
51 "RC_CHANNELS_RAW", \
52 11, \
53 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_raw_t, time_boot_ms) }, \
54 { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_raw_t, chan1_raw) }, \
55 { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_raw_t, chan2_raw) }, \
56 { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_raw_t, chan3_raw) }, \
57 { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_raw_t, chan4_raw) }, \
58 { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_raw_t, chan5_raw) }, \
59 { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_raw_t, chan6_raw) }, \
60 { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_raw_t, chan7_raw) }, \
61 { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_raw_t, chan8_raw) }, \
62 { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_raw_t, port) }, \
63 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_raw_t, rssi) }, \
64 } \
66 #endif
68 /**
69 * @brief Pack a rc_channels_raw message
70 * @param system_id ID of this system
71 * @param component_id ID of this component (e.g. 200 for IMU)
72 * @param msg The MAVLink message to compress the data into
74 * @param time_boot_ms Timestamp (milliseconds since system boot)
75 * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
76 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
77 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
78 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
79 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
80 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
81 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
82 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
83 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
84 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
85 * @return length of the message in bytes (excluding serial stream start sign)
87 static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
88 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)
90 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91 char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
92 _mav_put_uint32_t(buf, 0, time_boot_ms);
93 _mav_put_uint16_t(buf, 4, chan1_raw);
94 _mav_put_uint16_t(buf, 6, chan2_raw);
95 _mav_put_uint16_t(buf, 8, chan3_raw);
96 _mav_put_uint16_t(buf, 10, chan4_raw);
97 _mav_put_uint16_t(buf, 12, chan5_raw);
98 _mav_put_uint16_t(buf, 14, chan6_raw);
99 _mav_put_uint16_t(buf, 16, chan7_raw);
100 _mav_put_uint16_t(buf, 18, chan8_raw);
101 _mav_put_uint8_t(buf, 20, port);
102 _mav_put_uint8_t(buf, 21, rssi);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
105 #else
106 mavlink_rc_channels_raw_t packet;
107 packet.time_boot_ms = time_boot_ms;
108 packet.chan1_raw = chan1_raw;
109 packet.chan2_raw = chan2_raw;
110 packet.chan3_raw = chan3_raw;
111 packet.chan4_raw = chan4_raw;
112 packet.chan5_raw = chan5_raw;
113 packet.chan6_raw = chan6_raw;
114 packet.chan7_raw = chan7_raw;
115 packet.chan8_raw = chan8_raw;
116 packet.port = port;
117 packet.rssi = rssi;
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
120 #endif
122 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
123 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
127 * @brief Pack a rc_channels_raw message on a channel
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param chan The MAVLink channel this message will be sent over
131 * @param msg The MAVLink message to compress the data into
132 * @param time_boot_ms Timestamp (milliseconds since system boot)
133 * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
134 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
135 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
136 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
137 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
138 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
139 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
140 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
141 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
142 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
143 * @return length of the message in bytes (excluding serial stream start sign)
145 static inline uint16_t mavlink_msg_rc_channels_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146 mavlink_message_t* msg,
147 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)
149 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
150 char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
151 _mav_put_uint32_t(buf, 0, time_boot_ms);
152 _mav_put_uint16_t(buf, 4, chan1_raw);
153 _mav_put_uint16_t(buf, 6, chan2_raw);
154 _mav_put_uint16_t(buf, 8, chan3_raw);
155 _mav_put_uint16_t(buf, 10, chan4_raw);
156 _mav_put_uint16_t(buf, 12, chan5_raw);
157 _mav_put_uint16_t(buf, 14, chan6_raw);
158 _mav_put_uint16_t(buf, 16, chan7_raw);
159 _mav_put_uint16_t(buf, 18, chan8_raw);
160 _mav_put_uint8_t(buf, 20, port);
161 _mav_put_uint8_t(buf, 21, rssi);
163 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
164 #else
165 mavlink_rc_channels_raw_t packet;
166 packet.time_boot_ms = time_boot_ms;
167 packet.chan1_raw = chan1_raw;
168 packet.chan2_raw = chan2_raw;
169 packet.chan3_raw = chan3_raw;
170 packet.chan4_raw = chan4_raw;
171 packet.chan5_raw = chan5_raw;
172 packet.chan6_raw = chan6_raw;
173 packet.chan7_raw = chan7_raw;
174 packet.chan8_raw = chan8_raw;
175 packet.port = port;
176 packet.rssi = rssi;
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
179 #endif
181 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
182 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
186 * @brief Encode a rc_channels_raw struct
188 * @param system_id ID of this system
189 * @param component_id ID of this component (e.g. 200 for IMU)
190 * @param msg The MAVLink message to compress the data into
191 * @param rc_channels_raw C-struct to read the message contents from
193 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)
195 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);
199 * @brief Encode a rc_channels_raw struct on a channel
201 * @param system_id ID of this system
202 * @param component_id ID of this component (e.g. 200 for IMU)
203 * @param chan The MAVLink channel this message will be sent over
204 * @param msg The MAVLink message to compress the data into
205 * @param rc_channels_raw C-struct to read the message contents from
207 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)
209 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);
213 * @brief Send a rc_channels_raw message
214 * @param chan MAVLink channel to send the message
216 * @param time_boot_ms Timestamp (milliseconds since system boot)
217 * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
218 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
219 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
220 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
221 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
222 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
223 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
224 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
225 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
226 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
228 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
230 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)
232 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
233 char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
234 _mav_put_uint32_t(buf, 0, time_boot_ms);
235 _mav_put_uint16_t(buf, 4, chan1_raw);
236 _mav_put_uint16_t(buf, 6, chan2_raw);
237 _mav_put_uint16_t(buf, 8, chan3_raw);
238 _mav_put_uint16_t(buf, 10, chan4_raw);
239 _mav_put_uint16_t(buf, 12, chan5_raw);
240 _mav_put_uint16_t(buf, 14, chan6_raw);
241 _mav_put_uint16_t(buf, 16, chan7_raw);
242 _mav_put_uint16_t(buf, 18, chan8_raw);
243 _mav_put_uint8_t(buf, 20, port);
244 _mav_put_uint8_t(buf, 21, rssi);
246 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
247 #else
248 mavlink_rc_channels_raw_t packet;
249 packet.time_boot_ms = time_boot_ms;
250 packet.chan1_raw = chan1_raw;
251 packet.chan2_raw = chan2_raw;
252 packet.chan3_raw = chan3_raw;
253 packet.chan4_raw = chan4_raw;
254 packet.chan5_raw = chan5_raw;
255 packet.chan6_raw = chan6_raw;
256 packet.chan7_raw = chan7_raw;
257 packet.chan8_raw = chan8_raw;
258 packet.port = port;
259 packet.rssi = rssi;
261 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
262 #endif
266 * @brief Send a rc_channels_raw message
267 * @param chan MAVLink channel to send the message
268 * @param struct The MAVLink struct to serialize
270 static inline void mavlink_msg_rc_channels_raw_send_struct(mavlink_channel_t chan, const mavlink_rc_channels_raw_t* rc_channels_raw)
272 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
273 mavlink_msg_rc_channels_raw_send(chan, 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);
274 #else
275 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)rc_channels_raw, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
276 #endif
279 #if MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
281 This varient of _send() can be used to save stack space by re-using
282 memory from the receive buffer. The caller provides a
283 mavlink_message_t which is the size of a full mavlink message. This
284 is usually the receive buffer for the channel, and allows a reply to an
285 incoming message with minimum stack space usage.
287 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)
289 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 char *buf = (char *)msgbuf;
291 _mav_put_uint32_t(buf, 0, time_boot_ms);
292 _mav_put_uint16_t(buf, 4, chan1_raw);
293 _mav_put_uint16_t(buf, 6, chan2_raw);
294 _mav_put_uint16_t(buf, 8, chan3_raw);
295 _mav_put_uint16_t(buf, 10, chan4_raw);
296 _mav_put_uint16_t(buf, 12, chan5_raw);
297 _mav_put_uint16_t(buf, 14, chan6_raw);
298 _mav_put_uint16_t(buf, 16, chan7_raw);
299 _mav_put_uint16_t(buf, 18, chan8_raw);
300 _mav_put_uint8_t(buf, 20, port);
301 _mav_put_uint8_t(buf, 21, rssi);
303 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
304 #else
305 mavlink_rc_channels_raw_t *packet = (mavlink_rc_channels_raw_t *)msgbuf;
306 packet->time_boot_ms = time_boot_ms;
307 packet->chan1_raw = chan1_raw;
308 packet->chan2_raw = chan2_raw;
309 packet->chan3_raw = chan3_raw;
310 packet->chan4_raw = chan4_raw;
311 packet->chan5_raw = chan5_raw;
312 packet->chan6_raw = chan6_raw;
313 packet->chan7_raw = chan7_raw;
314 packet->chan8_raw = chan8_raw;
315 packet->port = port;
316 packet->rssi = rssi;
318 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
319 #endif
321 #endif
323 #endif
325 // MESSAGE RC_CHANNELS_RAW UNPACKING
329 * @brief Get field time_boot_ms from rc_channels_raw message
331 * @return Timestamp (milliseconds since system boot)
333 static inline uint32_t mavlink_msg_rc_channels_raw_get_time_boot_ms(const mavlink_message_t* msg)
335 return _MAV_RETURN_uint32_t(msg, 0);
339 * @brief Get field port from rc_channels_raw message
341 * @return Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
343 static inline uint8_t mavlink_msg_rc_channels_raw_get_port(const mavlink_message_t* msg)
345 return _MAV_RETURN_uint8_t(msg, 20);
349 * @brief Get field chan1_raw from rc_channels_raw message
351 * @return RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
353 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan1_raw(const mavlink_message_t* msg)
355 return _MAV_RETURN_uint16_t(msg, 4);
359 * @brief Get field chan2_raw from rc_channels_raw message
361 * @return RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
363 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan2_raw(const mavlink_message_t* msg)
365 return _MAV_RETURN_uint16_t(msg, 6);
369 * @brief Get field chan3_raw from rc_channels_raw message
371 * @return RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
373 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan3_raw(const mavlink_message_t* msg)
375 return _MAV_RETURN_uint16_t(msg, 8);
379 * @brief Get field chan4_raw from rc_channels_raw message
381 * @return RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
383 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan4_raw(const mavlink_message_t* msg)
385 return _MAV_RETURN_uint16_t(msg, 10);
389 * @brief Get field chan5_raw from rc_channels_raw message
391 * @return RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
393 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan5_raw(const mavlink_message_t* msg)
395 return _MAV_RETURN_uint16_t(msg, 12);
399 * @brief Get field chan6_raw from rc_channels_raw message
401 * @return RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
403 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan6_raw(const mavlink_message_t* msg)
405 return _MAV_RETURN_uint16_t(msg, 14);
409 * @brief Get field chan7_raw from rc_channels_raw message
411 * @return RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
413 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan7_raw(const mavlink_message_t* msg)
415 return _MAV_RETURN_uint16_t(msg, 16);
419 * @brief Get field chan8_raw from rc_channels_raw message
421 * @return RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
423 static inline uint16_t mavlink_msg_rc_channels_raw_get_chan8_raw(const mavlink_message_t* msg)
425 return _MAV_RETURN_uint16_t(msg, 18);
429 * @brief Get field rssi from rc_channels_raw message
431 * @return Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
433 static inline uint8_t mavlink_msg_rc_channels_raw_get_rssi(const mavlink_message_t* msg)
435 return _MAV_RETURN_uint8_t(msg, 21);
439 * @brief Decode a rc_channels_raw message into a struct
441 * @param msg The message to decode
442 * @param rc_channels_raw C-struct to decode the message contents into
444 static inline void mavlink_msg_rc_channels_raw_decode(const mavlink_message_t* msg, mavlink_rc_channels_raw_t* rc_channels_raw)
446 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
447 rc_channels_raw->time_boot_ms = mavlink_msg_rc_channels_raw_get_time_boot_ms(msg);
448 rc_channels_raw->chan1_raw = mavlink_msg_rc_channels_raw_get_chan1_raw(msg);
449 rc_channels_raw->chan2_raw = mavlink_msg_rc_channels_raw_get_chan2_raw(msg);
450 rc_channels_raw->chan3_raw = mavlink_msg_rc_channels_raw_get_chan3_raw(msg);
451 rc_channels_raw->chan4_raw = mavlink_msg_rc_channels_raw_get_chan4_raw(msg);
452 rc_channels_raw->chan5_raw = mavlink_msg_rc_channels_raw_get_chan5_raw(msg);
453 rc_channels_raw->chan6_raw = mavlink_msg_rc_channels_raw_get_chan6_raw(msg);
454 rc_channels_raw->chan7_raw = mavlink_msg_rc_channels_raw_get_chan7_raw(msg);
455 rc_channels_raw->chan8_raw = mavlink_msg_rc_channels_raw_get_chan8_raw(msg);
456 rc_channels_raw->port = mavlink_msg_rc_channels_raw_get_port(msg);
457 rc_channels_raw->rssi = mavlink_msg_rc_channels_raw_get_rssi(msg);
458 #else
459 uint8_t len = msg->len < MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN? msg->len : MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN;
460 memset(rc_channels_raw, 0, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
461 memcpy(rc_channels_raw, _MAV_PAYLOAD(msg), len);
462 #endif