Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE SERVO_OUTPUT_RAW PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW 36 |
||
4 | |||
5 | typedef struct __mavlink_servo_output_raw_t |
||
6 | { |
||
7 | uint32_t time_usec; ///< Timestamp (since UNIX epoch or 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; |
||
18 | |||
19 | #define MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN 21 |
||
20 | #define MAVLINK_MSG_ID_36_LEN 21 |
||
21 | |||
22 | |||
23 | |||
24 | #define MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW { \ |
||
25 | "SERVO_OUTPUT_RAW", \ |
||
26 | 10, \ |
||
27 | { { "time_usec", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_servo_output_raw_t, time_usec) }, \ |
||
28 | { "servo1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_servo_output_raw_t, servo1_raw) }, \ |
||
29 | { "servo2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_servo_output_raw_t, servo2_raw) }, \ |
||
30 | { "servo3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_servo_output_raw_t, servo3_raw) }, \ |
||
31 | { "servo4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_servo_output_raw_t, servo4_raw) }, \ |
||
32 | { "servo5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_servo_output_raw_t, servo5_raw) }, \ |
||
33 | { "servo6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_servo_output_raw_t, servo6_raw) }, \ |
||
34 | { "servo7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_servo_output_raw_t, servo7_raw) }, \ |
||
35 | { "servo8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_servo_output_raw_t, servo8_raw) }, \ |
||
36 | { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_servo_output_raw_t, port) }, \ |
||
37 | } \ |
||
38 | } |
||
39 | |||
40 | |||
41 | /** |
||
42 | * @brief Pack a servo_output_raw message |
||
43 | * @param system_id ID of this system |
||
44 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
45 | * @param msg The MAVLink message to compress the data into |
||
46 | * |
||
47 | * @param time_usec Timestamp (since UNIX epoch or microseconds since system boot) |
||
48 | * @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. |
||
49 | * @param servo1_raw Servo output 1 value, in microseconds |
||
50 | * @param servo2_raw Servo output 2 value, in microseconds |
||
51 | * @param servo3_raw Servo output 3 value, in microseconds |
||
52 | * @param servo4_raw Servo output 4 value, in microseconds |
||
53 | * @param servo5_raw Servo output 5 value, in microseconds |
||
54 | * @param servo6_raw Servo output 6 value, in microseconds |
||
55 | * @param servo7_raw Servo output 7 value, in microseconds |
||
56 | * @param servo8_raw Servo output 8 value, in microseconds |
||
57 | * @return length of the message in bytes (excluding serial stream start sign) |
||
58 | */ |
||
59 | static inline uint16_t mavlink_msg_servo_output_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
60 | 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) |
||
61 | { |
||
62 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
63 | char buf[21]; |
||
64 | _mav_put_uint32_t(buf, 0, time_usec); |
||
65 | _mav_put_uint16_t(buf, 4, servo1_raw); |
||
66 | _mav_put_uint16_t(buf, 6, servo2_raw); |
||
67 | _mav_put_uint16_t(buf, 8, servo3_raw); |
||
68 | _mav_put_uint16_t(buf, 10, servo4_raw); |
||
69 | _mav_put_uint16_t(buf, 12, servo5_raw); |
||
70 | _mav_put_uint16_t(buf, 14, servo6_raw); |
||
71 | _mav_put_uint16_t(buf, 16, servo7_raw); |
||
72 | _mav_put_uint16_t(buf, 18, servo8_raw); |
||
73 | _mav_put_uint8_t(buf, 20, port); |
||
74 | |||
75 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 21); |
||
76 | #else |
||
77 | mavlink_servo_output_raw_t packet; |
||
78 | packet.time_usec = time_usec; |
||
79 | packet.servo1_raw = servo1_raw; |
||
80 | packet.servo2_raw = servo2_raw; |
||
81 | packet.servo3_raw = servo3_raw; |
||
82 | packet.servo4_raw = servo4_raw; |
||
83 | packet.servo5_raw = servo5_raw; |
||
84 | packet.servo6_raw = servo6_raw; |
||
85 | packet.servo7_raw = servo7_raw; |
||
86 | packet.servo8_raw = servo8_raw; |
||
87 | packet.port = port; |
||
88 | |||
89 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 21); |
||
90 | #endif |
||
91 | |||
92 | msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; |
||
93 | return mavlink_finalize_message(msg, system_id, component_id, 21, 222); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @brief Pack a servo_output_raw message on a channel |
||
98 | * @param system_id ID of this system |
||
99 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
100 | * @param chan The MAVLink channel this message was sent over |
||
101 | * @param msg The MAVLink message to compress the data into |
||
102 | * @param time_usec Timestamp (since UNIX epoch or microseconds since system boot) |
||
103 | * @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. |
||
104 | * @param servo1_raw Servo output 1 value, in microseconds |
||
105 | * @param servo2_raw Servo output 2 value, in microseconds |
||
106 | * @param servo3_raw Servo output 3 value, in microseconds |
||
107 | * @param servo4_raw Servo output 4 value, in microseconds |
||
108 | * @param servo5_raw Servo output 5 value, in microseconds |
||
109 | * @param servo6_raw Servo output 6 value, in microseconds |
||
110 | * @param servo7_raw Servo output 7 value, in microseconds |
||
111 | * @param servo8_raw Servo output 8 value, in microseconds |
||
112 | * @return length of the message in bytes (excluding serial stream start sign) |
||
113 | */ |
||
114 | static inline uint16_t mavlink_msg_servo_output_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
115 | mavlink_message_t* msg, |
||
116 | 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) |
||
117 | { |
||
118 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
119 | char buf[21]; |
||
120 | _mav_put_uint32_t(buf, 0, time_usec); |
||
121 | _mav_put_uint16_t(buf, 4, servo1_raw); |
||
122 | _mav_put_uint16_t(buf, 6, servo2_raw); |
||
123 | _mav_put_uint16_t(buf, 8, servo3_raw); |
||
124 | _mav_put_uint16_t(buf, 10, servo4_raw); |
||
125 | _mav_put_uint16_t(buf, 12, servo5_raw); |
||
126 | _mav_put_uint16_t(buf, 14, servo6_raw); |
||
127 | _mav_put_uint16_t(buf, 16, servo7_raw); |
||
128 | _mav_put_uint16_t(buf, 18, servo8_raw); |
||
129 | _mav_put_uint8_t(buf, 20, port); |
||
130 | |||
131 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 21); |
||
132 | #else |
||
133 | mavlink_servo_output_raw_t packet; |
||
134 | packet.time_usec = time_usec; |
||
135 | packet.servo1_raw = servo1_raw; |
||
136 | packet.servo2_raw = servo2_raw; |
||
137 | packet.servo3_raw = servo3_raw; |
||
138 | packet.servo4_raw = servo4_raw; |
||
139 | packet.servo5_raw = servo5_raw; |
||
140 | packet.servo6_raw = servo6_raw; |
||
141 | packet.servo7_raw = servo7_raw; |
||
142 | packet.servo8_raw = servo8_raw; |
||
143 | packet.port = port; |
||
144 | |||
145 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 21); |
||
146 | #endif |
||
147 | |||
148 | msg->msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; |
||
149 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 21, 222); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @brief Encode a servo_output_raw struct into a message |
||
154 | * |
||
155 | * @param system_id ID of this system |
||
156 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
157 | * @param msg The MAVLink message to compress the data into |
||
158 | * @param servo_output_raw C-struct to read the message contents from |
||
159 | */ |
||
160 | 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) |
||
161 | { |
||
162 | 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); |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @brief Send a servo_output_raw message |
||
167 | * @param chan MAVLink channel to send the message |
||
168 | * |
||
169 | * @param time_usec Timestamp (since UNIX epoch or microseconds since system boot) |
||
170 | * @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. |
||
171 | * @param servo1_raw Servo output 1 value, in microseconds |
||
172 | * @param servo2_raw Servo output 2 value, in microseconds |
||
173 | * @param servo3_raw Servo output 3 value, in microseconds |
||
174 | * @param servo4_raw Servo output 4 value, in microseconds |
||
175 | * @param servo5_raw Servo output 5 value, in microseconds |
||
176 | * @param servo6_raw Servo output 6 value, in microseconds |
||
177 | * @param servo7_raw Servo output 7 value, in microseconds |
||
178 | * @param servo8_raw Servo output 8 value, in microseconds |
||
179 | */ |
||
180 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
181 | |||
182 | 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) |
||
183 | { |
||
184 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
185 | char buf[21]; |
||
186 | _mav_put_uint32_t(buf, 0, time_usec); |
||
187 | _mav_put_uint16_t(buf, 4, servo1_raw); |
||
188 | _mav_put_uint16_t(buf, 6, servo2_raw); |
||
189 | _mav_put_uint16_t(buf, 8, servo3_raw); |
||
190 | _mav_put_uint16_t(buf, 10, servo4_raw); |
||
191 | _mav_put_uint16_t(buf, 12, servo5_raw); |
||
192 | _mav_put_uint16_t(buf, 14, servo6_raw); |
||
193 | _mav_put_uint16_t(buf, 16, servo7_raw); |
||
194 | _mav_put_uint16_t(buf, 18, servo8_raw); |
||
195 | _mav_put_uint8_t(buf, 20, port); |
||
196 | |||
197 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, buf, 21, 222); |
||
198 | #else |
||
199 | mavlink_servo_output_raw_t packet; |
||
200 | packet.time_usec = time_usec; |
||
201 | packet.servo1_raw = servo1_raw; |
||
202 | packet.servo2_raw = servo2_raw; |
||
203 | packet.servo3_raw = servo3_raw; |
||
204 | packet.servo4_raw = servo4_raw; |
||
205 | packet.servo5_raw = servo5_raw; |
||
206 | packet.servo6_raw = servo6_raw; |
||
207 | packet.servo7_raw = servo7_raw; |
||
208 | packet.servo8_raw = servo8_raw; |
||
209 | packet.port = port; |
||
210 | |||
211 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, (const char *)&packet, 21, 222); |
||
212 | #endif |
||
213 | } |
||
214 | |||
215 | #endif |
||
216 | |||
217 | // MESSAGE SERVO_OUTPUT_RAW UNPACKING |
||
218 | |||
219 | |||
220 | /** |
||
221 | * @brief Get field time_usec from servo_output_raw message |
||
222 | * |
||
223 | * @return Timestamp (since UNIX epoch or microseconds since system boot) |
||
224 | */ |
||
225 | static inline uint32_t mavlink_msg_servo_output_raw_get_time_usec(const mavlink_message_t* msg) |
||
226 | { |
||
227 | return _MAV_RETURN_uint32_t(msg, 0); |
||
228 | } |
||
229 | |||
230 | /** |
||
231 | * @brief Get field port from servo_output_raw message |
||
232 | * |
||
233 | * @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. |
||
234 | */ |
||
235 | static inline uint8_t mavlink_msg_servo_output_raw_get_port(const mavlink_message_t* msg) |
||
236 | { |
||
237 | return _MAV_RETURN_uint8_t(msg, 20); |
||
238 | } |
||
239 | |||
240 | /** |
||
241 | * @brief Get field servo1_raw from servo_output_raw message |
||
242 | * |
||
243 | * @return Servo output 1 value, in microseconds |
||
244 | */ |
||
245 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo1_raw(const mavlink_message_t* msg) |
||
246 | { |
||
247 | return _MAV_RETURN_uint16_t(msg, 4); |
||
248 | } |
||
249 | |||
250 | /** |
||
251 | * @brief Get field servo2_raw from servo_output_raw message |
||
252 | * |
||
253 | * @return Servo output 2 value, in microseconds |
||
254 | */ |
||
255 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo2_raw(const mavlink_message_t* msg) |
||
256 | { |
||
257 | return _MAV_RETURN_uint16_t(msg, 6); |
||
258 | } |
||
259 | |||
260 | /** |
||
261 | * @brief Get field servo3_raw from servo_output_raw message |
||
262 | * |
||
263 | * @return Servo output 3 value, in microseconds |
||
264 | */ |
||
265 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo3_raw(const mavlink_message_t* msg) |
||
266 | { |
||
267 | return _MAV_RETURN_uint16_t(msg, 8); |
||
268 | } |
||
269 | |||
270 | /** |
||
271 | * @brief Get field servo4_raw from servo_output_raw message |
||
272 | * |
||
273 | * @return Servo output 4 value, in microseconds |
||
274 | */ |
||
275 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo4_raw(const mavlink_message_t* msg) |
||
276 | { |
||
277 | return _MAV_RETURN_uint16_t(msg, 10); |
||
278 | } |
||
279 | |||
280 | /** |
||
281 | * @brief Get field servo5_raw from servo_output_raw message |
||
282 | * |
||
283 | * @return Servo output 5 value, in microseconds |
||
284 | */ |
||
285 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo5_raw(const mavlink_message_t* msg) |
||
286 | { |
||
287 | return _MAV_RETURN_uint16_t(msg, 12); |
||
288 | } |
||
289 | |||
290 | /** |
||
291 | * @brief Get field servo6_raw from servo_output_raw message |
||
292 | * |
||
293 | * @return Servo output 6 value, in microseconds |
||
294 | */ |
||
295 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo6_raw(const mavlink_message_t* msg) |
||
296 | { |
||
297 | return _MAV_RETURN_uint16_t(msg, 14); |
||
298 | } |
||
299 | |||
300 | /** |
||
301 | * @brief Get field servo7_raw from servo_output_raw message |
||
302 | * |
||
303 | * @return Servo output 7 value, in microseconds |
||
304 | */ |
||
305 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo7_raw(const mavlink_message_t* msg) |
||
306 | { |
||
307 | return _MAV_RETURN_uint16_t(msg, 16); |
||
308 | } |
||
309 | |||
310 | /** |
||
311 | * @brief Get field servo8_raw from servo_output_raw message |
||
312 | * |
||
313 | * @return Servo output 8 value, in microseconds |
||
314 | */ |
||
315 | static inline uint16_t mavlink_msg_servo_output_raw_get_servo8_raw(const mavlink_message_t* msg) |
||
316 | { |
||
317 | return _MAV_RETURN_uint16_t(msg, 18); |
||
318 | } |
||
319 | |||
320 | /** |
||
321 | * @brief Decode a servo_output_raw message into a struct |
||
322 | * |
||
323 | * @param msg The message to decode |
||
324 | * @param servo_output_raw C-struct to decode the message contents into |
||
325 | */ |
||
326 | static inline void mavlink_msg_servo_output_raw_decode(const mavlink_message_t* msg, mavlink_servo_output_raw_t* servo_output_raw) |
||
327 | { |
||
328 | #if MAVLINK_NEED_BYTE_SWAP |
||
329 | servo_output_raw->time_usec = mavlink_msg_servo_output_raw_get_time_usec(msg); |
||
330 | servo_output_raw->servo1_raw = mavlink_msg_servo_output_raw_get_servo1_raw(msg); |
||
331 | servo_output_raw->servo2_raw = mavlink_msg_servo_output_raw_get_servo2_raw(msg); |
||
332 | servo_output_raw->servo3_raw = mavlink_msg_servo_output_raw_get_servo3_raw(msg); |
||
333 | servo_output_raw->servo4_raw = mavlink_msg_servo_output_raw_get_servo4_raw(msg); |
||
334 | servo_output_raw->servo5_raw = mavlink_msg_servo_output_raw_get_servo5_raw(msg); |
||
335 | servo_output_raw->servo6_raw = mavlink_msg_servo_output_raw_get_servo6_raw(msg); |
||
336 | servo_output_raw->servo7_raw = mavlink_msg_servo_output_raw_get_servo7_raw(msg); |
||
337 | servo_output_raw->servo8_raw = mavlink_msg_servo_output_raw_get_servo8_raw(msg); |
||
338 | servo_output_raw->port = mavlink_msg_servo_output_raw_get_port(msg); |
||
339 | #else |
||
340 | memcpy(servo_output_raw, _MAV_PAYLOAD(msg), 21); |
||
341 | #endif |
||
342 | } |