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