NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_mount_control.h
Go to the documentation of this file.
1 // MESSAGE MOUNT_CONTROL PACKING
2 
3 #define MAVLINK_MSG_ID_MOUNT_CONTROL 157
4 
6 {
7  int32_t input_a;
8  int32_t input_b;
9  int32_t input_c;
10  uint8_t target_system;
11  uint8_t target_component;
12  uint8_t save_position;
14 
15 #define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15
16 #define MAVLINK_MSG_ID_157_LEN 15
17 
18 #define MAVLINK_MSG_ID_MOUNT_CONTROL_CRC 21
19 #define MAVLINK_MSG_ID_157_CRC 21
20 
21 
22 
23 #define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
24  "MOUNT_CONTROL", \
25  6, \
26  { { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \
27  { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \
28  { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \
29  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \
30  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \
31  { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
32  } \
33 }
34 
35 
50 static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
51  uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
52 {
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55  _mav_put_int32_t(buf, 0, input_a);
56  _mav_put_int32_t(buf, 4, input_b);
57  _mav_put_int32_t(buf, 8, input_c);
58  _mav_put_uint8_t(buf, 12, target_system);
59  _mav_put_uint8_t(buf, 13, target_component);
60  _mav_put_uint8_t(buf, 14, save_position);
61 
63 #else
65  packet.input_a = input_a;
66  packet.input_b = input_b;
67  packet.input_c = input_c;
68  packet.target_system = target_system;
69  packet.target_component = target_component;
70  packet.save_position = save_position;
71 
73 #endif
74 
75  msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
76 #if MAVLINK_CRC_EXTRA
78 #else
79  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
80 #endif
81 }
82 
97 static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
98  mavlink_message_t* msg,
99  uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position)
100 {
101 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
103  _mav_put_int32_t(buf, 0, input_a);
104  _mav_put_int32_t(buf, 4, input_b);
105  _mav_put_int32_t(buf, 8, input_c);
106  _mav_put_uint8_t(buf, 12, target_system);
107  _mav_put_uint8_t(buf, 13, target_component);
108  _mav_put_uint8_t(buf, 14, save_position);
109 
111 #else
113  packet.input_a = input_a;
114  packet.input_b = input_b;
115  packet.input_c = input_c;
116  packet.target_system = target_system;
117  packet.target_component = target_component;
118  packet.save_position = save_position;
119 
121 #endif
122 
123  msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
124 #if MAVLINK_CRC_EXTRA
126 #else
127  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
128 #endif
129 }
130 
139 static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
140 {
141  return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
142 }
143 
153 static inline uint16_t mavlink_msg_mount_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
154 {
155  return mavlink_msg_mount_control_pack_chan(system_id, component_id, chan, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
156 }
157 
169 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
170 
171 static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
172 {
173 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
175  _mav_put_int32_t(buf, 0, input_a);
176  _mav_put_int32_t(buf, 4, input_b);
177  _mav_put_int32_t(buf, 8, input_c);
178  _mav_put_uint8_t(buf, 12, target_system);
179  _mav_put_uint8_t(buf, 13, target_component);
180  _mav_put_uint8_t(buf, 14, save_position);
181 
182 #if MAVLINK_CRC_EXTRA
184 #else
185  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
186 #endif
187 #else
189  packet.input_a = input_a;
190  packet.input_b = input_b;
191  packet.input_c = input_c;
192  packet.target_system = target_system;
193  packet.target_component = target_component;
194  packet.save_position = save_position;
195 
196 #if MAVLINK_CRC_EXTRA
197  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
198 #else
199  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
200 #endif
201 #endif
202 }
203 
204 #if MAVLINK_MSG_ID_MOUNT_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
205 /*
206  This varient of _send() can be used to save stack space by re-using
207  memory from the receive buffer. The caller provides a
208  mavlink_message_t which is the size of a full mavlink message. This
209  is usually the receive buffer for the channel, and allows a reply to an
210  incoming message with minimum stack space usage.
211  */
212 static inline void mavlink_msg_mount_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
213 {
214 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
215  char *buf = (char *)msgbuf;
216  _mav_put_int32_t(buf, 0, input_a);
217  _mav_put_int32_t(buf, 4, input_b);
218  _mav_put_int32_t(buf, 8, input_c);
219  _mav_put_uint8_t(buf, 12, target_system);
220  _mav_put_uint8_t(buf, 13, target_component);
221  _mav_put_uint8_t(buf, 14, save_position);
222 
223 #if MAVLINK_CRC_EXTRA
225 #else
226  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
227 #endif
228 #else
230  packet->input_a = input_a;
231  packet->input_b = input_b;
232  packet->input_c = input_c;
233  packet->target_system = target_system;
234  packet->target_component = target_component;
235  packet->save_position = save_position;
236 
237 #if MAVLINK_CRC_EXTRA
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
239 #else
240  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
241 #endif
242 #endif
243 }
244 #endif
245 
246 #endif
247 
248 // MESSAGE MOUNT_CONTROL UNPACKING
249 
250 
256 static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg)
257 {
258  return _MAV_RETURN_uint8_t(msg, 12);
259 }
260 
266 static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg)
267 {
268  return _MAV_RETURN_uint8_t(msg, 13);
269 }
270 
276 static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg)
277 {
278  return _MAV_RETURN_int32_t(msg, 0);
279 }
280 
286 static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg)
287 {
288  return _MAV_RETURN_int32_t(msg, 4);
289 }
290 
296 static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg)
297 {
298  return _MAV_RETURN_int32_t(msg, 8);
299 }
300 
306 static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg)
307 {
308  return _MAV_RETURN_uint8_t(msg, 14);
309 }
310 
317 static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control)
318 {
319 #if MAVLINK_NEED_BYTE_SWAP
320  mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg);
321  mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg);
322  mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg);
323  mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg);
324  mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg);
325  mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg);
326 #else
327  memcpy(mount_control, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
328 #endif
329 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:142