Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_param_map_rc.h
blob8f6ee0ee420c0412e7d120120942930b817befaf
1 // MESSAGE PARAM_MAP_RC PACKING
3 #define MAVLINK_MSG_ID_PARAM_MAP_RC 50
5 typedef struct __mavlink_param_map_rc_t
7 float param_value0; ///< Initial parameter value
8 float scale; ///< Scale, maps the RC range [-1, 1] to a parameter value
9 float param_value_min; ///< Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
10 float param_value_max; ///< Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
11 int16_t param_index; ///< Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
12 uint8_t target_system; ///< System ID
13 uint8_t target_component; ///< Component ID
14 char param_id[16]; ///< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
15 uint8_t parameter_rc_channel_index; ///< Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
16 } mavlink_param_map_rc_t;
18 #define MAVLINK_MSG_ID_PARAM_MAP_RC_LEN 37
19 #define MAVLINK_MSG_ID_50_LEN 37
21 #define MAVLINK_MSG_ID_PARAM_MAP_RC_CRC 78
22 #define MAVLINK_MSG_ID_50_CRC 78
24 #define MAVLINK_MSG_PARAM_MAP_RC_FIELD_PARAM_ID_LEN 16
26 #define MAVLINK_MESSAGE_INFO_PARAM_MAP_RC { \
27 "PARAM_MAP_RC", \
28 9, \
29 { { "param_value0", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_map_rc_t, param_value0) }, \
30 { "scale", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_param_map_rc_t, scale) }, \
31 { "param_value_min", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_param_map_rc_t, param_value_min) }, \
32 { "param_value_max", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_param_map_rc_t, param_value_max) }, \
33 { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_param_map_rc_t, param_index) }, \
34 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_param_map_rc_t, target_system) }, \
35 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_param_map_rc_t, target_component) }, \
36 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 20, offsetof(mavlink_param_map_rc_t, param_id) }, \
37 { "parameter_rc_channel_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_param_map_rc_t, parameter_rc_channel_index) }, \
38 } \
42 /**
43 * @brief Pack a param_map_rc message
44 * @param system_id ID of this system
45 * @param component_id ID of this component (e.g. 200 for IMU)
46 * @param msg The MAVLink message to compress the data into
48 * @param target_system System ID
49 * @param target_component Component ID
50 * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
51 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
52 * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
53 * @param param_value0 Initial parameter value
54 * @param scale Scale, maps the RC range [-1, 1] to a parameter value
55 * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
56 * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_param_map_rc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60 uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
64 _mav_put_float(buf, 0, param_value0);
65 _mav_put_float(buf, 4, scale);
66 _mav_put_float(buf, 8, param_value_min);
67 _mav_put_float(buf, 12, param_value_max);
68 _mav_put_int16_t(buf, 16, param_index);
69 _mav_put_uint8_t(buf, 18, target_system);
70 _mav_put_uint8_t(buf, 19, target_component);
71 _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
72 _mav_put_char_array(buf, 20, param_id, 16);
73 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
74 #else
75 mavlink_param_map_rc_t packet;
76 packet.param_value0 = param_value0;
77 packet.scale = scale;
78 packet.param_value_min = param_value_min;
79 packet.param_value_max = param_value_max;
80 packet.param_index = param_index;
81 packet.target_system = target_system;
82 packet.target_component = target_component;
83 packet.parameter_rc_channel_index = parameter_rc_channel_index;
84 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
85 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
86 #endif
88 msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
89 #if MAVLINK_CRC_EXTRA
90 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
91 #else
92 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
93 #endif
96 /**
97 * @brief Pack a param_map_rc message on a channel
98 * @param system_id ID of this system
99 * @param component_id ID of this component (e.g. 200 for IMU)
100 * @param chan The MAVLink channel this message will be sent over
101 * @param msg The MAVLink message to compress the data into
102 * @param target_system System ID
103 * @param target_component Component ID
104 * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
105 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
106 * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
107 * @param param_value0 Initial parameter value
108 * @param scale Scale, maps the RC range [-1, 1] to a parameter value
109 * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
110 * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
111 * @return length of the message in bytes (excluding serial stream start sign)
113 static inline uint16_t mavlink_msg_param_map_rc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
114 mavlink_message_t* msg,
115 uint8_t target_system,uint8_t target_component,const char *param_id,int16_t param_index,uint8_t parameter_rc_channel_index,float param_value0,float scale,float param_value_min,float param_value_max)
117 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
118 char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
119 _mav_put_float(buf, 0, param_value0);
120 _mav_put_float(buf, 4, scale);
121 _mav_put_float(buf, 8, param_value_min);
122 _mav_put_float(buf, 12, param_value_max);
123 _mav_put_int16_t(buf, 16, param_index);
124 _mav_put_uint8_t(buf, 18, target_system);
125 _mav_put_uint8_t(buf, 19, target_component);
126 _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
127 _mav_put_char_array(buf, 20, param_id, 16);
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
129 #else
130 mavlink_param_map_rc_t packet;
131 packet.param_value0 = param_value0;
132 packet.scale = scale;
133 packet.param_value_min = param_value_min;
134 packet.param_value_max = param_value_max;
135 packet.param_index = param_index;
136 packet.target_system = target_system;
137 packet.target_component = target_component;
138 packet.parameter_rc_channel_index = parameter_rc_channel_index;
139 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
140 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
141 #endif
143 msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
144 #if MAVLINK_CRC_EXTRA
145 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
146 #else
147 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
148 #endif
152 * @brief Encode a param_map_rc struct
154 * @param system_id ID of this system
155 * @param component_id ID of this component (e.g. 200 for IMU)
156 * @param msg The MAVLink message to compress the data into
157 * @param param_map_rc C-struct to read the message contents from
159 static inline uint16_t mavlink_msg_param_map_rc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_map_rc_t* param_map_rc)
161 return mavlink_msg_param_map_rc_pack(system_id, component_id, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max);
165 * @brief Encode a param_map_rc struct on a channel
167 * @param system_id ID of this system
168 * @param component_id ID of this component (e.g. 200 for IMU)
169 * @param chan The MAVLink channel this message will be sent over
170 * @param msg The MAVLink message to compress the data into
171 * @param param_map_rc C-struct to read the message contents from
173 static inline uint16_t mavlink_msg_param_map_rc_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_map_rc_t* param_map_rc)
175 return mavlink_msg_param_map_rc_pack_chan(system_id, component_id, chan, msg, param_map_rc->target_system, param_map_rc->target_component, param_map_rc->param_id, param_map_rc->param_index, param_map_rc->parameter_rc_channel_index, param_map_rc->param_value0, param_map_rc->scale, param_map_rc->param_value_min, param_map_rc->param_value_max);
179 * @brief Send a param_map_rc message
180 * @param chan MAVLink channel to send the message
182 * @param target_system System ID
183 * @param target_component Component ID
184 * @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
185 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
186 * @param parameter_rc_channel_index Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
187 * @param param_value0 Initial parameter value
188 * @param scale Scale, maps the RC range [-1, 1] to a parameter value
189 * @param param_value_min Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
190 * @param param_value_max Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
192 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
194 static inline void mavlink_msg_param_map_rc_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
196 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
197 char buf[MAVLINK_MSG_ID_PARAM_MAP_RC_LEN];
198 _mav_put_float(buf, 0, param_value0);
199 _mav_put_float(buf, 4, scale);
200 _mav_put_float(buf, 8, param_value_min);
201 _mav_put_float(buf, 12, param_value_max);
202 _mav_put_int16_t(buf, 16, param_index);
203 _mav_put_uint8_t(buf, 18, target_system);
204 _mav_put_uint8_t(buf, 19, target_component);
205 _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
206 _mav_put_char_array(buf, 20, param_id, 16);
207 #if MAVLINK_CRC_EXTRA
208 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
209 #else
210 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
211 #endif
212 #else
213 mavlink_param_map_rc_t packet;
214 packet.param_value0 = param_value0;
215 packet.scale = scale;
216 packet.param_value_min = param_value_min;
217 packet.param_value_max = param_value_max;
218 packet.param_index = param_index;
219 packet.target_system = target_system;
220 packet.target_component = target_component;
221 packet.parameter_rc_channel_index = parameter_rc_channel_index;
222 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
223 #if MAVLINK_CRC_EXTRA
224 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)&packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
225 #else
226 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)&packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
227 #endif
228 #endif
231 #if MAVLINK_MSG_ID_PARAM_MAP_RC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
239 static inline void mavlink_msg_param_map_rc_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index, uint8_t parameter_rc_channel_index, float param_value0, float scale, float param_value_min, float param_value_max)
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_float(buf, 0, param_value0);
244 _mav_put_float(buf, 4, scale);
245 _mav_put_float(buf, 8, param_value_min);
246 _mav_put_float(buf, 12, param_value_max);
247 _mav_put_int16_t(buf, 16, param_index);
248 _mav_put_uint8_t(buf, 18, target_system);
249 _mav_put_uint8_t(buf, 19, target_component);
250 _mav_put_uint8_t(buf, 36, parameter_rc_channel_index);
251 _mav_put_char_array(buf, 20, param_id, 16);
252 #if MAVLINK_CRC_EXTRA
253 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
254 #else
255 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, buf, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
256 #endif
257 #else
258 mavlink_param_map_rc_t *packet = (mavlink_param_map_rc_t *)msgbuf;
259 packet->param_value0 = param_value0;
260 packet->scale = scale;
261 packet->param_value_min = param_value_min;
262 packet->param_value_max = param_value_max;
263 packet->param_index = param_index;
264 packet->target_system = target_system;
265 packet->target_component = target_component;
266 packet->parameter_rc_channel_index = parameter_rc_channel_index;
267 mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
268 #if MAVLINK_CRC_EXTRA
269 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN, MAVLINK_MSG_ID_PARAM_MAP_RC_CRC);
270 #else
271 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_MAP_RC, (const char *)packet, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
272 #endif
273 #endif
275 #endif
277 #endif
279 // MESSAGE PARAM_MAP_RC UNPACKING
283 * @brief Get field target_system from param_map_rc message
285 * @return System ID
287 static inline uint8_t mavlink_msg_param_map_rc_get_target_system(const mavlink_message_t* msg)
289 return _MAV_RETURN_uint8_t(msg, 18);
293 * @brief Get field target_component from param_map_rc message
295 * @return Component ID
297 static inline uint8_t mavlink_msg_param_map_rc_get_target_component(const mavlink_message_t* msg)
299 return _MAV_RETURN_uint8_t(msg, 19);
303 * @brief Get field param_id from param_map_rc message
305 * @return Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
307 static inline uint16_t mavlink_msg_param_map_rc_get_param_id(const mavlink_message_t* msg, char *param_id)
309 return _MAV_RETURN_char_array(msg, param_id, 16, 20);
313 * @brief Get field param_index from param_map_rc message
315 * @return Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index.
317 static inline int16_t mavlink_msg_param_map_rc_get_param_index(const mavlink_message_t* msg)
319 return _MAV_RETURN_int16_t(msg, 16);
323 * @brief Get field parameter_rc_channel_index from param_map_rc message
325 * @return Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC.
327 static inline uint8_t mavlink_msg_param_map_rc_get_parameter_rc_channel_index(const mavlink_message_t* msg)
329 return _MAV_RETURN_uint8_t(msg, 36);
333 * @brief Get field param_value0 from param_map_rc message
335 * @return Initial parameter value
337 static inline float mavlink_msg_param_map_rc_get_param_value0(const mavlink_message_t* msg)
339 return _MAV_RETURN_float(msg, 0);
343 * @brief Get field scale from param_map_rc message
345 * @return Scale, maps the RC range [-1, 1] to a parameter value
347 static inline float mavlink_msg_param_map_rc_get_scale(const mavlink_message_t* msg)
349 return _MAV_RETURN_float(msg, 4);
353 * @brief Get field param_value_min from param_map_rc message
355 * @return Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation)
357 static inline float mavlink_msg_param_map_rc_get_param_value_min(const mavlink_message_t* msg)
359 return _MAV_RETURN_float(msg, 8);
363 * @brief Get field param_value_max from param_map_rc message
365 * @return Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation)
367 static inline float mavlink_msg_param_map_rc_get_param_value_max(const mavlink_message_t* msg)
369 return _MAV_RETURN_float(msg, 12);
373 * @brief Decode a param_map_rc message into a struct
375 * @param msg The message to decode
376 * @param param_map_rc C-struct to decode the message contents into
378 static inline void mavlink_msg_param_map_rc_decode(const mavlink_message_t* msg, mavlink_param_map_rc_t* param_map_rc)
380 #if MAVLINK_NEED_BYTE_SWAP
381 param_map_rc->param_value0 = mavlink_msg_param_map_rc_get_param_value0(msg);
382 param_map_rc->scale = mavlink_msg_param_map_rc_get_scale(msg);
383 param_map_rc->param_value_min = mavlink_msg_param_map_rc_get_param_value_min(msg);
384 param_map_rc->param_value_max = mavlink_msg_param_map_rc_get_param_value_max(msg);
385 param_map_rc->param_index = mavlink_msg_param_map_rc_get_param_index(msg);
386 param_map_rc->target_system = mavlink_msg_param_map_rc_get_target_system(msg);
387 param_map_rc->target_component = mavlink_msg_param_map_rc_get_target_component(msg);
388 mavlink_msg_param_map_rc_get_param_id(msg, param_map_rc->param_id);
389 param_map_rc->parameter_rc_channel_index = mavlink_msg_param_map_rc_get_parameter_rc_channel_index(msg);
390 #else
391 memcpy(param_map_rc, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
392 #endif