MAV'RIC
mavlink_msg_set_quad_motors_setpoint.h
1 // MESSAGE SET_QUAD_MOTORS_SETPOINT PACKING
2 
3 #define MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT 161
4 
6 {
7  uint16_t motor_front_nw;
8  uint16_t motor_right_ne;
9  uint16_t motor_back_se;
10  uint16_t motor_left_sw;
11  uint8_t target_system;
13 
14 #define MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN 9
15 #define MAVLINK_MSG_ID_161_LEN 9
16 
17 #define MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC 30
18 #define MAVLINK_MSG_ID_161_CRC 30
19 
20 
21 
22 #define MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT { \
23  "SET_QUAD_MOTORS_SETPOINT", \
24  5, \
25  { { "motor_front_nw", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_set_quad_motors_setpoint_t, motor_front_nw) }, \
26  { "motor_right_ne", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_set_quad_motors_setpoint_t, motor_right_ne) }, \
27  { "motor_back_se", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_set_quad_motors_setpoint_t, motor_back_se) }, \
28  { "motor_left_sw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_set_quad_motors_setpoint_t, motor_left_sw) }, \
29  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_set_quad_motors_setpoint_t, target_system) }, \
30  } \
31 }
32 
33 
47 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48  uint8_t target_system, uint16_t motor_front_nw, uint16_t motor_right_ne, uint16_t motor_back_se, uint16_t motor_left_sw)
49 {
50 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
51  char buf[MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN];
52  _mav_put_uint16_t(buf, 0, motor_front_nw);
53  _mav_put_uint16_t(buf, 2, motor_right_ne);
54  _mav_put_uint16_t(buf, 4, motor_back_se);
55  _mav_put_uint16_t(buf, 6, motor_left_sw);
56  _mav_put_uint8_t(buf, 8, target_system);
57 
58  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
59 #else
61  packet.motor_front_nw = motor_front_nw;
62  packet.motor_right_ne = motor_right_ne;
63  packet.motor_back_se = motor_back_se;
64  packet.motor_left_sw = motor_left_sw;
65  packet.target_system = target_system;
66 
67  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
68 #endif
69 
70  msg->msgid = MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT;
71 #if MAVLINK_CRC_EXTRA
72  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
73 #else
74  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
75 #endif
76 }
77 
91 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
92  mavlink_message_t* msg,
93  uint8_t target_system,uint16_t motor_front_nw,uint16_t motor_right_ne,uint16_t motor_back_se,uint16_t motor_left_sw)
94 {
95 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
96  char buf[MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN];
97  _mav_put_uint16_t(buf, 0, motor_front_nw);
98  _mav_put_uint16_t(buf, 2, motor_right_ne);
99  _mav_put_uint16_t(buf, 4, motor_back_se);
100  _mav_put_uint16_t(buf, 6, motor_left_sw);
101  _mav_put_uint8_t(buf, 8, target_system);
102 
103  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
104 #else
106  packet.motor_front_nw = motor_front_nw;
107  packet.motor_right_ne = motor_right_ne;
108  packet.motor_back_se = motor_back_se;
109  packet.motor_left_sw = motor_left_sw;
110  packet.target_system = target_system;
111 
112  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
113 #endif
114 
115  msg->msgid = MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT;
116 #if MAVLINK_CRC_EXTRA
117  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
118 #else
119  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
120 #endif
121 }
122 
131 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_quad_motors_setpoint_t* set_quad_motors_setpoint)
132 {
133  return mavlink_msg_set_quad_motors_setpoint_pack(system_id, component_id, msg, set_quad_motors_setpoint->target_system, set_quad_motors_setpoint->motor_front_nw, set_quad_motors_setpoint->motor_right_ne, set_quad_motors_setpoint->motor_back_se, set_quad_motors_setpoint->motor_left_sw);
134 }
135 
145 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_quad_motors_setpoint_t* set_quad_motors_setpoint)
146 {
147  return mavlink_msg_set_quad_motors_setpoint_pack_chan(system_id, component_id, chan, msg, set_quad_motors_setpoint->target_system, set_quad_motors_setpoint->motor_front_nw, set_quad_motors_setpoint->motor_right_ne, set_quad_motors_setpoint->motor_back_se, set_quad_motors_setpoint->motor_left_sw);
148 }
149 
160 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
161 
162 static inline void mavlink_msg_set_quad_motors_setpoint_send(mavlink_channel_t chan, uint8_t target_system, uint16_t motor_front_nw, uint16_t motor_right_ne, uint16_t motor_back_se, uint16_t motor_left_sw)
163 {
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165  char buf[MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN];
166  _mav_put_uint16_t(buf, 0, motor_front_nw);
167  _mav_put_uint16_t(buf, 2, motor_right_ne);
168  _mav_put_uint16_t(buf, 4, motor_back_se);
169  _mav_put_uint16_t(buf, 6, motor_left_sw);
170  _mav_put_uint8_t(buf, 8, target_system);
171 
172 #if MAVLINK_CRC_EXTRA
173  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
174 #else
175  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
176 #endif
177 #else
179  packet.motor_front_nw = motor_front_nw;
180  packet.motor_right_ne = motor_right_ne;
181  packet.motor_back_se = motor_back_se;
182  packet.motor_left_sw = motor_left_sw;
183  packet.target_system = target_system;
184 
185 #if MAVLINK_CRC_EXTRA
186  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, (const char *)&packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
187 #else
188  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, (const char *)&packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
189 #endif
190 #endif
191 }
192 
193 #if MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
194 /*
195  This varient of _send() can be used to save stack space by re-using
196  memory from the receive buffer. The caller provides a
197  mavlink_message_t which is the size of a full mavlink message. This
198  is usually the receive buffer for the channel, and allows a reply to an
199  incoming message with minimum stack space usage.
200  */
201 static inline void mavlink_msg_set_quad_motors_setpoint_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint16_t motor_front_nw, uint16_t motor_right_ne, uint16_t motor_back_se, uint16_t motor_left_sw)
202 {
203 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
204  char *buf = (char *)msgbuf;
205  _mav_put_uint16_t(buf, 0, motor_front_nw);
206  _mav_put_uint16_t(buf, 2, motor_right_ne);
207  _mav_put_uint16_t(buf, 4, motor_back_se);
208  _mav_put_uint16_t(buf, 6, motor_left_sw);
209  _mav_put_uint8_t(buf, 8, target_system);
210 
211 #if MAVLINK_CRC_EXTRA
212  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
213 #else
214  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, buf, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
215 #endif
216 #else
218  packet->motor_front_nw = motor_front_nw;
219  packet->motor_right_ne = motor_right_ne;
220  packet->motor_back_se = motor_back_se;
221  packet->motor_left_sw = motor_left_sw;
222  packet->target_system = target_system;
223 
224 #if MAVLINK_CRC_EXTRA
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, (const char *)packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_CRC);
226 #else
227  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT, (const char *)packet, MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
228 #endif
229 #endif
230 }
231 #endif
232 
233 #endif
234 
235 // MESSAGE SET_QUAD_MOTORS_SETPOINT UNPACKING
236 
237 
243 static inline uint8_t mavlink_msg_set_quad_motors_setpoint_get_target_system(const mavlink_message_t* msg)
244 {
245  return _MAV_RETURN_uint8_t(msg, 8);
246 }
247 
253 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_get_motor_front_nw(const mavlink_message_t* msg)
254 {
255  return _MAV_RETURN_uint16_t(msg, 0);
256 }
257 
263 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_get_motor_right_ne(const mavlink_message_t* msg)
264 {
265  return _MAV_RETURN_uint16_t(msg, 2);
266 }
267 
273 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_get_motor_back_se(const mavlink_message_t* msg)
274 {
275  return _MAV_RETURN_uint16_t(msg, 4);
276 }
277 
283 static inline uint16_t mavlink_msg_set_quad_motors_setpoint_get_motor_left_sw(const mavlink_message_t* msg)
284 {
285  return _MAV_RETURN_uint16_t(msg, 6);
286 }
287 
294 static inline void mavlink_msg_set_quad_motors_setpoint_decode(const mavlink_message_t* msg, mavlink_set_quad_motors_setpoint_t* set_quad_motors_setpoint)
295 {
296 #if MAVLINK_NEED_BYTE_SWAP
297  set_quad_motors_setpoint->motor_front_nw = mavlink_msg_set_quad_motors_setpoint_get_motor_front_nw(msg);
298  set_quad_motors_setpoint->motor_right_ne = mavlink_msg_set_quad_motors_setpoint_get_motor_right_ne(msg);
299  set_quad_motors_setpoint->motor_back_se = mavlink_msg_set_quad_motors_setpoint_get_motor_back_se(msg);
300  set_quad_motors_setpoint->motor_left_sw = mavlink_msg_set_quad_motors_setpoint_get_motor_left_sw(msg);
301  set_quad_motors_setpoint->target_system = mavlink_msg_set_quad_motors_setpoint_get_target_system(msg);
302 #else
303  memcpy(set_quad_motors_setpoint, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SET_QUAD_MOTORS_SETPOINT_LEN);
304 #endif
305 }