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