Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_hil_controls.h
blobf7507b1cf7f8f10629d12bad32204bfdce58cca6
1 // MESSAGE HIL_CONTROLS PACKING
3 #define MAVLINK_MSG_ID_HIL_CONTROLS 91
5 typedef struct __mavlink_hil_controls_t
7 uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
8 float roll_ailerons; ///< Control output -1 .. 1
9 float pitch_elevator; ///< Control output -1 .. 1
10 float yaw_rudder; ///< Control output -1 .. 1
11 float throttle; ///< Throttle 0 .. 1
12 float aux1; ///< Aux 1, -1 .. 1
13 float aux2; ///< Aux 2, -1 .. 1
14 float aux3; ///< Aux 3, -1 .. 1
15 float aux4; ///< Aux 4, -1 .. 1
16 uint8_t mode; ///< System mode (MAV_MODE)
17 uint8_t nav_mode; ///< Navigation mode (MAV_NAV_MODE)
18 } mavlink_hil_controls_t;
20 #define MAVLINK_MSG_ID_HIL_CONTROLS_LEN 42
21 #define MAVLINK_MSG_ID_91_LEN 42
23 #define MAVLINK_MSG_ID_HIL_CONTROLS_CRC 63
24 #define MAVLINK_MSG_ID_91_CRC 63
28 #define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
29 "HIL_CONTROLS", \
30 11, \
31 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
32 { "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
33 { "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
34 { "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
35 { "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
36 { "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
37 { "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
38 { "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
39 { "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
40 { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
41 { "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
42 } \
46 /**
47 * @brief Pack a hil_controls message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
52 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
53 * @param roll_ailerons Control output -1 .. 1
54 * @param pitch_elevator Control output -1 .. 1
55 * @param yaw_rudder Control output -1 .. 1
56 * @param throttle Throttle 0 .. 1
57 * @param aux1 Aux 1, -1 .. 1
58 * @param aux2 Aux 2, -1 .. 1
59 * @param aux3 Aux 3, -1 .. 1
60 * @param aux4 Aux 4, -1 .. 1
61 * @param mode System mode (MAV_MODE)
62 * @param nav_mode Navigation mode (MAV_NAV_MODE)
63 * @return length of the message in bytes (excluding serial stream start sign)
65 static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66 uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
69 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
70 _mav_put_uint64_t(buf, 0, time_usec);
71 _mav_put_float(buf, 8, roll_ailerons);
72 _mav_put_float(buf, 12, pitch_elevator);
73 _mav_put_float(buf, 16, yaw_rudder);
74 _mav_put_float(buf, 20, throttle);
75 _mav_put_float(buf, 24, aux1);
76 _mav_put_float(buf, 28, aux2);
77 _mav_put_float(buf, 32, aux3);
78 _mav_put_float(buf, 36, aux4);
79 _mav_put_uint8_t(buf, 40, mode);
80 _mav_put_uint8_t(buf, 41, nav_mode);
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
83 #else
84 mavlink_hil_controls_t packet;
85 packet.time_usec = time_usec;
86 packet.roll_ailerons = roll_ailerons;
87 packet.pitch_elevator = pitch_elevator;
88 packet.yaw_rudder = yaw_rudder;
89 packet.throttle = throttle;
90 packet.aux1 = aux1;
91 packet.aux2 = aux2;
92 packet.aux3 = aux3;
93 packet.aux4 = aux4;
94 packet.mode = mode;
95 packet.nav_mode = nav_mode;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
98 #endif
100 msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
101 #if MAVLINK_CRC_EXTRA
102 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
103 #else
104 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
105 #endif
109 * @brief Pack a hil_controls message on a channel
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param chan The MAVLink channel this message will be sent over
113 * @param msg The MAVLink message to compress the data into
114 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
115 * @param roll_ailerons Control output -1 .. 1
116 * @param pitch_elevator Control output -1 .. 1
117 * @param yaw_rudder Control output -1 .. 1
118 * @param throttle Throttle 0 .. 1
119 * @param aux1 Aux 1, -1 .. 1
120 * @param aux2 Aux 2, -1 .. 1
121 * @param aux3 Aux 3, -1 .. 1
122 * @param aux4 Aux 4, -1 .. 1
123 * @param mode System mode (MAV_MODE)
124 * @param nav_mode Navigation mode (MAV_NAV_MODE)
125 * @return length of the message in bytes (excluding serial stream start sign)
127 static inline uint16_t mavlink_msg_hil_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
128 mavlink_message_t* msg,
129 uint64_t time_usec,float roll_ailerons,float pitch_elevator,float yaw_rudder,float throttle,float aux1,float aux2,float aux3,float aux4,uint8_t mode,uint8_t nav_mode)
131 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
132 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
133 _mav_put_uint64_t(buf, 0, time_usec);
134 _mav_put_float(buf, 8, roll_ailerons);
135 _mav_put_float(buf, 12, pitch_elevator);
136 _mav_put_float(buf, 16, yaw_rudder);
137 _mav_put_float(buf, 20, throttle);
138 _mav_put_float(buf, 24, aux1);
139 _mav_put_float(buf, 28, aux2);
140 _mav_put_float(buf, 32, aux3);
141 _mav_put_float(buf, 36, aux4);
142 _mav_put_uint8_t(buf, 40, mode);
143 _mav_put_uint8_t(buf, 41, nav_mode);
145 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
146 #else
147 mavlink_hil_controls_t packet;
148 packet.time_usec = time_usec;
149 packet.roll_ailerons = roll_ailerons;
150 packet.pitch_elevator = pitch_elevator;
151 packet.yaw_rudder = yaw_rudder;
152 packet.throttle = throttle;
153 packet.aux1 = aux1;
154 packet.aux2 = aux2;
155 packet.aux3 = aux3;
156 packet.aux4 = aux4;
157 packet.mode = mode;
158 packet.nav_mode = nav_mode;
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
161 #endif
163 msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
164 #if MAVLINK_CRC_EXTRA
165 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
166 #else
167 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
168 #endif
172 * @brief Encode a hil_controls struct
174 * @param system_id ID of this system
175 * @param component_id ID of this component (e.g. 200 for IMU)
176 * @param msg The MAVLink message to compress the data into
177 * @param hil_controls C-struct to read the message contents from
179 static inline uint16_t mavlink_msg_hil_controls_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
181 return mavlink_msg_hil_controls_pack(system_id, component_id, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
185 * @brief Encode a hil_controls struct on a channel
187 * @param system_id ID of this system
188 * @param component_id ID of this component (e.g. 200 for IMU)
189 * @param chan The MAVLink channel this message will be sent over
190 * @param msg The MAVLink message to compress the data into
191 * @param hil_controls C-struct to read the message contents from
193 static inline uint16_t mavlink_msg_hil_controls_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
195 return mavlink_msg_hil_controls_pack_chan(system_id, component_id, chan, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
199 * @brief Send a hil_controls message
200 * @param chan MAVLink channel to send the message
202 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
203 * @param roll_ailerons Control output -1 .. 1
204 * @param pitch_elevator Control output -1 .. 1
205 * @param yaw_rudder Control output -1 .. 1
206 * @param throttle Throttle 0 .. 1
207 * @param aux1 Aux 1, -1 .. 1
208 * @param aux2 Aux 2, -1 .. 1
209 * @param aux3 Aux 3, -1 .. 1
210 * @param aux4 Aux 4, -1 .. 1
211 * @param mode System mode (MAV_MODE)
212 * @param nav_mode Navigation mode (MAV_NAV_MODE)
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
216 static inline void mavlink_msg_hil_controls_send(mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
219 char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
220 _mav_put_uint64_t(buf, 0, time_usec);
221 _mav_put_float(buf, 8, roll_ailerons);
222 _mav_put_float(buf, 12, pitch_elevator);
223 _mav_put_float(buf, 16, yaw_rudder);
224 _mav_put_float(buf, 20, throttle);
225 _mav_put_float(buf, 24, aux1);
226 _mav_put_float(buf, 28, aux2);
227 _mav_put_float(buf, 32, aux3);
228 _mav_put_float(buf, 36, aux4);
229 _mav_put_uint8_t(buf, 40, mode);
230 _mav_put_uint8_t(buf, 41, nav_mode);
232 #if MAVLINK_CRC_EXTRA
233 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
234 #else
235 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
236 #endif
237 #else
238 mavlink_hil_controls_t packet;
239 packet.time_usec = time_usec;
240 packet.roll_ailerons = roll_ailerons;
241 packet.pitch_elevator = pitch_elevator;
242 packet.yaw_rudder = yaw_rudder;
243 packet.throttle = throttle;
244 packet.aux1 = aux1;
245 packet.aux2 = aux2;
246 packet.aux3 = aux3;
247 packet.aux4 = aux4;
248 packet.mode = mode;
249 packet.nav_mode = nav_mode;
251 #if MAVLINK_CRC_EXTRA
252 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
253 #else
254 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
255 #endif
256 #endif
259 #if MAVLINK_MSG_ID_HIL_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
261 This varient of _send() can be used to save stack space by re-using
262 memory from the receive buffer. The caller provides a
263 mavlink_message_t which is the size of a full mavlink message. This
264 is usually the receive buffer for the channel, and allows a reply to an
265 incoming message with minimum stack space usage.
267 static inline void mavlink_msg_hil_controls_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
269 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 char *buf = (char *)msgbuf;
271 _mav_put_uint64_t(buf, 0, time_usec);
272 _mav_put_float(buf, 8, roll_ailerons);
273 _mav_put_float(buf, 12, pitch_elevator);
274 _mav_put_float(buf, 16, yaw_rudder);
275 _mav_put_float(buf, 20, throttle);
276 _mav_put_float(buf, 24, aux1);
277 _mav_put_float(buf, 28, aux2);
278 _mav_put_float(buf, 32, aux3);
279 _mav_put_float(buf, 36, aux4);
280 _mav_put_uint8_t(buf, 40, mode);
281 _mav_put_uint8_t(buf, 41, nav_mode);
283 #if MAVLINK_CRC_EXTRA
284 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
285 #else
286 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
287 #endif
288 #else
289 mavlink_hil_controls_t *packet = (mavlink_hil_controls_t *)msgbuf;
290 packet->time_usec = time_usec;
291 packet->roll_ailerons = roll_ailerons;
292 packet->pitch_elevator = pitch_elevator;
293 packet->yaw_rudder = yaw_rudder;
294 packet->throttle = throttle;
295 packet->aux1 = aux1;
296 packet->aux2 = aux2;
297 packet->aux3 = aux3;
298 packet->aux4 = aux4;
299 packet->mode = mode;
300 packet->nav_mode = nav_mode;
302 #if MAVLINK_CRC_EXTRA
303 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
304 #else
305 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
306 #endif
307 #endif
309 #endif
311 #endif
313 // MESSAGE HIL_CONTROLS UNPACKING
317 * @brief Get field time_usec from hil_controls message
319 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
321 static inline uint64_t mavlink_msg_hil_controls_get_time_usec(const mavlink_message_t* msg)
323 return _MAV_RETURN_uint64_t(msg, 0);
327 * @brief Get field roll_ailerons from hil_controls message
329 * @return Control output -1 .. 1
331 static inline float mavlink_msg_hil_controls_get_roll_ailerons(const mavlink_message_t* msg)
333 return _MAV_RETURN_float(msg, 8);
337 * @brief Get field pitch_elevator from hil_controls message
339 * @return Control output -1 .. 1
341 static inline float mavlink_msg_hil_controls_get_pitch_elevator(const mavlink_message_t* msg)
343 return _MAV_RETURN_float(msg, 12);
347 * @brief Get field yaw_rudder from hil_controls message
349 * @return Control output -1 .. 1
351 static inline float mavlink_msg_hil_controls_get_yaw_rudder(const mavlink_message_t* msg)
353 return _MAV_RETURN_float(msg, 16);
357 * @brief Get field throttle from hil_controls message
359 * @return Throttle 0 .. 1
361 static inline float mavlink_msg_hil_controls_get_throttle(const mavlink_message_t* msg)
363 return _MAV_RETURN_float(msg, 20);
367 * @brief Get field aux1 from hil_controls message
369 * @return Aux 1, -1 .. 1
371 static inline float mavlink_msg_hil_controls_get_aux1(const mavlink_message_t* msg)
373 return _MAV_RETURN_float(msg, 24);
377 * @brief Get field aux2 from hil_controls message
379 * @return Aux 2, -1 .. 1
381 static inline float mavlink_msg_hil_controls_get_aux2(const mavlink_message_t* msg)
383 return _MAV_RETURN_float(msg, 28);
387 * @brief Get field aux3 from hil_controls message
389 * @return Aux 3, -1 .. 1
391 static inline float mavlink_msg_hil_controls_get_aux3(const mavlink_message_t* msg)
393 return _MAV_RETURN_float(msg, 32);
397 * @brief Get field aux4 from hil_controls message
399 * @return Aux 4, -1 .. 1
401 static inline float mavlink_msg_hil_controls_get_aux4(const mavlink_message_t* msg)
403 return _MAV_RETURN_float(msg, 36);
407 * @brief Get field mode from hil_controls message
409 * @return System mode (MAV_MODE)
411 static inline uint8_t mavlink_msg_hil_controls_get_mode(const mavlink_message_t* msg)
413 return _MAV_RETURN_uint8_t(msg, 40);
417 * @brief Get field nav_mode from hil_controls message
419 * @return Navigation mode (MAV_NAV_MODE)
421 static inline uint8_t mavlink_msg_hil_controls_get_nav_mode(const mavlink_message_t* msg)
423 return _MAV_RETURN_uint8_t(msg, 41);
427 * @brief Decode a hil_controls message into a struct
429 * @param msg The message to decode
430 * @param hil_controls C-struct to decode the message contents into
432 static inline void mavlink_msg_hil_controls_decode(const mavlink_message_t* msg, mavlink_hil_controls_t* hil_controls)
434 #if MAVLINK_NEED_BYTE_SWAP
435 hil_controls->time_usec = mavlink_msg_hil_controls_get_time_usec(msg);
436 hil_controls->roll_ailerons = mavlink_msg_hil_controls_get_roll_ailerons(msg);
437 hil_controls->pitch_elevator = mavlink_msg_hil_controls_get_pitch_elevator(msg);
438 hil_controls->yaw_rudder = mavlink_msg_hil_controls_get_yaw_rudder(msg);
439 hil_controls->throttle = mavlink_msg_hil_controls_get_throttle(msg);
440 hil_controls->aux1 = mavlink_msg_hil_controls_get_aux1(msg);
441 hil_controls->aux2 = mavlink_msg_hil_controls_get_aux2(msg);
442 hil_controls->aux3 = mavlink_msg_hil_controls_get_aux3(msg);
443 hil_controls->aux4 = mavlink_msg_hil_controls_get_aux4(msg);
444 hil_controls->mode = mavlink_msg_hil_controls_get_mode(msg);
445 hil_controls->nav_mode = mavlink_msg_hil_controls_get_nav_mode(msg);
446 #else
447 memcpy(hil_controls, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
448 #endif