NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_led_control.h
Go to the documentation of this file.
1 // MESSAGE LED_CONTROL PACKING
2 
3 #define MAVLINK_MSG_ID_LED_CONTROL 186
4 
5 typedef struct __mavlink_led_control_t
6 {
7  uint8_t target_system;
8  uint8_t target_component;
9  uint8_t instance;
10  uint8_t pattern;
11  uint8_t custom_len;
12  uint8_t custom_bytes[24];
14 
15 #define MAVLINK_MSG_ID_LED_CONTROL_LEN 29
16 #define MAVLINK_MSG_ID_186_LEN 29
17 
18 #define MAVLINK_MSG_ID_LED_CONTROL_CRC 72
19 #define MAVLINK_MSG_ID_186_CRC 72
20 
21 #define MAVLINK_MSG_LED_CONTROL_FIELD_CUSTOM_BYTES_LEN 24
22 
23 #define MAVLINK_MESSAGE_INFO_LED_CONTROL { \
24  "LED_CONTROL", \
25  6, \
26  { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \
27  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \
28  { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \
29  { "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \
30  { "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \
31  { "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \
32  } \
33 }
34 
35 
50 static inline uint16_t mavlink_msg_led_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
51  uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
52 {
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55  _mav_put_uint8_t(buf, 0, target_system);
56  _mav_put_uint8_t(buf, 1, target_component);
57  _mav_put_uint8_t(buf, 2, instance);
58  _mav_put_uint8_t(buf, 3, pattern);
59  _mav_put_uint8_t(buf, 4, custom_len);
60  _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
62 #else
63  mavlink_led_control_t packet;
64  packet.target_system = target_system;
65  packet.target_component = target_component;
66  packet.instance = instance;
67  packet.pattern = pattern;
68  packet.custom_len = custom_len;
69  mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
71 #endif
72 
73  msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
74 #if MAVLINK_CRC_EXTRA
76 #else
77  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LED_CONTROL_LEN);
78 #endif
79 }
80 
95 static inline uint16_t mavlink_msg_led_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96  mavlink_message_t* msg,
97  uint8_t target_system,uint8_t target_component,uint8_t instance,uint8_t pattern,uint8_t custom_len,const uint8_t *custom_bytes)
98 {
99 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101  _mav_put_uint8_t(buf, 0, target_system);
102  _mav_put_uint8_t(buf, 1, target_component);
103  _mav_put_uint8_t(buf, 2, instance);
104  _mav_put_uint8_t(buf, 3, pattern);
105  _mav_put_uint8_t(buf, 4, custom_len);
106  _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
108 #else
109  mavlink_led_control_t packet;
110  packet.target_system = target_system;
111  packet.target_component = target_component;
112  packet.instance = instance;
113  packet.pattern = pattern;
114  packet.custom_len = custom_len;
115  mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
117 #endif
118 
119  msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
120 #if MAVLINK_CRC_EXTRA
122 #else
123  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LED_CONTROL_LEN);
124 #endif
125 }
126 
135 static inline uint16_t mavlink_msg_led_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
136 {
137  return mavlink_msg_led_control_pack(system_id, component_id, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
138 }
139 
149 static inline uint16_t mavlink_msg_led_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
150 {
151  return mavlink_msg_led_control_pack_chan(system_id, component_id, chan, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
152 }
153 
165 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
166 
167 static inline void mavlink_msg_led_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
168 {
169 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171  _mav_put_uint8_t(buf, 0, target_system);
172  _mav_put_uint8_t(buf, 1, target_component);
173  _mav_put_uint8_t(buf, 2, instance);
174  _mav_put_uint8_t(buf, 3, pattern);
175  _mav_put_uint8_t(buf, 4, custom_len);
176  _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
177 #if MAVLINK_CRC_EXTRA
179 #else
180  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
181 #endif
182 #else
183  mavlink_led_control_t packet;
184  packet.target_system = target_system;
185  packet.target_component = target_component;
186  packet.instance = instance;
187  packet.pattern = pattern;
188  packet.custom_len = custom_len;
189  mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
190 #if MAVLINK_CRC_EXTRA
191  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
192 #else
193  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
194 #endif
195 #endif
196 }
197 
198 #if MAVLINK_MSG_ID_LED_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
199 /*
200  This varient of _send() can be used to save stack space by re-using
201  memory from the receive buffer. The caller provides a
202  mavlink_message_t which is the size of a full mavlink message. This
203  is usually the receive buffer for the channel, and allows a reply to an
204  incoming message with minimum stack space usage.
205  */
206 static inline void mavlink_msg_led_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
207 {
208 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
209  char *buf = (char *)msgbuf;
210  _mav_put_uint8_t(buf, 0, target_system);
211  _mav_put_uint8_t(buf, 1, target_component);
212  _mav_put_uint8_t(buf, 2, instance);
213  _mav_put_uint8_t(buf, 3, pattern);
214  _mav_put_uint8_t(buf, 4, custom_len);
215  _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
216 #if MAVLINK_CRC_EXTRA
218 #else
219  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
220 #endif
221 #else
222  mavlink_led_control_t *packet = (mavlink_led_control_t *)msgbuf;
223  packet->target_system = target_system;
224  packet->target_component = target_component;
225  packet->instance = instance;
226  packet->pattern = pattern;
227  packet->custom_len = custom_len;
228  mav_array_memcpy(packet->custom_bytes, custom_bytes, sizeof(uint8_t)*24);
229 #if MAVLINK_CRC_EXTRA
230  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)packet, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
231 #else
232  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
233 #endif
234 #endif
235 }
236 #endif
237 
238 #endif
239 
240 // MESSAGE LED_CONTROL UNPACKING
241 
242 
248 static inline uint8_t mavlink_msg_led_control_get_target_system(const mavlink_message_t* msg)
249 {
250  return _MAV_RETURN_uint8_t(msg, 0);
251 }
252 
258 static inline uint8_t mavlink_msg_led_control_get_target_component(const mavlink_message_t* msg)
259 {
260  return _MAV_RETURN_uint8_t(msg, 1);
261 }
262 
268 static inline uint8_t mavlink_msg_led_control_get_instance(const mavlink_message_t* msg)
269 {
270  return _MAV_RETURN_uint8_t(msg, 2);
271 }
272 
278 static inline uint8_t mavlink_msg_led_control_get_pattern(const mavlink_message_t* msg)
279 {
280  return _MAV_RETURN_uint8_t(msg, 3);
281 }
282 
288 static inline uint8_t mavlink_msg_led_control_get_custom_len(const mavlink_message_t* msg)
289 {
290  return _MAV_RETURN_uint8_t(msg, 4);
291 }
292 
298 static inline uint16_t mavlink_msg_led_control_get_custom_bytes(const mavlink_message_t* msg, uint8_t *custom_bytes)
299 {
300  return _MAV_RETURN_uint8_t_array(msg, custom_bytes, 24, 5);
301 }
302 
309 static inline void mavlink_msg_led_control_decode(const mavlink_message_t* msg, mavlink_led_control_t* led_control)
310 {
311 #if MAVLINK_NEED_BYTE_SWAP
312  led_control->target_system = mavlink_msg_led_control_get_target_system(msg);
313  led_control->target_component = mavlink_msg_led_control_get_target_component(msg);
314  led_control->instance = mavlink_msg_led_control_get_instance(msg);
315  led_control->pattern = mavlink_msg_led_control_get_pattern(msg);
316  led_control->custom_len = mavlink_msg_led_control_get_custom_len(msg);
317  mavlink_msg_led_control_get_custom_bytes(msg, led_control->custom_bytes);
318 #else
319  memcpy(led_control, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LED_CONTROL_LEN);
320 #endif
321 }
#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