Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_command_long.h
blob161896b9730ae09f185c8c9623a3b4b5ddcc8bea
1 // MESSAGE COMMAND_LONG PACKING
3 #define MAVLINK_MSG_ID_COMMAND_LONG 76
5 typedef struct __mavlink_command_long_t
7 float param1; ///< Parameter 1, as defined by MAV_CMD enum.
8 float param2; ///< Parameter 2, as defined by MAV_CMD enum.
9 float param3; ///< Parameter 3, as defined by MAV_CMD enum.
10 float param4; ///< Parameter 4, as defined by MAV_CMD enum.
11 float param5; ///< Parameter 5, as defined by MAV_CMD enum.
12 float param6; ///< Parameter 6, as defined by MAV_CMD enum.
13 float param7; ///< Parameter 7, as defined by MAV_CMD enum.
14 uint16_t command; ///< Command ID, as defined by MAV_CMD enum.
15 uint8_t target_system; ///< System which should execute the command
16 uint8_t target_component; ///< Component which should execute the command, 0 for all components
17 uint8_t confirmation; ///< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
18 } mavlink_command_long_t;
20 #define MAVLINK_MSG_ID_COMMAND_LONG_LEN 33
21 #define MAVLINK_MSG_ID_76_LEN 33
23 #define MAVLINK_MSG_ID_COMMAND_LONG_CRC 152
24 #define MAVLINK_MSG_ID_76_CRC 152
28 #define MAVLINK_MESSAGE_INFO_COMMAND_LONG { \
29 "COMMAND_LONG", \
30 11, \
31 { { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_long_t, param1) }, \
32 { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_long_t, param2) }, \
33 { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_long_t, param3) }, \
34 { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_t, param4) }, \
35 { "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_t, param5) }, \
36 { "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_t, param6) }, \
37 { "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_t, param7) }, \
38 { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_long_t, command) }, \
39 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_long_t, target_system) }, \
40 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_long_t, target_component) }, \
41 { "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_long_t, confirmation) }, \
42 } \
46 /**
47 * @brief Pack a command_long 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 target_system System which should execute the command
53 * @param target_component Component which should execute the command, 0 for all components
54 * @param command Command ID, as defined by MAV_CMD enum.
55 * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
56 * @param param1 Parameter 1, as defined by MAV_CMD enum.
57 * @param param2 Parameter 2, as defined by MAV_CMD enum.
58 * @param param3 Parameter 3, as defined by MAV_CMD enum.
59 * @param param4 Parameter 4, as defined by MAV_CMD enum.
60 * @param param5 Parameter 5, as defined by MAV_CMD enum.
61 * @param param6 Parameter 6, as defined by MAV_CMD enum.
62 * @param param7 Parameter 7, as defined by MAV_CMD enum.
63 * @return length of the message in bytes (excluding serial stream start sign)
65 static inline uint16_t mavlink_msg_command_long_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66 uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
69 char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
70 _mav_put_float(buf, 0, param1);
71 _mav_put_float(buf, 4, param2);
72 _mav_put_float(buf, 8, param3);
73 _mav_put_float(buf, 12, param4);
74 _mav_put_float(buf, 16, param5);
75 _mav_put_float(buf, 20, param6);
76 _mav_put_float(buf, 24, param7);
77 _mav_put_uint16_t(buf, 28, command);
78 _mav_put_uint8_t(buf, 30, target_system);
79 _mav_put_uint8_t(buf, 31, target_component);
80 _mav_put_uint8_t(buf, 32, confirmation);
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
83 #else
84 mavlink_command_long_t packet;
85 packet.param1 = param1;
86 packet.param2 = param2;
87 packet.param3 = param3;
88 packet.param4 = param4;
89 packet.param5 = param5;
90 packet.param6 = param6;
91 packet.param7 = param7;
92 packet.command = command;
93 packet.target_system = target_system;
94 packet.target_component = target_component;
95 packet.confirmation = confirmation;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
98 #endif
100 msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
101 #if MAVLINK_CRC_EXTRA
102 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
103 #else
104 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
105 #endif
109 * @brief Pack a command_long 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 target_system System which should execute the command
115 * @param target_component Component which should execute the command, 0 for all components
116 * @param command Command ID, as defined by MAV_CMD enum.
117 * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
118 * @param param1 Parameter 1, as defined by MAV_CMD enum.
119 * @param param2 Parameter 2, as defined by MAV_CMD enum.
120 * @param param3 Parameter 3, as defined by MAV_CMD enum.
121 * @param param4 Parameter 4, as defined by MAV_CMD enum.
122 * @param param5 Parameter 5, as defined by MAV_CMD enum.
123 * @param param6 Parameter 6, as defined by MAV_CMD enum.
124 * @param param7 Parameter 7, as defined by MAV_CMD enum.
125 * @return length of the message in bytes (excluding serial stream start sign)
127 static inline uint16_t mavlink_msg_command_long_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
128 mavlink_message_t* msg,
129 uint8_t target_system,uint8_t target_component,uint16_t command,uint8_t confirmation,float param1,float param2,float param3,float param4,float param5,float param6,float param7)
131 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
132 char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
133 _mav_put_float(buf, 0, param1);
134 _mav_put_float(buf, 4, param2);
135 _mav_put_float(buf, 8, param3);
136 _mav_put_float(buf, 12, param4);
137 _mav_put_float(buf, 16, param5);
138 _mav_put_float(buf, 20, param6);
139 _mav_put_float(buf, 24, param7);
140 _mav_put_uint16_t(buf, 28, command);
141 _mav_put_uint8_t(buf, 30, target_system);
142 _mav_put_uint8_t(buf, 31, target_component);
143 _mav_put_uint8_t(buf, 32, confirmation);
145 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
146 #else
147 mavlink_command_long_t packet;
148 packet.param1 = param1;
149 packet.param2 = param2;
150 packet.param3 = param3;
151 packet.param4 = param4;
152 packet.param5 = param5;
153 packet.param6 = param6;
154 packet.param7 = param7;
155 packet.command = command;
156 packet.target_system = target_system;
157 packet.target_component = target_component;
158 packet.confirmation = confirmation;
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
161 #endif
163 msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
164 #if MAVLINK_CRC_EXTRA
165 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
166 #else
167 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
168 #endif
172 * @brief Encode a command_long 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 command_long C-struct to read the message contents from
179 static inline uint16_t mavlink_msg_command_long_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_long_t* command_long)
181 return mavlink_msg_command_long_pack(system_id, component_id, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7);
185 * @brief Encode a command_long 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 command_long C-struct to read the message contents from
193 static inline uint16_t mavlink_msg_command_long_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_long_t* command_long)
195 return mavlink_msg_command_long_pack_chan(system_id, component_id, chan, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7);
199 * @brief Send a command_long message
200 * @param chan MAVLink channel to send the message
202 * @param target_system System which should execute the command
203 * @param target_component Component which should execute the command, 0 for all components
204 * @param command Command ID, as defined by MAV_CMD enum.
205 * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
206 * @param param1 Parameter 1, as defined by MAV_CMD enum.
207 * @param param2 Parameter 2, as defined by MAV_CMD enum.
208 * @param param3 Parameter 3, as defined by MAV_CMD enum.
209 * @param param4 Parameter 4, as defined by MAV_CMD enum.
210 * @param param5 Parameter 5, as defined by MAV_CMD enum.
211 * @param param6 Parameter 6, as defined by MAV_CMD enum.
212 * @param param7 Parameter 7, as defined by MAV_CMD enum.
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
216 static inline void mavlink_msg_command_long_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
219 char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
220 _mav_put_float(buf, 0, param1);
221 _mav_put_float(buf, 4, param2);
222 _mav_put_float(buf, 8, param3);
223 _mav_put_float(buf, 12, param4);
224 _mav_put_float(buf, 16, param5);
225 _mav_put_float(buf, 20, param6);
226 _mav_put_float(buf, 24, param7);
227 _mav_put_uint16_t(buf, 28, command);
228 _mav_put_uint8_t(buf, 30, target_system);
229 _mav_put_uint8_t(buf, 31, target_component);
230 _mav_put_uint8_t(buf, 32, confirmation);
232 #if MAVLINK_CRC_EXTRA
233 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
234 #else
235 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
236 #endif
237 #else
238 mavlink_command_long_t packet;
239 packet.param1 = param1;
240 packet.param2 = param2;
241 packet.param3 = param3;
242 packet.param4 = param4;
243 packet.param5 = param5;
244 packet.param6 = param6;
245 packet.param7 = param7;
246 packet.command = command;
247 packet.target_system = target_system;
248 packet.target_component = target_component;
249 packet.confirmation = confirmation;
251 #if MAVLINK_CRC_EXTRA
252 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
253 #else
254 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
255 #endif
256 #endif
259 #if MAVLINK_MSG_ID_COMMAND_LONG_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_command_long_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
269 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 char *buf = (char *)msgbuf;
271 _mav_put_float(buf, 0, param1);
272 _mav_put_float(buf, 4, param2);
273 _mav_put_float(buf, 8, param3);
274 _mav_put_float(buf, 12, param4);
275 _mav_put_float(buf, 16, param5);
276 _mav_put_float(buf, 20, param6);
277 _mav_put_float(buf, 24, param7);
278 _mav_put_uint16_t(buf, 28, command);
279 _mav_put_uint8_t(buf, 30, target_system);
280 _mav_put_uint8_t(buf, 31, target_component);
281 _mav_put_uint8_t(buf, 32, confirmation);
283 #if MAVLINK_CRC_EXTRA
284 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
285 #else
286 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
287 #endif
288 #else
289 mavlink_command_long_t *packet = (mavlink_command_long_t *)msgbuf;
290 packet->param1 = param1;
291 packet->param2 = param2;
292 packet->param3 = param3;
293 packet->param4 = param4;
294 packet->param5 = param5;
295 packet->param6 = param6;
296 packet->param7 = param7;
297 packet->command = command;
298 packet->target_system = target_system;
299 packet->target_component = target_component;
300 packet->confirmation = confirmation;
302 #if MAVLINK_CRC_EXTRA
303 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
304 #else
305 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
306 #endif
307 #endif
309 #endif
311 #endif
313 // MESSAGE COMMAND_LONG UNPACKING
317 * @brief Get field target_system from command_long message
319 * @return System which should execute the command
321 static inline uint8_t mavlink_msg_command_long_get_target_system(const mavlink_message_t* msg)
323 return _MAV_RETURN_uint8_t(msg, 30);
327 * @brief Get field target_component from command_long message
329 * @return Component which should execute the command, 0 for all components
331 static inline uint8_t mavlink_msg_command_long_get_target_component(const mavlink_message_t* msg)
333 return _MAV_RETURN_uint8_t(msg, 31);
337 * @brief Get field command from command_long message
339 * @return Command ID, as defined by MAV_CMD enum.
341 static inline uint16_t mavlink_msg_command_long_get_command(const mavlink_message_t* msg)
343 return _MAV_RETURN_uint16_t(msg, 28);
347 * @brief Get field confirmation from command_long message
349 * @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
351 static inline uint8_t mavlink_msg_command_long_get_confirmation(const mavlink_message_t* msg)
353 return _MAV_RETURN_uint8_t(msg, 32);
357 * @brief Get field param1 from command_long message
359 * @return Parameter 1, as defined by MAV_CMD enum.
361 static inline float mavlink_msg_command_long_get_param1(const mavlink_message_t* msg)
363 return _MAV_RETURN_float(msg, 0);
367 * @brief Get field param2 from command_long message
369 * @return Parameter 2, as defined by MAV_CMD enum.
371 static inline float mavlink_msg_command_long_get_param2(const mavlink_message_t* msg)
373 return _MAV_RETURN_float(msg, 4);
377 * @brief Get field param3 from command_long message
379 * @return Parameter 3, as defined by MAV_CMD enum.
381 static inline float mavlink_msg_command_long_get_param3(const mavlink_message_t* msg)
383 return _MAV_RETURN_float(msg, 8);
387 * @brief Get field param4 from command_long message
389 * @return Parameter 4, as defined by MAV_CMD enum.
391 static inline float mavlink_msg_command_long_get_param4(const mavlink_message_t* msg)
393 return _MAV_RETURN_float(msg, 12);
397 * @brief Get field param5 from command_long message
399 * @return Parameter 5, as defined by MAV_CMD enum.
401 static inline float mavlink_msg_command_long_get_param5(const mavlink_message_t* msg)
403 return _MAV_RETURN_float(msg, 16);
407 * @brief Get field param6 from command_long message
409 * @return Parameter 6, as defined by MAV_CMD enum.
411 static inline float mavlink_msg_command_long_get_param6(const mavlink_message_t* msg)
413 return _MAV_RETURN_float(msg, 20);
417 * @brief Get field param7 from command_long message
419 * @return Parameter 7, as defined by MAV_CMD enum.
421 static inline float mavlink_msg_command_long_get_param7(const mavlink_message_t* msg)
423 return _MAV_RETURN_float(msg, 24);
427 * @brief Decode a command_long message into a struct
429 * @param msg The message to decode
430 * @param command_long C-struct to decode the message contents into
432 static inline void mavlink_msg_command_long_decode(const mavlink_message_t* msg, mavlink_command_long_t* command_long)
434 #if MAVLINK_NEED_BYTE_SWAP
435 command_long->param1 = mavlink_msg_command_long_get_param1(msg);
436 command_long->param2 = mavlink_msg_command_long_get_param2(msg);
437 command_long->param3 = mavlink_msg_command_long_get_param3(msg);
438 command_long->param4 = mavlink_msg_command_long_get_param4(msg);
439 command_long->param5 = mavlink_msg_command_long_get_param5(msg);
440 command_long->param6 = mavlink_msg_command_long_get_param6(msg);
441 command_long->param7 = mavlink_msg_command_long_get_param7(msg);
442 command_long->command = mavlink_msg_command_long_get_command(msg);
443 command_long->target_system = mavlink_msg_command_long_get_target_system(msg);
444 command_long->target_component = mavlink_msg_command_long_get_target_component(msg);
445 command_long->confirmation = mavlink_msg_command_long_get_confirmation(msg);
446 #else
447 memcpy(command_long, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_LONG_LEN);
448 #endif