Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_servo_output_raw.h
blobe8408862ff2e4e7e1ad3212e18e975b60dff46ba
1 // MESSAGE SERVO_OUTPUT_RAW PACKING
3 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW 36
5 typedef struct __mavlink_servo_output_raw_t
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.
17 } mavlink_servo_output_raw_t;
19 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN 21
20 #define MAVLINK_MSG_ID_36_LEN 21
22 #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC 222
23 #define MAVLINK_MSG_ID_36_CRC 222
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 } \
44 /**
45 * @brief Pack a servo_output_raw message
46 * @param system_id ID of this system
47 * @param component_id ID of this component (e.g. 200 for IMU)
48 * @param msg The MAVLink message to compress the data into
50 * @param time_usec Timestamp (microseconds since system boot)
51 * @param 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.
52 * @param servo1_raw Servo output 1 value, in microseconds
53 * @param servo2_raw Servo output 2 value, in microseconds
54 * @param servo3_raw Servo output 3 value, in microseconds
55 * @param servo4_raw Servo output 4 value, in microseconds
56 * @param servo5_raw Servo output 5 value, in microseconds
57 * @param servo6_raw Servo output 6 value, in microseconds
58 * @param servo7_raw Servo output 7 value, in microseconds
59 * @param servo8_raw Servo output 8 value, in microseconds
60 * @return length of the message in bytes (excluding serial stream start sign)
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)
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66 char buf[MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN];
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);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
79 #else
80 mavlink_servo_output_raw_t packet;
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;
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
93 #endif
95 msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW;
96 #if MAVLINK_CRC_EXTRA
97 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
98 #else
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
100 #endif
104 * @brief Pack a servo_output_raw message on a channel
105 * @param system_id ID of this system
106 * @param component_id ID of this component (e.g. 200 for IMU)
107 * @param chan The MAVLink channel this message will be sent over
108 * @param msg The MAVLink message to compress the data into
109 * @param time_usec Timestamp (microseconds since system boot)
110 * @param 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.
111 * @param servo1_raw Servo output 1 value, in microseconds
112 * @param servo2_raw Servo output 2 value, in microseconds
113 * @param servo3_raw Servo output 3 value, in microseconds
114 * @param servo4_raw Servo output 4 value, in microseconds
115 * @param servo5_raw Servo output 5 value, in microseconds
116 * @param servo6_raw Servo output 6 value, in microseconds
117 * @param servo7_raw Servo output 7 value, in microseconds
118 * @param servo8_raw Servo output 8 value, in microseconds
119 * @return length of the message in bytes (excluding serial stream start sign)
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)
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
126 char buf[MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN];
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);
138 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
139 #else
140 mavlink_servo_output_raw_t packet;
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;
152 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
153 #endif
155 msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW;
156 #if MAVLINK_CRC_EXTRA
157 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
158 #else
159 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN);
160 #endif
164 * @brief Encode a servo_output_raw struct
166 * @param system_id ID of this system
167 * @param component_id ID of this component (e.g. 200 for IMU)
168 * @param msg The MAVLink message to compress the data into
169 * @param servo_output_raw C-struct to read the message contents from
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)
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);
177 * @brief Encode a servo_output_raw struct on a channel
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param chan The MAVLink channel this message will be sent over
182 * @param msg The MAVLink message to compress the data into
183 * @param servo_output_raw C-struct to read the message contents from
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)
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);
191 * @brief Send a servo_output_raw message
192 * @param chan MAVLink channel to send the message
194 * @param time_usec Timestamp (microseconds since system boot)
195 * @param 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.
196 * @param servo1_raw Servo output 1 value, in microseconds
197 * @param servo2_raw Servo output 2 value, in microseconds
198 * @param servo3_raw Servo output 3 value, in microseconds
199 * @param servo4_raw Servo output 4 value, in microseconds
200 * @param servo5_raw Servo output 5 value, in microseconds
201 * @param servo6_raw Servo output 6 value, in microseconds
202 * @param servo7_raw Servo output 7 value, in microseconds
203 * @param servo8_raw Servo output 8 value, in microseconds
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
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)
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 char buf[MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN];
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);
222 #if MAVLINK_CRC_EXTRA
223 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
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
228 mavlink_servo_output_raw_t packet;
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;
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
248 #if MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
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)
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);
271 #if MAVLINK_CRC_EXTRA
272 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, buf, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_CRC);
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
277 mavlink_servo_output_raw_t *packet = (mavlink_servo_output_raw_t *)msgbuf;
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;
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
296 #endif
298 #endif
300 // MESSAGE SERVO_OUTPUT_RAW UNPACKING
304 * @brief Get field time_usec from servo_output_raw message
306 * @return Timestamp (microseconds since system boot)
308 static inline uint32_t mavlink_msg_servo_output_raw_get_time_usec(const mavlink_message_t* msg)
310 return _MAV_RETURN_uint32_t(msg, 0);
314 * @brief Get field port from servo_output_raw message
316 * @return Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos.
318 static inline uint8_t mavlink_msg_servo_output_raw_get_port(const mavlink_message_t* msg)
320 return _MAV_RETURN_uint8_t(msg, 20);
324 * @brief Get field servo1_raw from servo_output_raw message
326 * @return Servo output 1 value, in microseconds
328 static inline uint16_t mavlink_msg_servo_output_raw_get_servo1_raw(const mavlink_message_t* msg)
330 return _MAV_RETURN_uint16_t(msg, 4);
334 * @brief Get field servo2_raw from servo_output_raw message
336 * @return Servo output 2 value, in microseconds
338 static inline uint16_t mavlink_msg_servo_output_raw_get_servo2_raw(const mavlink_message_t* msg)
340 return _MAV_RETURN_uint16_t(msg, 6);
344 * @brief Get field servo3_raw from servo_output_raw message
346 * @return Servo output 3 value, in microseconds
348 static inline uint16_t mavlink_msg_servo_output_raw_get_servo3_raw(const mavlink_message_t* msg)
350 return _MAV_RETURN_uint16_t(msg, 8);
354 * @brief Get field servo4_raw from servo_output_raw message
356 * @return Servo output 4 value, in microseconds
358 static inline uint16_t mavlink_msg_servo_output_raw_get_servo4_raw(const mavlink_message_t* msg)
360 return _MAV_RETURN_uint16_t(msg, 10);
364 * @brief Get field servo5_raw from servo_output_raw message
366 * @return Servo output 5 value, in microseconds
368 static inline uint16_t mavlink_msg_servo_output_raw_get_servo5_raw(const mavlink_message_t* msg)
370 return _MAV_RETURN_uint16_t(msg, 12);
374 * @brief Get field servo6_raw from servo_output_raw message
376 * @return Servo output 6 value, in microseconds
378 static inline uint16_t mavlink_msg_servo_output_raw_get_servo6_raw(const mavlink_message_t* msg)
380 return _MAV_RETURN_uint16_t(msg, 14);
384 * @brief Get field servo7_raw from servo_output_raw message
386 * @return Servo output 7 value, in microseconds
388 static inline uint16_t mavlink_msg_servo_output_raw_get_servo7_raw(const mavlink_message_t* msg)
390 return _MAV_RETURN_uint16_t(msg, 16);
394 * @brief Get field servo8_raw from servo_output_raw message
396 * @return Servo output 8 value, in microseconds
398 static inline uint16_t mavlink_msg_servo_output_raw_get_servo8_raw(const mavlink_message_t* msg)
400 return _MAV_RETURN_uint16_t(msg, 18);
404 * @brief Decode a servo_output_raw message into a struct
406 * @param msg The message to decode
407 * @param servo_output_raw C-struct to decode the message contents into
409 static inline void mavlink_msg_servo_output_raw_decode(const mavlink_message_t* msg, mavlink_servo_output_raw_t* servo_output_raw)
411 #if MAVLINK_NEED_BYTE_SWAP
412 servo_output_raw->time_usec = mavlink_msg_servo_output_raw_get_time_usec(msg);
413 servo_output_raw->servo1_raw = mavlink_msg_servo_output_raw_get_servo1_raw(msg);
414 servo_output_raw->servo2_raw = mavlink_msg_servo_output_raw_get_servo2_raw(msg);
415 servo_output_raw->servo3_raw = mavlink_msg_servo_output_raw_get_servo3_raw(msg);
416 servo_output_raw->servo4_raw = mavlink_msg_servo_output_raw_get_servo4_raw(msg);
417 servo_output_raw->servo5_raw = mavlink_msg_servo_output_raw_get_servo5_raw(msg);
418 servo_output_raw->servo6_raw = mavlink_msg_servo_output_raw_get_servo6_raw(msg);
419 servo_output_raw->servo7_raw = mavlink_msg_servo_output_raw_get_servo7_raw(msg);
420 servo_output_raw->servo8_raw = mavlink_msg_servo_output_raw_get_servo8_raw(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