mavlink_msg_rc_channels_scaled.h
Go to the documentation of this file.
1 // MESSAGE RC_CHANNELS_SCALED PACKING
2 
3 #define MAVLINK_MSG_ID_RC_CHANNELS_SCALED 34
4 
6 {
7  uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
8  int16_t chan1_scaled; /*< RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
9  int16_t chan2_scaled; /*< RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
10  int16_t chan3_scaled; /*< RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
11  int16_t chan4_scaled; /*< RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
12  int16_t chan5_scaled; /*< RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
13  int16_t chan6_scaled; /*< RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
14  int16_t chan7_scaled; /*< RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
15  int16_t chan8_scaled; /*< RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.*/
16  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.*/
17  uint8_t rssi; /*< Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.*/
19 
20 #define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN 22
21 #define MAVLINK_MSG_ID_34_LEN 22
22 
23 #define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC 237
24 #define MAVLINK_MSG_ID_34_CRC 237
25 
26 
27 
28 #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED { \
29  "RC_CHANNELS_SCALED", \
30  11, \
31  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_scaled_t, time_boot_ms) }, \
32  { "chan1_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_rc_channels_scaled_t, chan1_scaled) }, \
33  { "chan2_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_rc_channels_scaled_t, chan2_scaled) }, \
34  { "chan3_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rc_channels_scaled_t, chan3_scaled) }, \
35  { "chan4_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rc_channels_scaled_t, chan4_scaled) }, \
36  { "chan5_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_rc_channels_scaled_t, chan5_scaled) }, \
37  { "chan6_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_rc_channels_scaled_t, chan6_scaled) }, \
38  { "chan7_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_rc_channels_scaled_t, chan7_scaled) }, \
39  { "chan8_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_rc_channels_scaled_t, chan8_scaled) }, \
40  { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_scaled_t, port) }, \
41  { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_scaled_t, rssi) }, \
42  } \
43 }
44 
45 
65 static inline uint16_t mavlink_msg_rc_channels_scaled_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66  uint32_t time_boot_ms, uint8_t port, int16_t chan1_scaled, int16_t chan2_scaled, int16_t chan3_scaled, int16_t chan4_scaled, int16_t chan5_scaled, int16_t chan6_scaled, int16_t chan7_scaled, int16_t chan8_scaled, 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_int16_t(buf, 4, chan1_scaled);
72  _mav_put_int16_t(buf, 6, chan2_scaled);
73  _mav_put_int16_t(buf, 8, chan3_scaled);
74  _mav_put_int16_t(buf, 10, chan4_scaled);
75  _mav_put_int16_t(buf, 12, chan5_scaled);
76  _mav_put_int16_t(buf, 14, chan6_scaled);
77  _mav_put_int16_t(buf, 16, chan7_scaled);
78  _mav_put_int16_t(buf, 18, chan8_scaled);
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_scaled = chan1_scaled;
87  packet.chan2_scaled = chan2_scaled;
88  packet.chan3_scaled = chan3_scaled;
89  packet.chan4_scaled = chan4_scaled;
90  packet.chan5_scaled = chan5_scaled;
91  packet.chan6_scaled = chan6_scaled;
92  packet.chan7_scaled = chan7_scaled;
93  packet.chan8_scaled = chan8_scaled;
94  packet.port = port;
95  packet.rssi = rssi;
96 
98 #endif
99 
101 #if MAVLINK_CRC_EXTRA
103 #else
104  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
105 #endif
106 }
107 
127 static inline uint16_t mavlink_msg_rc_channels_scaled_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,int16_t chan1_scaled,int16_t chan2_scaled,int16_t chan3_scaled,int16_t chan4_scaled,int16_t chan5_scaled,int16_t chan6_scaled,int16_t chan7_scaled,int16_t chan8_scaled,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_int16_t(buf, 4, chan1_scaled);
135  _mav_put_int16_t(buf, 6, chan2_scaled);
136  _mav_put_int16_t(buf, 8, chan3_scaled);
137  _mav_put_int16_t(buf, 10, chan4_scaled);
138  _mav_put_int16_t(buf, 12, chan5_scaled);
139  _mav_put_int16_t(buf, 14, chan6_scaled);
140  _mav_put_int16_t(buf, 16, chan7_scaled);
141  _mav_put_int16_t(buf, 18, chan8_scaled);
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_scaled = chan1_scaled;
150  packet.chan2_scaled = chan2_scaled;
151  packet.chan3_scaled = chan3_scaled;
152  packet.chan4_scaled = chan4_scaled;
153  packet.chan5_scaled = chan5_scaled;
154  packet.chan6_scaled = chan6_scaled;
155  packet.chan7_scaled = chan7_scaled;
156  packet.chan8_scaled = chan8_scaled;
157  packet.port = port;
158  packet.rssi = rssi;
159 
161 #endif
162 
164 #if MAVLINK_CRC_EXTRA
166 #else
167  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
168 #endif
169 }
170 
179 static inline uint16_t mavlink_msg_rc_channels_scaled_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rc_channels_scaled_t* rc_channels_scaled)
180 {
181  return mavlink_msg_rc_channels_scaled_pack(system_id, component_id, msg, rc_channels_scaled->time_boot_ms, rc_channels_scaled->port, rc_channels_scaled->chan1_scaled, rc_channels_scaled->chan2_scaled, rc_channels_scaled->chan3_scaled, rc_channels_scaled->chan4_scaled, rc_channels_scaled->chan5_scaled, rc_channels_scaled->chan6_scaled, rc_channels_scaled->chan7_scaled, rc_channels_scaled->chan8_scaled, rc_channels_scaled->rssi);
182 }
183 
193 static inline uint16_t mavlink_msg_rc_channels_scaled_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rc_channels_scaled_t* rc_channels_scaled)
194 {
195  return mavlink_msg_rc_channels_scaled_pack_chan(system_id, component_id, chan, msg, rc_channels_scaled->time_boot_ms, rc_channels_scaled->port, rc_channels_scaled->chan1_scaled, rc_channels_scaled->chan2_scaled, rc_channels_scaled->chan3_scaled, rc_channels_scaled->chan4_scaled, rc_channels_scaled->chan5_scaled, rc_channels_scaled->chan6_scaled, rc_channels_scaled->chan7_scaled, rc_channels_scaled->chan8_scaled, rc_channels_scaled->rssi);
196 }
197 
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
215 
216 static inline void mavlink_msg_rc_channels_scaled_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, int16_t chan1_scaled, int16_t chan2_scaled, int16_t chan3_scaled, int16_t chan4_scaled, int16_t chan5_scaled, int16_t chan6_scaled, int16_t chan7_scaled, int16_t chan8_scaled, uint8_t rssi)
217 {
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
224  _mav_put_int16_t(buf, 10, chan4_scaled);
225  _mav_put_int16_t(buf, 12, chan5_scaled);
226  _mav_put_int16_t(buf, 14, chan6_scaled);
227  _mav_put_int16_t(buf, 16, chan7_scaled);
228  _mav_put_int16_t(buf, 18, chan8_scaled);
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_SCALED, buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
236 #endif
237 #else
239  packet.time_boot_ms = time_boot_ms;
240  packet.chan1_scaled = chan1_scaled;
241  packet.chan2_scaled = chan2_scaled;
242  packet.chan3_scaled = chan3_scaled;
243  packet.chan4_scaled = chan4_scaled;
244  packet.chan5_scaled = chan5_scaled;
245  packet.chan6_scaled = chan6_scaled;
246  packet.chan7_scaled = chan7_scaled;
247  packet.chan8_scaled = chan8_scaled;
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_SCALED, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
253 #else
254  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
255 #endif
256 #endif
257 }
258 
259 #if MAVLINK_MSG_ID_RC_CHANNELS_SCALED_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_scaled_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, int16_t chan1_scaled, int16_t chan2_scaled, int16_t chan3_scaled, int16_t chan4_scaled, int16_t chan5_scaled, int16_t chan6_scaled, int16_t chan7_scaled, int16_t chan8_scaled, uint8_t rssi)
268 {
269 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270  char *buf = (char *)msgbuf;
275  _mav_put_int16_t(buf, 10, chan4_scaled);
276  _mav_put_int16_t(buf, 12, chan5_scaled);
277  _mav_put_int16_t(buf, 14, chan6_scaled);
278  _mav_put_int16_t(buf, 16, chan7_scaled);
279  _mav_put_int16_t(buf, 18, chan8_scaled);
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_SCALED, buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
287 #endif
288 #else
290  packet->time_boot_ms = time_boot_ms;
291  packet->chan1_scaled = chan1_scaled;
292  packet->chan2_scaled = chan2_scaled;
293  packet->chan3_scaled = chan3_scaled;
294  packet->chan4_scaled = chan4_scaled;
295  packet->chan5_scaled = chan5_scaled;
296  packet->chan6_scaled = chan6_scaled;
297  packet->chan7_scaled = chan7_scaled;
298  packet->chan8_scaled = chan8_scaled;
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_SCALED, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
304 #else
305  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
306 #endif
307 #endif
308 }
309 #endif
310 
311 #endif
312 
313 // MESSAGE RC_CHANNELS_SCALED UNPACKING
314 
315 
321 static inline uint32_t mavlink_msg_rc_channels_scaled_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_scaled_get_port(const mavlink_message_t* msg)
332 {
333  return _MAV_RETURN_uint8_t(msg, 20);
334 }
335 
341 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan1_scaled(const mavlink_message_t* msg)
342 {
343  return _MAV_RETURN_int16_t(msg, 4);
344 }
345 
351 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan2_scaled(const mavlink_message_t* msg)
352 {
353  return _MAV_RETURN_int16_t(msg, 6);
354 }
355 
361 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan3_scaled(const mavlink_message_t* msg)
362 {
363  return _MAV_RETURN_int16_t(msg, 8);
364 }
365 
371 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan4_scaled(const mavlink_message_t* msg)
372 {
373  return _MAV_RETURN_int16_t(msg, 10);
374 }
375 
381 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan5_scaled(const mavlink_message_t* msg)
382 {
383  return _MAV_RETURN_int16_t(msg, 12);
384 }
385 
391 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan6_scaled(const mavlink_message_t* msg)
392 {
393  return _MAV_RETURN_int16_t(msg, 14);
394 }
395 
401 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan7_scaled(const mavlink_message_t* msg)
402 {
403  return _MAV_RETURN_int16_t(msg, 16);
404 }
405 
411 static inline int16_t mavlink_msg_rc_channels_scaled_get_chan8_scaled(const mavlink_message_t* msg)
412 {
413  return _MAV_RETURN_int16_t(msg, 18);
414 }
415 
421 static inline uint8_t mavlink_msg_rc_channels_scaled_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_scaled_decode(const mavlink_message_t* msg, mavlink_rc_channels_scaled_t* rc_channels_scaled)
433 {
434 #if MAVLINK_NEED_BYTE_SWAP
444  rc_channels_scaled->port = mavlink_msg_rc_channels_scaled_get_port(msg);
445  rc_channels_scaled->rssi = mavlink_msg_rc_channels_scaled_get_rssi(msg);
446 #else
447  memcpy(rc_channels_scaled, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
448 #endif
449 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:146
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 20:00:13