mavlink_msg_servo_output_raw.h
Go to the documentation of this file.
1 // MESSAGE SERVO_OUTPUT_RAW PACKING
2 
3 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW 36
4 
6 {
7  uint32_t time_usec; /*< Timestamp (microseconds since system boot)*/
8  uint16_t servo1_raw; /*< Servo output 1 value, in microseconds*/
9  uint16_t servo2_raw; /*< Servo output 2 value, in microseconds*/
10  uint16_t servo3_raw; /*< Servo output 3 value, in microseconds*/
11  uint16_t servo4_raw; /*< Servo output 4 value, in microseconds*/
12  uint16_t servo5_raw; /*< Servo output 5 value, in microseconds*/
13  uint16_t servo6_raw; /*< Servo output 6 value, in microseconds*/
14  uint16_t servo7_raw; /*< Servo output 7 value, in microseconds*/
15  uint16_t servo8_raw; /*< Servo output 8 value, in microseconds*/
16  uint8_t port; /*< Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos.*/
18 
19 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN 21
20 #define MAVLINK_MSG_ID_36_LEN 21
21 
22 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC 222
23 #define MAVLINK_MSG_ID_36_CRC 222
24 
25 
26 
27 #define MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW { \
28  "SERVO_OUTPUT_RAW", \
29  10, \
30  { { "time_usec", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_servo_output_raw_t, time_usec) }, \
31  { "servo1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_servo_output_raw_t, servo1_raw) }, \
32  { "servo2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_servo_output_raw_t, servo2_raw) }, \
33  { "servo3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_servo_output_raw_t, servo3_raw) }, \
34  { "servo4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_servo_output_raw_t, servo4_raw) }, \
35  { "servo5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_servo_output_raw_t, servo5_raw) }, \
36  { "servo6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_servo_output_raw_t, servo6_raw) }, \
37  { "servo7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_servo_output_raw_t, servo7_raw) }, \
38  { "servo8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_servo_output_raw_t, servo8_raw) }, \
39  { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_servo_output_raw_t, port) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_servo_output_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  uint32_t time_usec, uint8_t port, uint16_t servo1_raw, uint16_t servo2_raw, uint16_t servo3_raw, uint16_t servo4_raw, uint16_t servo5_raw, uint16_t servo6_raw, uint16_t servo7_raw, uint16_t servo8_raw)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67  _mav_put_uint32_t(buf, 0, time_usec);
68  _mav_put_uint16_t(buf, 4, servo1_raw);
69  _mav_put_uint16_t(buf, 6, servo2_raw);
70  _mav_put_uint16_t(buf, 8, servo3_raw);
71  _mav_put_uint16_t(buf, 10, servo4_raw);
72  _mav_put_uint16_t(buf, 12, servo5_raw);
73  _mav_put_uint16_t(buf, 14, servo6_raw);
74  _mav_put_uint16_t(buf, 16, servo7_raw);
75  _mav_put_uint16_t(buf, 18, servo8_raw);
76  _mav_put_uint8_t(buf, 20, port);
77 
79 #else
81  packet.time_usec = time_usec;
82  packet.servo1_raw = servo1_raw;
83  packet.servo2_raw = servo2_raw;
84  packet.servo3_raw = servo3_raw;
85  packet.servo4_raw = servo4_raw;
86  packet.servo5_raw = servo5_raw;
87  packet.servo6_raw = servo6_raw;
88  packet.servo7_raw = servo7_raw;
89  packet.servo8_raw = servo8_raw;
90  packet.port = port;
91 
93 #endif
94 
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
100 #endif
101 }
102 
121 static inline uint16_t mavlink_msg_servo_output_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
122  mavlink_message_t* msg,
123  uint32_t time_usec,uint8_t port,uint16_t servo1_raw,uint16_t servo2_raw,uint16_t servo3_raw,uint16_t servo4_raw,uint16_t servo5_raw,uint16_t servo6_raw,uint16_t servo7_raw,uint16_t servo8_raw)
124 {
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
127  _mav_put_uint32_t(buf, 0, time_usec);
128  _mav_put_uint16_t(buf, 4, servo1_raw);
129  _mav_put_uint16_t(buf, 6, servo2_raw);
130  _mav_put_uint16_t(buf, 8, servo3_raw);
131  _mav_put_uint16_t(buf, 10, servo4_raw);
132  _mav_put_uint16_t(buf, 12, servo5_raw);
133  _mav_put_uint16_t(buf, 14, servo6_raw);
134  _mav_put_uint16_t(buf, 16, servo7_raw);
135  _mav_put_uint16_t(buf, 18, servo8_raw);
136  _mav_put_uint8_t(buf, 20, port);
137 
139 #else
141  packet.time_usec = time_usec;
142  packet.servo1_raw = servo1_raw;
143  packet.servo2_raw = servo2_raw;
144  packet.servo3_raw = servo3_raw;
145  packet.servo4_raw = servo4_raw;
146  packet.servo5_raw = servo5_raw;
147  packet.servo6_raw = servo6_raw;
148  packet.servo7_raw = servo7_raw;
149  packet.servo8_raw = servo8_raw;
150  packet.port = port;
151 
153 #endif
154 
155  msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW;
156 #if MAVLINK_CRC_EXTRA
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_servo_output_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_servo_output_raw_t* servo_output_raw)
172 {
173  return mavlink_msg_servo_output_raw_pack(system_id, component_id, msg, servo_output_raw->time_usec, servo_output_raw->port, servo_output_raw->servo1_raw, servo_output_raw->servo2_raw, servo_output_raw->servo3_raw, servo_output_raw->servo4_raw, servo_output_raw->servo5_raw, servo_output_raw->servo6_raw, servo_output_raw->servo7_raw, servo_output_raw->servo8_raw);
174 }
175 
185 static inline uint16_t mavlink_msg_servo_output_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_servo_output_raw_t* servo_output_raw)
186 {
187  return mavlink_msg_servo_output_raw_pack_chan(system_id, component_id, chan, msg, servo_output_raw->time_usec, servo_output_raw->port, servo_output_raw->servo1_raw, servo_output_raw->servo2_raw, servo_output_raw->servo3_raw, servo_output_raw->servo4_raw, servo_output_raw->servo5_raw, servo_output_raw->servo6_raw, servo_output_raw->servo7_raw, servo_output_raw->servo8_raw);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_servo_output_raw_send(mavlink_channel_t chan, uint32_t time_usec, uint8_t port, uint16_t servo1_raw, uint16_t servo2_raw, uint16_t servo3_raw, uint16_t servo4_raw, uint16_t servo5_raw, uint16_t servo6_raw, uint16_t servo7_raw, uint16_t servo8_raw)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211  _mav_put_uint32_t(buf, 0, time_usec);
212  _mav_put_uint16_t(buf, 4, servo1_raw);
213  _mav_put_uint16_t(buf, 6, servo2_raw);
214  _mav_put_uint16_t(buf, 8, servo3_raw);
215  _mav_put_uint16_t(buf, 10, servo4_raw);
216  _mav_put_uint16_t(buf, 12, servo5_raw);
217  _mav_put_uint16_t(buf, 14, servo6_raw);
218  _mav_put_uint16_t(buf, 16, servo7_raw);
219  _mav_put_uint16_t(buf, 18, servo8_raw);
220  _mav_put_uint8_t(buf, 20, port);
221 
222 #if MAVLINK_CRC_EXTRA
224 #else
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
226 #endif
227 #else
229  packet.time_usec = time_usec;
230  packet.servo1_raw = servo1_raw;
231  packet.servo2_raw = servo2_raw;
232  packet.servo3_raw = servo3_raw;
233  packet.servo4_raw = servo4_raw;
234  packet.servo5_raw = servo5_raw;
235  packet.servo6_raw = servo6_raw;
236  packet.servo7_raw = servo7_raw;
237  packet.servo8_raw = servo8_raw;
238  packet.port = port;
239 
240 #if MAVLINK_CRC_EXTRA
241  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, (const char *)&packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
242 #else
243  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, (const char *)&packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
244 #endif
245 #endif
246 }
247 
248 #if MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
249 /*
250  This varient of _send() can be used to save stack space by re-using
251  memory from the receive buffer. The caller provides a
252  mavlink_message_t which is the size of a full mavlink message. This
253  is usually the receive buffer for the channel, and allows a reply to an
254  incoming message with minimum stack space usage.
255  */
256 static inline void mavlink_msg_servo_output_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_usec, uint8_t port, uint16_t servo1_raw, uint16_t servo2_raw, uint16_t servo3_raw, uint16_t servo4_raw, uint16_t servo5_raw, uint16_t servo6_raw, uint16_t servo7_raw, uint16_t servo8_raw)
257 {
258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259  char *buf = (char *)msgbuf;
260  _mav_put_uint32_t(buf, 0, time_usec);
261  _mav_put_uint16_t(buf, 4, servo1_raw);
262  _mav_put_uint16_t(buf, 6, servo2_raw);
263  _mav_put_uint16_t(buf, 8, servo3_raw);
264  _mav_put_uint16_t(buf, 10, servo4_raw);
265  _mav_put_uint16_t(buf, 12, servo5_raw);
266  _mav_put_uint16_t(buf, 14, servo6_raw);
267  _mav_put_uint16_t(buf, 16, servo7_raw);
268  _mav_put_uint16_t(buf, 18, servo8_raw);
269  _mav_put_uint8_t(buf, 20, port);
270 
271 #if MAVLINK_CRC_EXTRA
273 #else
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
275 #endif
276 #else
278  packet->time_usec = time_usec;
279  packet->servo1_raw = servo1_raw;
280  packet->servo2_raw = servo2_raw;
281  packet->servo3_raw = servo3_raw;
282  packet->servo4_raw = servo4_raw;
283  packet->servo5_raw = servo5_raw;
284  packet->servo6_raw = servo6_raw;
285  packet->servo7_raw = servo7_raw;
286  packet->servo8_raw = servo8_raw;
287  packet->port = port;
288 
289 #if MAVLINK_CRC_EXTRA
290  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, (const char *)packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, (const char *)packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
293 #endif
294 #endif
295 }
296 #endif
297 
298 #endif
299 
300 // MESSAGE SERVO_OUTPUT_RAW UNPACKING
301 
302 
308 static inline uint32_t mavlink_msg_servo_output_raw_get_time_usec(const mavlink_message_t* msg)
309 {
310  return _MAV_RETURN_uint32_t(msg, 0);
311 }
312 
318 static inline uint8_t mavlink_msg_servo_output_raw_get_port(const mavlink_message_t* msg)
319 {
320  return _MAV_RETURN_uint8_t(msg, 20);
321 }
322 
328 static inline uint16_t mavlink_msg_servo_output_raw_get_servo1_raw(const mavlink_message_t* msg)
329 {
330  return _MAV_RETURN_uint16_t(msg, 4);
331 }
332 
338 static inline uint16_t mavlink_msg_servo_output_raw_get_servo2_raw(const mavlink_message_t* msg)
339 {
340  return _MAV_RETURN_uint16_t(msg, 6);
341 }
342 
348 static inline uint16_t mavlink_msg_servo_output_raw_get_servo3_raw(const mavlink_message_t* msg)
349 {
350  return _MAV_RETURN_uint16_t(msg, 8);
351 }
352 
358 static inline uint16_t mavlink_msg_servo_output_raw_get_servo4_raw(const mavlink_message_t* msg)
359 {
360  return _MAV_RETURN_uint16_t(msg, 10);
361 }
362 
368 static inline uint16_t mavlink_msg_servo_output_raw_get_servo5_raw(const mavlink_message_t* msg)
369 {
370  return _MAV_RETURN_uint16_t(msg, 12);
371 }
372 
378 static inline uint16_t mavlink_msg_servo_output_raw_get_servo6_raw(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_uint16_t(msg, 14);
381 }
382 
388 static inline uint16_t mavlink_msg_servo_output_raw_get_servo7_raw(const mavlink_message_t* msg)
389 {
390  return _MAV_RETURN_uint16_t(msg, 16);
391 }
392 
398 static inline uint16_t mavlink_msg_servo_output_raw_get_servo8_raw(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_uint16_t(msg, 18);
401 }
402 
409 static inline void mavlink_msg_servo_output_raw_decode(const mavlink_message_t* msg, mavlink_servo_output_raw_t* servo_output_raw)
410 {
411 #if MAVLINK_NEED_BYTE_SWAP
412  servo_output_raw->time_usec = mavlink_msg_servo_output_raw_get_time_usec(msg);
421  servo_output_raw->port = mavlink_msg_servo_output_raw_get_port(msg);
422 #else
423  memcpy(servo_output_raw, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
424 #endif
425 }
#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_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25