Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_actuator_control_target.h
blob9c33833b384aeeabefe6439b78a6ddf8e7f5d6a7
1 // MESSAGE ACTUATOR_CONTROL_TARGET PACKING
3 #define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET 140
5 typedef struct __mavlink_actuator_control_target_t
7 uint64_t time_usec; ///< Timestamp (micros since boot or Unix epoch)
8 float controls[8]; ///< Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.
9 uint8_t group_mlx; ///< Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
10 } mavlink_actuator_control_target_t;
12 #define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN 41
13 #define MAVLINK_MSG_ID_140_LEN 41
15 #define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC 181
16 #define MAVLINK_MSG_ID_140_CRC 181
18 #define MAVLINK_MSG_ACTUATOR_CONTROL_TARGET_FIELD_CONTROLS_LEN 8
20 #define MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET { \
21 "ACTUATOR_CONTROL_TARGET", \
22 3, \
23 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_actuator_control_target_t, time_usec) }, \
24 { "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_actuator_control_target_t, controls) }, \
25 { "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_actuator_control_target_t, group_mlx) }, \
26 } \
30 /**
31 * @brief Pack a actuator_control_target message
32 * @param system_id ID of this system
33 * @param component_id ID of this component (e.g. 200 for IMU)
34 * @param msg The MAVLink message to compress the data into
36 * @param time_usec Timestamp (micros since boot or Unix epoch)
37 * @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
38 * @param controls Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.
39 * @return length of the message in bytes (excluding serial stream start sign)
41 static inline uint16_t mavlink_msg_actuator_control_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
42 uint64_t time_usec, uint8_t group_mlx, const float *controls)
44 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
45 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
46 _mav_put_uint64_t(buf, 0, time_usec);
47 _mav_put_uint8_t(buf, 40, group_mlx);
48 _mav_put_float_array(buf, 8, controls, 8);
49 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
50 #else
51 mavlink_actuator_control_target_t packet;
52 packet.time_usec = time_usec;
53 packet.group_mlx = group_mlx;
54 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
55 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
56 #endif
58 msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
59 #if MAVLINK_CRC_EXTRA
60 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
61 #else
62 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
63 #endif
66 /**
67 * @brief Pack a actuator_control_target message on a channel
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param chan The MAVLink channel this message will be sent over
71 * @param msg The MAVLink message to compress the data into
72 * @param time_usec Timestamp (micros since boot or Unix epoch)
73 * @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
74 * @param controls Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_actuator_control_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
78 mavlink_message_t* msg,
79 uint64_t time_usec,uint8_t group_mlx,const float *controls)
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
83 _mav_put_uint64_t(buf, 0, time_usec);
84 _mav_put_uint8_t(buf, 40, group_mlx);
85 _mav_put_float_array(buf, 8, controls, 8);
86 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
87 #else
88 mavlink_actuator_control_target_t packet;
89 packet.time_usec = time_usec;
90 packet.group_mlx = group_mlx;
91 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
93 #endif
95 msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
96 #if MAVLINK_CRC_EXTRA
97 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
98 #else
99 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
100 #endif
104 * @brief Encode a actuator_control_target struct
106 * @param system_id ID of this system
107 * @param component_id ID of this component (e.g. 200 for IMU)
108 * @param msg The MAVLink message to compress the data into
109 * @param actuator_control_target C-struct to read the message contents from
111 static inline uint16_t mavlink_msg_actuator_control_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
113 return mavlink_msg_actuator_control_target_pack(system_id, component_id, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
117 * @brief Encode a actuator_control_target struct on a channel
119 * @param system_id ID of this system
120 * @param component_id ID of this component (e.g. 200 for IMU)
121 * @param chan The MAVLink channel this message will be sent over
122 * @param msg The MAVLink message to compress the data into
123 * @param actuator_control_target C-struct to read the message contents from
125 static inline uint16_t mavlink_msg_actuator_control_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
127 return mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, chan, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
131 * @brief Send a actuator_control_target message
132 * @param chan MAVLink channel to send the message
134 * @param time_usec Timestamp (micros since boot or Unix epoch)
135 * @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
136 * @param controls Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_actuator_control_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
144 _mav_put_uint64_t(buf, 0, time_usec);
145 _mav_put_uint8_t(buf, 40, group_mlx);
146 _mav_put_float_array(buf, 8, controls, 8);
147 #if MAVLINK_CRC_EXTRA
148 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
149 #else
150 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
151 #endif
152 #else
153 mavlink_actuator_control_target_t packet;
154 packet.time_usec = time_usec;
155 packet.group_mlx = group_mlx;
156 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
157 #if MAVLINK_CRC_EXTRA
158 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
159 #else
160 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
161 #endif
162 #endif
165 #if MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
167 This varient of _send() can be used to save stack space by re-using
168 memory from the receive buffer. The caller provides a
169 mavlink_message_t which is the size of a full mavlink message. This
170 is usually the receive buffer for the channel, and allows a reply to an
171 incoming message with minimum stack space usage.
173 static inline void mavlink_msg_actuator_control_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
175 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176 char *buf = (char *)msgbuf;
177 _mav_put_uint64_t(buf, 0, time_usec);
178 _mav_put_uint8_t(buf, 40, group_mlx);
179 _mav_put_float_array(buf, 8, controls, 8);
180 #if MAVLINK_CRC_EXTRA
181 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
182 #else
183 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
184 #endif
185 #else
186 mavlink_actuator_control_target_t *packet = (mavlink_actuator_control_target_t *)msgbuf;
187 packet->time_usec = time_usec;
188 packet->group_mlx = group_mlx;
189 mav_array_memcpy(packet->controls, controls, sizeof(float)*8);
190 #if MAVLINK_CRC_EXTRA
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
192 #else
193 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
194 #endif
195 #endif
197 #endif
199 #endif
201 // MESSAGE ACTUATOR_CONTROL_TARGET UNPACKING
205 * @brief Get field time_usec from actuator_control_target message
207 * @return Timestamp (micros since boot or Unix epoch)
209 static inline uint64_t mavlink_msg_actuator_control_target_get_time_usec(const mavlink_message_t* msg)
211 return _MAV_RETURN_uint64_t(msg, 0);
215 * @brief Get field group_mlx from actuator_control_target message
217 * @return Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
219 static inline uint8_t mavlink_msg_actuator_control_target_get_group_mlx(const mavlink_message_t* msg)
221 return _MAV_RETURN_uint8_t(msg, 40);
225 * @brief Get field controls from actuator_control_target message
227 * @return Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.
229 static inline uint16_t mavlink_msg_actuator_control_target_get_controls(const mavlink_message_t* msg, float *controls)
231 return _MAV_RETURN_float_array(msg, controls, 8, 8);
235 * @brief Decode a actuator_control_target message into a struct
237 * @param msg The message to decode
238 * @param actuator_control_target C-struct to decode the message contents into
240 static inline void mavlink_msg_actuator_control_target_decode(const mavlink_message_t* msg, mavlink_actuator_control_target_t* actuator_control_target)
242 #if MAVLINK_NEED_BYTE_SWAP
243 actuator_control_target->time_usec = mavlink_msg_actuator_control_target_get_time_usec(msg);
244 mavlink_msg_actuator_control_target_get_controls(msg, actuator_control_target->controls);
245 actuator_control_target->group_mlx = mavlink_msg_actuator_control_target_get_group_mlx(msg);
246 #else
247 memcpy(actuator_control_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
248 #endif