source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_rc_channels_scaled.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 23.7 KB
Line 
1// MESSAGE RC_CHANNELS_SCALED PACKING
2
3#define MAVLINK_MSG_ID_RC_CHANNELS_SCALED 34
4
5typedef struct MAVLINK_PACKED __mavlink_rc_channels_scaled_t
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.*/
18} mavlink_rc_channels_scaled_t;
19
20#define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN 22
21#define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN 22
22#define MAVLINK_MSG_ID_34_LEN 22
23#define MAVLINK_MSG_ID_34_MIN_LEN 22
24
25#define MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC 237
26#define MAVLINK_MSG_ID_34_CRC 237
27
28
29
30#if MAVLINK_COMMAND_24BIT
31#define MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED { \
32 34, \
33 "RC_CHANNELS_SCALED", \
34 11, \
35 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_scaled_t, time_boot_ms) }, \
36 { "chan1_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_rc_channels_scaled_t, chan1_scaled) }, \
37 { "chan2_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_rc_channels_scaled_t, chan2_scaled) }, \
38 { "chan3_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rc_channels_scaled_t, chan3_scaled) }, \
39 { "chan4_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rc_channels_scaled_t, chan4_scaled) }, \
40 { "chan5_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_rc_channels_scaled_t, chan5_scaled) }, \
41 { "chan6_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_rc_channels_scaled_t, chan6_scaled) }, \
42 { "chan7_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_rc_channels_scaled_t, chan7_scaled) }, \
43 { "chan8_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_rc_channels_scaled_t, chan8_scaled) }, \
44 { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_scaled_t, port) }, \
45 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_scaled_t, rssi) }, \
46 } \
47}
48#else
49#define MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED { \
50 "RC_CHANNELS_SCALED", \
51 11, \
52 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_scaled_t, time_boot_ms) }, \
53 { "chan1_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_rc_channels_scaled_t, chan1_scaled) }, \
54 { "chan2_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_rc_channels_scaled_t, chan2_scaled) }, \
55 { "chan3_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rc_channels_scaled_t, chan3_scaled) }, \
56 { "chan4_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rc_channels_scaled_t, chan4_scaled) }, \
57 { "chan5_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_rc_channels_scaled_t, chan5_scaled) }, \
58 { "chan6_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_rc_channels_scaled_t, chan6_scaled) }, \
59 { "chan7_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_rc_channels_scaled_t, chan7_scaled) }, \
60 { "chan8_scaled", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_rc_channels_scaled_t, chan8_scaled) }, \
61 { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_scaled_t, port) }, \
62 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_scaled_t, rssi) }, \
63 } \
64}
65#endif
66
67/**
68 * @brief Pack a rc_channels_scaled message
69 * @param system_id ID of this system
70 * @param component_id ID of this component (e.g. 200 for IMU)
71 * @param msg The MAVLink message to compress the data into
72 *
73 * @param time_boot_ms Timestamp (milliseconds since system boot)
74 * @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.
75 * @param chan1_scaled RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
76 * @param chan2_scaled RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
77 * @param chan3_scaled RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
78 * @param chan4_scaled RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
79 * @param chan5_scaled RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
80 * @param chan6_scaled RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
81 * @param chan7_scaled RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
82 * @param chan8_scaled RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
83 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
84 * @return length of the message in bytes (excluding serial stream start sign)
85 */
86static inline uint16_t mavlink_msg_rc_channels_scaled_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
87 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)
88{
89#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 char buf[MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN];
91 _mav_put_uint32_t(buf, 0, time_boot_ms);
92 _mav_put_int16_t(buf, 4, chan1_scaled);
93 _mav_put_int16_t(buf, 6, chan2_scaled);
94 _mav_put_int16_t(buf, 8, chan3_scaled);
95 _mav_put_int16_t(buf, 10, chan4_scaled);
96 _mav_put_int16_t(buf, 12, chan5_scaled);
97 _mav_put_int16_t(buf, 14, chan6_scaled);
98 _mav_put_int16_t(buf, 16, chan7_scaled);
99 _mav_put_int16_t(buf, 18, chan8_scaled);
100 _mav_put_uint8_t(buf, 20, port);
101 _mav_put_uint8_t(buf, 21, rssi);
102
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
104#else
105 mavlink_rc_channels_scaled_t packet;
106 packet.time_boot_ms = time_boot_ms;
107 packet.chan1_scaled = chan1_scaled;
108 packet.chan2_scaled = chan2_scaled;
109 packet.chan3_scaled = chan3_scaled;
110 packet.chan4_scaled = chan4_scaled;
111 packet.chan5_scaled = chan5_scaled;
112 packet.chan6_scaled = chan6_scaled;
113 packet.chan7_scaled = chan7_scaled;
114 packet.chan8_scaled = chan8_scaled;
115 packet.port = port;
116 packet.rssi = rssi;
117
118 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
119#endif
120
121 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED;
122 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
123}
124
125/**
126 * @brief Pack a rc_channels_scaled message on a channel
127 * @param system_id ID of this system
128 * @param component_id ID of this component (e.g. 200 for IMU)
129 * @param chan The MAVLink channel this message will be sent over
130 * @param msg The MAVLink message to compress the data into
131 * @param time_boot_ms Timestamp (milliseconds since system boot)
132 * @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.
133 * @param chan1_scaled RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
134 * @param chan2_scaled RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
135 * @param chan3_scaled RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
136 * @param chan4_scaled RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
137 * @param chan5_scaled RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
138 * @param chan6_scaled RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
139 * @param chan7_scaled RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
140 * @param chan8_scaled RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
141 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
142 * @return length of the message in bytes (excluding serial stream start sign)
143 */
144static inline uint16_t mavlink_msg_rc_channels_scaled_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
145 mavlink_message_t* msg,
146 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)
147{
148#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf[MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN];
150 _mav_put_uint32_t(buf, 0, time_boot_ms);
151 _mav_put_int16_t(buf, 4, chan1_scaled);
152 _mav_put_int16_t(buf, 6, chan2_scaled);
153 _mav_put_int16_t(buf, 8, chan3_scaled);
154 _mav_put_int16_t(buf, 10, chan4_scaled);
155 _mav_put_int16_t(buf, 12, chan5_scaled);
156 _mav_put_int16_t(buf, 14, chan6_scaled);
157 _mav_put_int16_t(buf, 16, chan7_scaled);
158 _mav_put_int16_t(buf, 18, chan8_scaled);
159 _mav_put_uint8_t(buf, 20, port);
160 _mav_put_uint8_t(buf, 21, rssi);
161
162 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
163#else
164 mavlink_rc_channels_scaled_t packet;
165 packet.time_boot_ms = time_boot_ms;
166 packet.chan1_scaled = chan1_scaled;
167 packet.chan2_scaled = chan2_scaled;
168 packet.chan3_scaled = chan3_scaled;
169 packet.chan4_scaled = chan4_scaled;
170 packet.chan5_scaled = chan5_scaled;
171 packet.chan6_scaled = chan6_scaled;
172 packet.chan7_scaled = chan7_scaled;
173 packet.chan8_scaled = chan8_scaled;
174 packet.port = port;
175 packet.rssi = rssi;
176
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
178#endif
179
180 msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED;
181 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
182}
183
184/**
185 * @brief Encode a rc_channels_scaled struct
186 *
187 * @param system_id ID of this system
188 * @param component_id ID of this component (e.g. 200 for IMU)
189 * @param msg The MAVLink message to compress the data into
190 * @param rc_channels_scaled C-struct to read the message contents from
191 */
192static 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)
193{
194 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);
195}
196
197/**
198 * @brief Encode a rc_channels_scaled struct on a channel
199 *
200 * @param system_id ID of this system
201 * @param component_id ID of this component (e.g. 200 for IMU)
202 * @param chan The MAVLink channel this message will be sent over
203 * @param msg The MAVLink message to compress the data into
204 * @param rc_channels_scaled C-struct to read the message contents from
205 */
206static 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)
207{
208 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);
209}
210
211/**
212 * @brief Send a rc_channels_scaled message
213 * @param chan MAVLink channel to send the message
214 *
215 * @param time_boot_ms Timestamp (milliseconds since system boot)
216 * @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.
217 * @param chan1_scaled RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
218 * @param chan2_scaled RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
219 * @param chan3_scaled RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
220 * @param chan4_scaled RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
221 * @param chan5_scaled RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
222 * @param chan6_scaled RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
223 * @param chan7_scaled RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
224 * @param chan8_scaled RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
225 * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
226 */
227#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
228
229static 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)
230{
231#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
232 char buf[MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN];
233 _mav_put_uint32_t(buf, 0, time_boot_ms);
234 _mav_put_int16_t(buf, 4, chan1_scaled);
235 _mav_put_int16_t(buf, 6, chan2_scaled);
236 _mav_put_int16_t(buf, 8, chan3_scaled);
237 _mav_put_int16_t(buf, 10, chan4_scaled);
238 _mav_put_int16_t(buf, 12, chan5_scaled);
239 _mav_put_int16_t(buf, 14, chan6_scaled);
240 _mav_put_int16_t(buf, 16, chan7_scaled);
241 _mav_put_int16_t(buf, 18, chan8_scaled);
242 _mav_put_uint8_t(buf, 20, port);
243 _mav_put_uint8_t(buf, 21, rssi);
244
245 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
246#else
247 mavlink_rc_channels_scaled_t packet;
248 packet.time_boot_ms = time_boot_ms;
249 packet.chan1_scaled = chan1_scaled;
250 packet.chan2_scaled = chan2_scaled;
251 packet.chan3_scaled = chan3_scaled;
252 packet.chan4_scaled = chan4_scaled;
253 packet.chan5_scaled = chan5_scaled;
254 packet.chan6_scaled = chan6_scaled;
255 packet.chan7_scaled = chan7_scaled;
256 packet.chan8_scaled = chan8_scaled;
257 packet.port = port;
258 packet.rssi = rssi;
259
260 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
261#endif
262}
263
264/**
265 * @brief Send a rc_channels_scaled message
266 * @param chan MAVLink channel to send the message
267 * @param struct The MAVLink struct to serialize
268 */
269static inline void mavlink_msg_rc_channels_scaled_send_struct(mavlink_channel_t chan, const mavlink_rc_channels_scaled_t* rc_channels_scaled)
270{
271#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272 mavlink_msg_rc_channels_scaled_send(chan, 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);
273#else
274 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, (const char *)rc_channels_scaled, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
275#endif
276}
277
278#if MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
279/*
280 This varient of _send() can be used to save stack space by re-using
281 memory from the receive buffer. The caller provides a
282 mavlink_message_t which is the size of a full mavlink message. This
283 is usually the receive buffer for the channel, and allows a reply to an
284 incoming message with minimum stack space usage.
285 */
286static 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)
287{
288#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
289 char *buf = (char *)msgbuf;
290 _mav_put_uint32_t(buf, 0, time_boot_ms);
291 _mav_put_int16_t(buf, 4, chan1_scaled);
292 _mav_put_int16_t(buf, 6, chan2_scaled);
293 _mav_put_int16_t(buf, 8, chan3_scaled);
294 _mav_put_int16_t(buf, 10, chan4_scaled);
295 _mav_put_int16_t(buf, 12, chan5_scaled);
296 _mav_put_int16_t(buf, 14, chan6_scaled);
297 _mav_put_int16_t(buf, 16, chan7_scaled);
298 _mav_put_int16_t(buf, 18, chan8_scaled);
299 _mav_put_uint8_t(buf, 20, port);
300 _mav_put_uint8_t(buf, 21, rssi);
301
302 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, buf, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
303#else
304 mavlink_rc_channels_scaled_t *packet = (mavlink_rc_channels_scaled_t *)msgbuf;
305 packet->time_boot_ms = time_boot_ms;
306 packet->chan1_scaled = chan1_scaled;
307 packet->chan2_scaled = chan2_scaled;
308 packet->chan3_scaled = chan3_scaled;
309 packet->chan4_scaled = chan4_scaled;
310 packet->chan5_scaled = chan5_scaled;
311 packet->chan6_scaled = chan6_scaled;
312 packet->chan7_scaled = chan7_scaled;
313 packet->chan8_scaled = chan8_scaled;
314 packet->port = port;
315 packet->rssi = rssi;
316
317 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_SCALED, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_CRC);
318#endif
319}
320#endif
321
322#endif
323
324// MESSAGE RC_CHANNELS_SCALED UNPACKING
325
326
327/**
328 * @brief Get field time_boot_ms from rc_channels_scaled message
329 *
330 * @return Timestamp (milliseconds since system boot)
331 */
332static inline uint32_t mavlink_msg_rc_channels_scaled_get_time_boot_ms(const mavlink_message_t* msg)
333{
334 return _MAV_RETURN_uint32_t(msg, 0);
335}
336
337/**
338 * @brief Get field port from rc_channels_scaled message
339 *
340 * @return Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
341 */
342static inline uint8_t mavlink_msg_rc_channels_scaled_get_port(const mavlink_message_t* msg)
343{
344 return _MAV_RETURN_uint8_t(msg, 20);
345}
346
347/**
348 * @brief Get field chan1_scaled from rc_channels_scaled message
349 *
350 * @return RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
351 */
352static inline int16_t mavlink_msg_rc_channels_scaled_get_chan1_scaled(const mavlink_message_t* msg)
353{
354 return _MAV_RETURN_int16_t(msg, 4);
355}
356
357/**
358 * @brief Get field chan2_scaled from rc_channels_scaled message
359 *
360 * @return RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
361 */
362static inline int16_t mavlink_msg_rc_channels_scaled_get_chan2_scaled(const mavlink_message_t* msg)
363{
364 return _MAV_RETURN_int16_t(msg, 6);
365}
366
367/**
368 * @brief Get field chan3_scaled from rc_channels_scaled message
369 *
370 * @return RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
371 */
372static inline int16_t mavlink_msg_rc_channels_scaled_get_chan3_scaled(const mavlink_message_t* msg)
373{
374 return _MAV_RETURN_int16_t(msg, 8);
375}
376
377/**
378 * @brief Get field chan4_scaled from rc_channels_scaled message
379 *
380 * @return RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
381 */
382static inline int16_t mavlink_msg_rc_channels_scaled_get_chan4_scaled(const mavlink_message_t* msg)
383{
384 return _MAV_RETURN_int16_t(msg, 10);
385}
386
387/**
388 * @brief Get field chan5_scaled from rc_channels_scaled message
389 *
390 * @return RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
391 */
392static inline int16_t mavlink_msg_rc_channels_scaled_get_chan5_scaled(const mavlink_message_t* msg)
393{
394 return _MAV_RETURN_int16_t(msg, 12);
395}
396
397/**
398 * @brief Get field chan6_scaled from rc_channels_scaled message
399 *
400 * @return RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
401 */
402static inline int16_t mavlink_msg_rc_channels_scaled_get_chan6_scaled(const mavlink_message_t* msg)
403{
404 return _MAV_RETURN_int16_t(msg, 14);
405}
406
407/**
408 * @brief Get field chan7_scaled from rc_channels_scaled message
409 *
410 * @return RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
411 */
412static inline int16_t mavlink_msg_rc_channels_scaled_get_chan7_scaled(const mavlink_message_t* msg)
413{
414 return _MAV_RETURN_int16_t(msg, 16);
415}
416
417/**
418 * @brief Get field chan8_scaled from rc_channels_scaled message
419 *
420 * @return RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX.
421 */
422static inline int16_t mavlink_msg_rc_channels_scaled_get_chan8_scaled(const mavlink_message_t* msg)
423{
424 return _MAV_RETURN_int16_t(msg, 18);
425}
426
427/**
428 * @brief Get field rssi from rc_channels_scaled message
429 *
430 * @return Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
431 */
432static inline uint8_t mavlink_msg_rc_channels_scaled_get_rssi(const mavlink_message_t* msg)
433{
434 return _MAV_RETURN_uint8_t(msg, 21);
435}
436
437/**
438 * @brief Decode a rc_channels_scaled message into a struct
439 *
440 * @param msg The message to decode
441 * @param rc_channels_scaled C-struct to decode the message contents into
442 */
443static inline void mavlink_msg_rc_channels_scaled_decode(const mavlink_message_t* msg, mavlink_rc_channels_scaled_t* rc_channels_scaled)
444{
445#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
446 rc_channels_scaled->time_boot_ms = mavlink_msg_rc_channels_scaled_get_time_boot_ms(msg);
447 rc_channels_scaled->chan1_scaled = mavlink_msg_rc_channels_scaled_get_chan1_scaled(msg);
448 rc_channels_scaled->chan2_scaled = mavlink_msg_rc_channels_scaled_get_chan2_scaled(msg);
449 rc_channels_scaled->chan3_scaled = mavlink_msg_rc_channels_scaled_get_chan3_scaled(msg);
450 rc_channels_scaled->chan4_scaled = mavlink_msg_rc_channels_scaled_get_chan4_scaled(msg);
451 rc_channels_scaled->chan5_scaled = mavlink_msg_rc_channels_scaled_get_chan5_scaled(msg);
452 rc_channels_scaled->chan6_scaled = mavlink_msg_rc_channels_scaled_get_chan6_scaled(msg);
453 rc_channels_scaled->chan7_scaled = mavlink_msg_rc_channels_scaled_get_chan7_scaled(msg);
454 rc_channels_scaled->chan8_scaled = mavlink_msg_rc_channels_scaled_get_chan8_scaled(msg);
455 rc_channels_scaled->port = mavlink_msg_rc_channels_scaled_get_port(msg);
456 rc_channels_scaled->rssi = mavlink_msg_rc_channels_scaled_get_rssi(msg);
457#else
458 uint8_t len = msg->len < MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN? msg->len : MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN;
459 memset(rc_channels_scaled, 0, MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN);
460 memcpy(rc_channels_scaled, _MAV_PAYLOAD(msg), len);
461#endif
462}
Note: See TracBrowser for help on using the repository browser.