Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_rc_channels.h
blob479af122ffee24bcecc5394f37a0aa19867d7693
1 // MESSAGE RC_CHANNELS PACKING
3 #define MAVLINK_MSG_ID_RC_CHANNELS 65
5 typedef struct __mavlink_rc_channels_t
7 uint32_t time_boot_ms; ///< Timestamp (milliseconds since system boot)
8 uint16_t chan1_raw; ///< RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
9 uint16_t chan2_raw; ///< RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
10 uint16_t chan3_raw; ///< RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
11 uint16_t chan4_raw; ///< RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
12 uint16_t chan5_raw; ///< RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
13 uint16_t chan6_raw; ///< RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
14 uint16_t chan7_raw; ///< RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
15 uint16_t chan8_raw; ///< RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
16 uint16_t chan9_raw; ///< RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
17 uint16_t chan10_raw; ///< RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
18 uint16_t chan11_raw; ///< RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
19 uint16_t chan12_raw; ///< RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
20 uint16_t chan13_raw; ///< RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
21 uint16_t chan14_raw; ///< RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
22 uint16_t chan15_raw; ///< RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
23 uint16_t chan16_raw; ///< RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
24 uint16_t chan17_raw; ///< RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
25 uint16_t chan18_raw; ///< RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
26 uint8_t chancount; ///< Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.
27 uint8_t rssi; ///< Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
28 } mavlink_rc_channels_t;
30 #define MAVLINK_MSG_ID_RC_CHANNELS_LEN 42
31 #define MAVLINK_MSG_ID_65_LEN 42
33 #define MAVLINK_MSG_ID_RC_CHANNELS_CRC 118
34 #define MAVLINK_MSG_ID_65_CRC 118
38 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS { \
39 "RC_CHANNELS", \
40 21, \
41 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_t, time_boot_ms) }, \
42 { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_t, chan1_raw) }, \
43 { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_t, chan2_raw) }, \
44 { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_t, chan3_raw) }, \
45 { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_t, chan4_raw) }, \
46 { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_t, chan5_raw) }, \
47 { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_t, chan6_raw) }, \
48 { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_t, chan7_raw) }, \
49 { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_t, chan8_raw) }, \
50 { "chan9_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_rc_channels_t, chan9_raw) }, \
51 { "chan10_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_rc_channels_t, chan10_raw) }, \
52 { "chan11_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_rc_channels_t, chan11_raw) }, \
53 { "chan12_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_rc_channels_t, chan12_raw) }, \
54 { "chan13_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_rc_channels_t, chan13_raw) }, \
55 { "chan14_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_rc_channels_t, chan14_raw) }, \
56 { "chan15_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_rc_channels_t, chan15_raw) }, \
57 { "chan16_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_rc_channels_t, chan16_raw) }, \
58 { "chan17_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_rc_channels_t, chan17_raw) }, \
59 { "chan18_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 38, offsetof(mavlink_rc_channels_t, chan18_raw) }, \
60 { "chancount", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_rc_channels_t, chancount) }, \
61 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_rc_channels_t, rssi) }, \
62 } \
66 /**
67 * @brief Pack a rc_channels message
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param msg The MAVLink message to compress the data into
72 * @param time_boot_ms Timestamp (milliseconds since system boot)
73 * @param chancount Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.
74 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
75 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
76 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
77 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
78 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
79 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
80 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
81 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
82 * @param chan9_raw RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
83 * @param chan10_raw RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
84 * @param chan11_raw RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
85 * @param chan12_raw RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
86 * @param chan13_raw RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
87 * @param chan14_raw RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
88 * @param chan15_raw RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
89 * @param chan16_raw RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
90 * @param chan17_raw RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
91 * @param chan18_raw RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
92 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
93 * @return length of the message in bytes (excluding serial stream start sign)
95 static inline uint16_t mavlink_msg_rc_channels_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 uint32_t time_boot_ms, uint8_t chancount, 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, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint16_t chan13_raw, uint16_t chan14_raw, uint16_t chan15_raw, uint16_t chan16_raw, uint16_t chan17_raw, uint16_t chan18_raw, uint8_t rssi)
98 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_RC_CHANNELS_LEN];
100 _mav_put_uint32_t(buf, 0, time_boot_ms);
101 _mav_put_uint16_t(buf, 4, chan1_raw);
102 _mav_put_uint16_t(buf, 6, chan2_raw);
103 _mav_put_uint16_t(buf, 8, chan3_raw);
104 _mav_put_uint16_t(buf, 10, chan4_raw);
105 _mav_put_uint16_t(buf, 12, chan5_raw);
106 _mav_put_uint16_t(buf, 14, chan6_raw);
107 _mav_put_uint16_t(buf, 16, chan7_raw);
108 _mav_put_uint16_t(buf, 18, chan8_raw);
109 _mav_put_uint16_t(buf, 20, chan9_raw);
110 _mav_put_uint16_t(buf, 22, chan10_raw);
111 _mav_put_uint16_t(buf, 24, chan11_raw);
112 _mav_put_uint16_t(buf, 26, chan12_raw);
113 _mav_put_uint16_t(buf, 28, chan13_raw);
114 _mav_put_uint16_t(buf, 30, chan14_raw);
115 _mav_put_uint16_t(buf, 32, chan15_raw);
116 _mav_put_uint16_t(buf, 34, chan16_raw);
117 _mav_put_uint16_t(buf, 36, chan17_raw);
118 _mav_put_uint16_t(buf, 38, chan18_raw);
119 _mav_put_uint8_t(buf, 40, chancount);
120 _mav_put_uint8_t(buf, 41, rssi);
122 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
123 #else
124 mavlink_rc_channels_t packet;
125 packet.time_boot_ms = time_boot_ms;
126 packet.chan1_raw = chan1_raw;
127 packet.chan2_raw = chan2_raw;
128 packet.chan3_raw = chan3_raw;
129 packet.chan4_raw = chan4_raw;
130 packet.chan5_raw = chan5_raw;
131 packet.chan6_raw = chan6_raw;
132 packet.chan7_raw = chan7_raw;
133 packet.chan8_raw = chan8_raw;
134 packet.chan9_raw = chan9_raw;
135 packet.chan10_raw = chan10_raw;
136 packet.chan11_raw = chan11_raw;
137 packet.chan12_raw = chan12_raw;
138 packet.chan13_raw = chan13_raw;
139 packet.chan14_raw = chan14_raw;
140 packet.chan15_raw = chan15_raw;
141 packet.chan16_raw = chan16_raw;
142 packet.chan17_raw = chan17_raw;
143 packet.chan18_raw = chan18_raw;
144 packet.chancount = chancount;
145 packet.rssi = rssi;
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
148 #endif
150 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS;
151 #if MAVLINK_CRC_EXTRA
152 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
153 #else
154 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
155 #endif
159 * @brief Pack a rc_channels message on a channel
160 * @param system_id ID of this system
161 * @param component_id ID of this component (e.g. 200 for IMU)
162 * @param chan The MAVLink channel this message will be sent over
163 * @param msg The MAVLink message to compress the data into
164 * @param time_boot_ms Timestamp (milliseconds since system boot)
165 * @param chancount Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.
166 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
167 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
168 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
169 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
170 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
171 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
172 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
173 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
174 * @param chan9_raw RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
175 * @param chan10_raw RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
176 * @param chan11_raw RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
177 * @param chan12_raw RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
178 * @param chan13_raw RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
179 * @param chan14_raw RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
180 * @param chan15_raw RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
181 * @param chan16_raw RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
182 * @param chan17_raw RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
183 * @param chan18_raw RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
184 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
185 * @return length of the message in bytes (excluding serial stream start sign)
187 static inline uint16_t mavlink_msg_rc_channels_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
188 mavlink_message_t* msg,
189 uint32_t time_boot_ms,uint8_t chancount,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,uint16_t chan9_raw,uint16_t chan10_raw,uint16_t chan11_raw,uint16_t chan12_raw,uint16_t chan13_raw,uint16_t chan14_raw,uint16_t chan15_raw,uint16_t chan16_raw,uint16_t chan17_raw,uint16_t chan18_raw,uint8_t rssi)
191 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
192 char buf[MAVLINK_MSG_ID_RC_CHANNELS_LEN];
193 _mav_put_uint32_t(buf, 0, time_boot_ms);
194 _mav_put_uint16_t(buf, 4, chan1_raw);
195 _mav_put_uint16_t(buf, 6, chan2_raw);
196 _mav_put_uint16_t(buf, 8, chan3_raw);
197 _mav_put_uint16_t(buf, 10, chan4_raw);
198 _mav_put_uint16_t(buf, 12, chan5_raw);
199 _mav_put_uint16_t(buf, 14, chan6_raw);
200 _mav_put_uint16_t(buf, 16, chan7_raw);
201 _mav_put_uint16_t(buf, 18, chan8_raw);
202 _mav_put_uint16_t(buf, 20, chan9_raw);
203 _mav_put_uint16_t(buf, 22, chan10_raw);
204 _mav_put_uint16_t(buf, 24, chan11_raw);
205 _mav_put_uint16_t(buf, 26, chan12_raw);
206 _mav_put_uint16_t(buf, 28, chan13_raw);
207 _mav_put_uint16_t(buf, 30, chan14_raw);
208 _mav_put_uint16_t(buf, 32, chan15_raw);
209 _mav_put_uint16_t(buf, 34, chan16_raw);
210 _mav_put_uint16_t(buf, 36, chan17_raw);
211 _mav_put_uint16_t(buf, 38, chan18_raw);
212 _mav_put_uint8_t(buf, 40, chancount);
213 _mav_put_uint8_t(buf, 41, rssi);
215 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
216 #else
217 mavlink_rc_channels_t packet;
218 packet.time_boot_ms = time_boot_ms;
219 packet.chan1_raw = chan1_raw;
220 packet.chan2_raw = chan2_raw;
221 packet.chan3_raw = chan3_raw;
222 packet.chan4_raw = chan4_raw;
223 packet.chan5_raw = chan5_raw;
224 packet.chan6_raw = chan6_raw;
225 packet.chan7_raw = chan7_raw;
226 packet.chan8_raw = chan8_raw;
227 packet.chan9_raw = chan9_raw;
228 packet.chan10_raw = chan10_raw;
229 packet.chan11_raw = chan11_raw;
230 packet.chan12_raw = chan12_raw;
231 packet.chan13_raw = chan13_raw;
232 packet.chan14_raw = chan14_raw;
233 packet.chan15_raw = chan15_raw;
234 packet.chan16_raw = chan16_raw;
235 packet.chan17_raw = chan17_raw;
236 packet.chan18_raw = chan18_raw;
237 packet.chancount = chancount;
238 packet.rssi = rssi;
240 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
241 #endif
243 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS;
244 #if MAVLINK_CRC_EXTRA
245 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
246 #else
247 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
248 #endif
252 * @brief Encode a rc_channels struct
254 * @param system_id ID of this system
255 * @param component_id ID of this component (e.g. 200 for IMU)
256 * @param msg The MAVLink message to compress the data into
257 * @param rc_channels C-struct to read the message contents from
259 static inline uint16_t mavlink_msg_rc_channels_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rc_channels_t* rc_channels)
261 return mavlink_msg_rc_channels_pack(system_id, component_id, msg, rc_channels->time_boot_ms, rc_channels->chancount, rc_channels->chan1_raw, rc_channels->chan2_raw, rc_channels->chan3_raw, rc_channels->chan4_raw, rc_channels->chan5_raw, rc_channels->chan6_raw, rc_channels->chan7_raw, rc_channels->chan8_raw, rc_channels->chan9_raw, rc_channels->chan10_raw, rc_channels->chan11_raw, rc_channels->chan12_raw, rc_channels->chan13_raw, rc_channels->chan14_raw, rc_channels->chan15_raw, rc_channels->chan16_raw, rc_channels->chan17_raw, rc_channels->chan18_raw, rc_channels->rssi);
265 * @brief Encode a rc_channels struct on a channel
267 * @param system_id ID of this system
268 * @param component_id ID of this component (e.g. 200 for IMU)
269 * @param chan The MAVLink channel this message will be sent over
270 * @param msg The MAVLink message to compress the data into
271 * @param rc_channels C-struct to read the message contents from
273 static inline uint16_t mavlink_msg_rc_channels_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rc_channels_t* rc_channels)
275 return mavlink_msg_rc_channels_pack_chan(system_id, component_id, chan, msg, rc_channels->time_boot_ms, rc_channels->chancount, rc_channels->chan1_raw, rc_channels->chan2_raw, rc_channels->chan3_raw, rc_channels->chan4_raw, rc_channels->chan5_raw, rc_channels->chan6_raw, rc_channels->chan7_raw, rc_channels->chan8_raw, rc_channels->chan9_raw, rc_channels->chan10_raw, rc_channels->chan11_raw, rc_channels->chan12_raw, rc_channels->chan13_raw, rc_channels->chan14_raw, rc_channels->chan15_raw, rc_channels->chan16_raw, rc_channels->chan17_raw, rc_channels->chan18_raw, rc_channels->rssi);
279 * @brief Send a rc_channels message
280 * @param chan MAVLink channel to send the message
282 * @param time_boot_ms Timestamp (milliseconds since system boot)
283 * @param chancount Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.
284 * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
285 * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
286 * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
287 * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
288 * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
289 * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
290 * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
291 * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
292 * @param chan9_raw RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
293 * @param chan10_raw RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
294 * @param chan11_raw RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
295 * @param chan12_raw RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
296 * @param chan13_raw RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
297 * @param chan14_raw RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
298 * @param chan15_raw RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
299 * @param chan16_raw RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
300 * @param chan17_raw RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
301 * @param chan18_raw RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
302 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
304 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
306 static inline void mavlink_msg_rc_channels_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t chancount, 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, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint16_t chan13_raw, uint16_t chan14_raw, uint16_t chan15_raw, uint16_t chan16_raw, uint16_t chan17_raw, uint16_t chan18_raw, uint8_t rssi)
308 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
309 char buf[MAVLINK_MSG_ID_RC_CHANNELS_LEN];
310 _mav_put_uint32_t(buf, 0, time_boot_ms);
311 _mav_put_uint16_t(buf, 4, chan1_raw);
312 _mav_put_uint16_t(buf, 6, chan2_raw);
313 _mav_put_uint16_t(buf, 8, chan3_raw);
314 _mav_put_uint16_t(buf, 10, chan4_raw);
315 _mav_put_uint16_t(buf, 12, chan5_raw);
316 _mav_put_uint16_t(buf, 14, chan6_raw);
317 _mav_put_uint16_t(buf, 16, chan7_raw);
318 _mav_put_uint16_t(buf, 18, chan8_raw);
319 _mav_put_uint16_t(buf, 20, chan9_raw);
320 _mav_put_uint16_t(buf, 22, chan10_raw);
321 _mav_put_uint16_t(buf, 24, chan11_raw);
322 _mav_put_uint16_t(buf, 26, chan12_raw);
323 _mav_put_uint16_t(buf, 28, chan13_raw);
324 _mav_put_uint16_t(buf, 30, chan14_raw);
325 _mav_put_uint16_t(buf, 32, chan15_raw);
326 _mav_put_uint16_t(buf, 34, chan16_raw);
327 _mav_put_uint16_t(buf, 36, chan17_raw);
328 _mav_put_uint16_t(buf, 38, chan18_raw);
329 _mav_put_uint8_t(buf, 40, chancount);
330 _mav_put_uint8_t(buf, 41, rssi);
332 #if MAVLINK_CRC_EXTRA
333 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
334 #else
335 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
336 #endif
337 #else
338 mavlink_rc_channels_t packet;
339 packet.time_boot_ms = time_boot_ms;
340 packet.chan1_raw = chan1_raw;
341 packet.chan2_raw = chan2_raw;
342 packet.chan3_raw = chan3_raw;
343 packet.chan4_raw = chan4_raw;
344 packet.chan5_raw = chan5_raw;
345 packet.chan6_raw = chan6_raw;
346 packet.chan7_raw = chan7_raw;
347 packet.chan8_raw = chan8_raw;
348 packet.chan9_raw = chan9_raw;
349 packet.chan10_raw = chan10_raw;
350 packet.chan11_raw = chan11_raw;
351 packet.chan12_raw = chan12_raw;
352 packet.chan13_raw = chan13_raw;
353 packet.chan14_raw = chan14_raw;
354 packet.chan15_raw = chan15_raw;
355 packet.chan16_raw = chan16_raw;
356 packet.chan17_raw = chan17_raw;
357 packet.chan18_raw = chan18_raw;
358 packet.chancount = chancount;
359 packet.rssi = rssi;
361 #if MAVLINK_CRC_EXTRA
362 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
363 #else
364 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
365 #endif
366 #endif
369 #if MAVLINK_MSG_ID_RC_CHANNELS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
371 This varient of _send() can be used to save stack space by re-using
372 memory from the receive buffer. The caller provides a
373 mavlink_message_t which is the size of a full mavlink message. This
374 is usually the receive buffer for the channel, and allows a reply to an
375 incoming message with minimum stack space usage.
377 static inline void mavlink_msg_rc_channels_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t chancount, 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, uint16_t chan9_raw, uint16_t chan10_raw, uint16_t chan11_raw, uint16_t chan12_raw, uint16_t chan13_raw, uint16_t chan14_raw, uint16_t chan15_raw, uint16_t chan16_raw, uint16_t chan17_raw, uint16_t chan18_raw, uint8_t rssi)
379 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
380 char *buf = (char *)msgbuf;
381 _mav_put_uint32_t(buf, 0, time_boot_ms);
382 _mav_put_uint16_t(buf, 4, chan1_raw);
383 _mav_put_uint16_t(buf, 6, chan2_raw);
384 _mav_put_uint16_t(buf, 8, chan3_raw);
385 _mav_put_uint16_t(buf, 10, chan4_raw);
386 _mav_put_uint16_t(buf, 12, chan5_raw);
387 _mav_put_uint16_t(buf, 14, chan6_raw);
388 _mav_put_uint16_t(buf, 16, chan7_raw);
389 _mav_put_uint16_t(buf, 18, chan8_raw);
390 _mav_put_uint16_t(buf, 20, chan9_raw);
391 _mav_put_uint16_t(buf, 22, chan10_raw);
392 _mav_put_uint16_t(buf, 24, chan11_raw);
393 _mav_put_uint16_t(buf, 26, chan12_raw);
394 _mav_put_uint16_t(buf, 28, chan13_raw);
395 _mav_put_uint16_t(buf, 30, chan14_raw);
396 _mav_put_uint16_t(buf, 32, chan15_raw);
397 _mav_put_uint16_t(buf, 34, chan16_raw);
398 _mav_put_uint16_t(buf, 36, chan17_raw);
399 _mav_put_uint16_t(buf, 38, chan18_raw);
400 _mav_put_uint8_t(buf, 40, chancount);
401 _mav_put_uint8_t(buf, 41, rssi);
403 #if MAVLINK_CRC_EXTRA
404 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
405 #else
406 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, buf, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
407 #endif
408 #else
409 mavlink_rc_channels_t *packet = (mavlink_rc_channels_t *)msgbuf;
410 packet->time_boot_ms = time_boot_ms;
411 packet->chan1_raw = chan1_raw;
412 packet->chan2_raw = chan2_raw;
413 packet->chan3_raw = chan3_raw;
414 packet->chan4_raw = chan4_raw;
415 packet->chan5_raw = chan5_raw;
416 packet->chan6_raw = chan6_raw;
417 packet->chan7_raw = chan7_raw;
418 packet->chan8_raw = chan8_raw;
419 packet->chan9_raw = chan9_raw;
420 packet->chan10_raw = chan10_raw;
421 packet->chan11_raw = chan11_raw;
422 packet->chan12_raw = chan12_raw;
423 packet->chan13_raw = chan13_raw;
424 packet->chan14_raw = chan14_raw;
425 packet->chan15_raw = chan15_raw;
426 packet->chan16_raw = chan16_raw;
427 packet->chan17_raw = chan17_raw;
428 packet->chan18_raw = chan18_raw;
429 packet->chancount = chancount;
430 packet->rssi = rssi;
432 #if MAVLINK_CRC_EXTRA
433 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN, MAVLINK_MSG_ID_RC_CHANNELS_CRC);
434 #else
435 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_LEN);
436 #endif
437 #endif
439 #endif
441 #endif
443 // MESSAGE RC_CHANNELS UNPACKING
447 * @brief Get field time_boot_ms from rc_channels message
449 * @return Timestamp (milliseconds since system boot)
451 static inline uint32_t mavlink_msg_rc_channels_get_time_boot_ms(const mavlink_message_t* msg)
453 return _MAV_RETURN_uint32_t(msg, 0);
457 * @brief Get field chancount from rc_channels message
459 * @return Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available.
461 static inline uint8_t mavlink_msg_rc_channels_get_chancount(const mavlink_message_t* msg)
463 return _MAV_RETURN_uint8_t(msg, 40);
467 * @brief Get field chan1_raw from rc_channels message
469 * @return RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
471 static inline uint16_t mavlink_msg_rc_channels_get_chan1_raw(const mavlink_message_t* msg)
473 return _MAV_RETURN_uint16_t(msg, 4);
477 * @brief Get field chan2_raw from rc_channels message
479 * @return RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
481 static inline uint16_t mavlink_msg_rc_channels_get_chan2_raw(const mavlink_message_t* msg)
483 return _MAV_RETURN_uint16_t(msg, 6);
487 * @brief Get field chan3_raw from rc_channels message
489 * @return RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
491 static inline uint16_t mavlink_msg_rc_channels_get_chan3_raw(const mavlink_message_t* msg)
493 return _MAV_RETURN_uint16_t(msg, 8);
497 * @brief Get field chan4_raw from rc_channels message
499 * @return RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
501 static inline uint16_t mavlink_msg_rc_channels_get_chan4_raw(const mavlink_message_t* msg)
503 return _MAV_RETURN_uint16_t(msg, 10);
507 * @brief Get field chan5_raw from rc_channels message
509 * @return RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
511 static inline uint16_t mavlink_msg_rc_channels_get_chan5_raw(const mavlink_message_t* msg)
513 return _MAV_RETURN_uint16_t(msg, 12);
517 * @brief Get field chan6_raw from rc_channels message
519 * @return RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
521 static inline uint16_t mavlink_msg_rc_channels_get_chan6_raw(const mavlink_message_t* msg)
523 return _MAV_RETURN_uint16_t(msg, 14);
527 * @brief Get field chan7_raw from rc_channels message
529 * @return RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
531 static inline uint16_t mavlink_msg_rc_channels_get_chan7_raw(const mavlink_message_t* msg)
533 return _MAV_RETURN_uint16_t(msg, 16);
537 * @brief Get field chan8_raw from rc_channels message
539 * @return RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
541 static inline uint16_t mavlink_msg_rc_channels_get_chan8_raw(const mavlink_message_t* msg)
543 return _MAV_RETURN_uint16_t(msg, 18);
547 * @brief Get field chan9_raw from rc_channels message
549 * @return RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
551 static inline uint16_t mavlink_msg_rc_channels_get_chan9_raw(const mavlink_message_t* msg)
553 return _MAV_RETURN_uint16_t(msg, 20);
557 * @brief Get field chan10_raw from rc_channels message
559 * @return RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
561 static inline uint16_t mavlink_msg_rc_channels_get_chan10_raw(const mavlink_message_t* msg)
563 return _MAV_RETURN_uint16_t(msg, 22);
567 * @brief Get field chan11_raw from rc_channels message
569 * @return RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
571 static inline uint16_t mavlink_msg_rc_channels_get_chan11_raw(const mavlink_message_t* msg)
573 return _MAV_RETURN_uint16_t(msg, 24);
577 * @brief Get field chan12_raw from rc_channels message
579 * @return RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
581 static inline uint16_t mavlink_msg_rc_channels_get_chan12_raw(const mavlink_message_t* msg)
583 return _MAV_RETURN_uint16_t(msg, 26);
587 * @brief Get field chan13_raw from rc_channels message
589 * @return RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
591 static inline uint16_t mavlink_msg_rc_channels_get_chan13_raw(const mavlink_message_t* msg)
593 return _MAV_RETURN_uint16_t(msg, 28);
597 * @brief Get field chan14_raw from rc_channels message
599 * @return RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
601 static inline uint16_t mavlink_msg_rc_channels_get_chan14_raw(const mavlink_message_t* msg)
603 return _MAV_RETURN_uint16_t(msg, 30);
607 * @brief Get field chan15_raw from rc_channels message
609 * @return RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
611 static inline uint16_t mavlink_msg_rc_channels_get_chan15_raw(const mavlink_message_t* msg)
613 return _MAV_RETURN_uint16_t(msg, 32);
617 * @brief Get field chan16_raw from rc_channels message
619 * @return RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
621 static inline uint16_t mavlink_msg_rc_channels_get_chan16_raw(const mavlink_message_t* msg)
623 return _MAV_RETURN_uint16_t(msg, 34);
627 * @brief Get field chan17_raw from rc_channels message
629 * @return RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
631 static inline uint16_t mavlink_msg_rc_channels_get_chan17_raw(const mavlink_message_t* msg)
633 return _MAV_RETURN_uint16_t(msg, 36);
637 * @brief Get field chan18_raw from rc_channels message
639 * @return RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
641 static inline uint16_t mavlink_msg_rc_channels_get_chan18_raw(const mavlink_message_t* msg)
643 return _MAV_RETURN_uint16_t(msg, 38);
647 * @brief Get field rssi from rc_channels message
649 * @return Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
651 static inline uint8_t mavlink_msg_rc_channels_get_rssi(const mavlink_message_t* msg)
653 return _MAV_RETURN_uint8_t(msg, 41);
657 * @brief Decode a rc_channels message into a struct
659 * @param msg The message to decode
660 * @param rc_channels C-struct to decode the message contents into
662 static inline void mavlink_msg_rc_channels_decode(const mavlink_message_t* msg, mavlink_rc_channels_t* rc_channels)
664 #if MAVLINK_NEED_BYTE_SWAP
665 rc_channels->time_boot_ms = mavlink_msg_rc_channels_get_time_boot_ms(msg);
666 rc_channels->chan1_raw = mavlink_msg_rc_channels_get_chan1_raw(msg);
667 rc_channels->chan2_raw = mavlink_msg_rc_channels_get_chan2_raw(msg);
668 rc_channels->chan3_raw = mavlink_msg_rc_channels_get_chan3_raw(msg);
669 rc_channels->chan4_raw = mavlink_msg_rc_channels_get_chan4_raw(msg);
670 rc_channels->chan5_raw = mavlink_msg_rc_channels_get_chan5_raw(msg);
671 rc_channels->chan6_raw = mavlink_msg_rc_channels_get_chan6_raw(msg);
672 rc_channels->chan7_raw = mavlink_msg_rc_channels_get_chan7_raw(msg);
673 rc_channels->chan8_raw = mavlink_msg_rc_channels_get_chan8_raw(msg);
674 rc_channels->chan9_raw = mavlink_msg_rc_channels_get_chan9_raw(msg);
675 rc_channels->chan10_raw = mavlink_msg_rc_channels_get_chan10_raw(msg);
676 rc_channels->chan11_raw = mavlink_msg_rc_channels_get_chan11_raw(msg);
677 rc_channels->chan12_raw = mavlink_msg_rc_channels_get_chan12_raw(msg);
678 rc_channels->chan13_raw = mavlink_msg_rc_channels_get_chan13_raw(msg);
679 rc_channels->chan14_raw = mavlink_msg_rc_channels_get_chan14_raw(msg);
680 rc_channels->chan15_raw = mavlink_msg_rc_channels_get_chan15_raw(msg);
681 rc_channels->chan16_raw = mavlink_msg_rc_channels_get_chan16_raw(msg);
682 rc_channels->chan17_raw = mavlink_msg_rc_channels_get_chan17_raw(msg);
683 rc_channels->chan18_raw = mavlink_msg_rc_channels_get_chan18_raw(msg);
684 rc_channels->chancount = mavlink_msg_rc_channels_get_chancount(msg);
685 rc_channels->rssi = mavlink_msg_rc_channels_get_rssi(msg);
686 #else
687 memcpy(rc_channels, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RC_CHANNELS_LEN);
688 #endif