mavlink_msg_param_map_rc.h
Go to the documentation of this file.
1 // MESSAGE PARAM_MAP_RC PACKING
2 
3 #define MAVLINK_MSG_ID_PARAM_MAP_RC 50
4 
6 {
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.*/
17 
18 #define MAVLINK_MSG_ID_PARAM_MAP_RC_LEN 37
19 #define MAVLINK_MSG_ID_50_LEN 37
20 
21 #define MAVLINK_MSG_ID_PARAM_MAP_RC_CRC 78
22 #define MAVLINK_MSG_ID_50_CRC 78
23 
24 #define MAVLINK_MSG_PARAM_MAP_RC_FIELD_PARAM_ID_LEN 16
25 
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  } \
39 }
40 
41 
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)
61 {
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
74 #else
76  packet.param_value0 = param_value0;
77  packet.scale = scale;
80  packet.param_index = param_index;
84  mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
86 #endif
87 
88  msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
89 #if MAVLINK_CRC_EXTRA
91 #else
92  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
93 #endif
94 }
95 
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)
116 {
117 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
129 #else
130  mavlink_param_map_rc_t packet;
131  packet.param_value0 = param_value0;
132  packet.scale = scale;
135  packet.param_index = param_index;
136  packet.target_system = target_system;
139  mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
141 #endif
142 
143  msg->msgid = MAVLINK_MSG_ID_PARAM_MAP_RC;
144 #if MAVLINK_CRC_EXTRA
146 #else
147  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
148 #endif
149 }
150 
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)
160 {
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);
162 }
163 
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)
174 {
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);
176 }
177 
192 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
193 
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)
195 {
196 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
198  _mav_put_float(buf, 0, param_value0);
199  _mav_put_float(buf, 4, scale);
201  _mav_put_float(buf, 12, param_value_max);
202  _mav_put_int16_t(buf, 16, param_index);
206  _mav_put_char_array(buf, 20, param_id, 16);
207 #if MAVLINK_CRC_EXTRA
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;
218  packet.param_index = param_index;
219  packet.target_system = target_system;
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
229 }
230 
231 #if MAVLINK_MSG_ID_PARAM_MAP_RC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
232 /*
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.
238  */
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)
240 {
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);
246  _mav_put_float(buf, 12, param_value_max);
247  _mav_put_int16_t(buf, 16, param_index);
251  _mav_put_char_array(buf, 20, param_id, 16);
252 #if MAVLINK_CRC_EXTRA
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
259  packet->param_value0 = param_value0;
260  packet->scale = scale;
263  packet->param_index = param_index;
264  packet->target_system = target_system;
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
274 }
275 #endif
276 
277 #endif
278 
279 // MESSAGE PARAM_MAP_RC UNPACKING
280 
281 
287 static inline uint8_t mavlink_msg_param_map_rc_get_target_system(const mavlink_message_t* msg)
288 {
289  return _MAV_RETURN_uint8_t(msg, 18);
290 }
291 
297 static inline uint8_t mavlink_msg_param_map_rc_get_target_component(const mavlink_message_t* msg)
298 {
299  return _MAV_RETURN_uint8_t(msg, 19);
300 }
301 
307 static inline uint16_t mavlink_msg_param_map_rc_get_param_id(const mavlink_message_t* msg, char *param_id)
308 {
309  return _MAV_RETURN_char_array(msg, param_id, 16, 20);
310 }
311 
317 static inline int16_t mavlink_msg_param_map_rc_get_param_index(const mavlink_message_t* msg)
318 {
319  return _MAV_RETURN_int16_t(msg, 16);
320 }
321 
327 static inline uint8_t mavlink_msg_param_map_rc_get_parameter_rc_channel_index(const mavlink_message_t* msg)
328 {
329  return _MAV_RETURN_uint8_t(msg, 36);
330 }
331 
337 static inline float mavlink_msg_param_map_rc_get_param_value0(const mavlink_message_t* msg)
338 {
339  return _MAV_RETURN_float(msg, 0);
340 }
341 
347 static inline float mavlink_msg_param_map_rc_get_scale(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_float(msg, 4);
350 }
351 
357 static inline float mavlink_msg_param_map_rc_get_param_value_min(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_float(msg, 8);
360 }
361 
367 static inline float mavlink_msg_param_map_rc_get_param_value_max(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_float(msg, 12);
370 }
371 
378 static inline void mavlink_msg_param_map_rc_decode(const mavlink_message_t* msg, mavlink_param_map_rc_t* param_map_rc)
379 {
380 #if MAVLINK_NEED_BYTE_SWAP
382  param_map_rc->scale = mavlink_msg_param_map_rc_get_scale(msg);
390 #else
391  memcpy(param_map_rc, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_PARAM_MAP_RC_LEN);
392 #endif
393 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static uint16_t _MAV_RETURN_char_array(const mavlink_message_t *msg, char *value, uint8_t array_length, uint8_t wire_offset)
Definition: protocol.h:288
static void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length)
Definition: protocol.h:188
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:146


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25