Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE MOUNT_CONTROL PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_MOUNT_CONTROL 157 |
||
4 | |||
5 | typedef struct __mavlink_mount_control_t |
||
6 | { |
||
7 | uint8_t target_system; ///< System ID |
||
8 | uint8_t target_component; ///< Component ID |
||
9 | int32_t input_a; ///< pitch(deg*100) or lat, depending on mount mode |
||
10 | int32_t input_b; ///< roll(deg*100) or lon depending on mount mode |
||
11 | int32_t input_c; ///< yaw(deg*100) or alt (in cm) depending on mount mode |
||
12 | uint8_t save_position; ///< if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) |
||
13 | } mavlink_mount_control_t; |
||
14 | |||
15 | #define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15 |
||
16 | #define MAVLINK_MSG_ID_157_LEN 15 |
||
17 | |||
18 | |||
19 | |||
20 | #define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \ |
||
21 | "MOUNT_CONTROL", \ |
||
22 | 6, \ |
||
23 | { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_control_t, target_system) }, \ |
||
24 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_control_t, target_component) }, \ |
||
25 | { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 2, offsetof(mavlink_mount_control_t, input_a) }, \ |
||
26 | { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 6, offsetof(mavlink_mount_control_t, input_b) }, \ |
||
27 | { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_mount_control_t, input_c) }, \ |
||
28 | { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \ |
||
29 | } \ |
||
30 | } |
||
31 | |||
32 | |||
33 | /** |
||
34 | * @brief Pack a mount_control message |
||
35 | * @param system_id ID of this system |
||
36 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
37 | * @param msg The MAVLink message to compress the data into |
||
38 | * |
||
39 | * @param target_system System ID |
||
40 | * @param target_component Component ID |
||
41 | * @param input_a pitch(deg*100) or lat, depending on mount mode |
||
42 | * @param input_b roll(deg*100) or lon depending on mount mode |
||
43 | * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode |
||
44 | * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) |
||
45 | * @return length of the message in bytes (excluding serial stream start sign) |
||
46 | */ |
||
47 | static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
48 | uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) |
||
49 | { |
||
50 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
51 | char buf[15]; |
||
52 | _mav_put_uint8_t(buf, 0, target_system); |
||
53 | _mav_put_uint8_t(buf, 1, target_component); |
||
54 | _mav_put_int32_t(buf, 2, input_a); |
||
55 | _mav_put_int32_t(buf, 6, input_b); |
||
56 | _mav_put_int32_t(buf, 10, input_c); |
||
57 | _mav_put_uint8_t(buf, 14, save_position); |
||
58 | |||
59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 15); |
||
60 | #else |
||
61 | mavlink_mount_control_t packet; |
||
62 | packet.target_system = target_system; |
||
63 | packet.target_component = target_component; |
||
64 | packet.input_a = input_a; |
||
65 | packet.input_b = input_b; |
||
66 | packet.input_c = input_c; |
||
67 | packet.save_position = save_position; |
||
68 | |||
69 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 15); |
||
70 | #endif |
||
71 | |||
72 | msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; |
||
73 | return mavlink_finalize_message(msg, system_id, component_id, 15); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @brief Pack a mount_control message on a channel |
||
78 | * @param system_id ID of this system |
||
79 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
80 | * @param chan The MAVLink channel this message was sent over |
||
81 | * @param msg The MAVLink message to compress the data into |
||
82 | * @param target_system System ID |
||
83 | * @param target_component Component ID |
||
84 | * @param input_a pitch(deg*100) or lat, depending on mount mode |
||
85 | * @param input_b roll(deg*100) or lon depending on mount mode |
||
86 | * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode |
||
87 | * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) |
||
88 | * @return length of the message in bytes (excluding serial stream start sign) |
||
89 | */ |
||
90 | static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
91 | mavlink_message_t* msg, |
||
92 | uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position) |
||
93 | { |
||
94 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
95 | char buf[15]; |
||
96 | _mav_put_uint8_t(buf, 0, target_system); |
||
97 | _mav_put_uint8_t(buf, 1, target_component); |
||
98 | _mav_put_int32_t(buf, 2, input_a); |
||
99 | _mav_put_int32_t(buf, 6, input_b); |
||
100 | _mav_put_int32_t(buf, 10, input_c); |
||
101 | _mav_put_uint8_t(buf, 14, save_position); |
||
102 | |||
103 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 15); |
||
104 | #else |
||
105 | mavlink_mount_control_t packet; |
||
106 | packet.target_system = target_system; |
||
107 | packet.target_component = target_component; |
||
108 | packet.input_a = input_a; |
||
109 | packet.input_b = input_b; |
||
110 | packet.input_c = input_c; |
||
111 | packet.save_position = save_position; |
||
112 | |||
113 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 15); |
||
114 | #endif |
||
115 | |||
116 | msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; |
||
117 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 15); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * @brief Encode a mount_control struct into a message |
||
122 | * |
||
123 | * @param system_id ID of this system |
||
124 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
125 | * @param msg The MAVLink message to compress the data into |
||
126 | * @param mount_control C-struct to read the message contents from |
||
127 | */ |
||
128 | 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) |
||
129 | { |
||
130 | 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); |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @brief Send a mount_control message |
||
135 | * @param chan MAVLink channel to send the message |
||
136 | * |
||
137 | * @param target_system System ID |
||
138 | * @param target_component Component ID |
||
139 | * @param input_a pitch(deg*100) or lat, depending on mount mode |
||
140 | * @param input_b roll(deg*100) or lon depending on mount mode |
||
141 | * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode |
||
142 | * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) |
||
143 | */ |
||
144 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
145 | |||
146 | 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) |
||
147 | { |
||
148 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
149 | char buf[15]; |
||
150 | _mav_put_uint8_t(buf, 0, target_system); |
||
151 | _mav_put_uint8_t(buf, 1, target_component); |
||
152 | _mav_put_int32_t(buf, 2, input_a); |
||
153 | _mav_put_int32_t(buf, 6, input_b); |
||
154 | _mav_put_int32_t(buf, 10, input_c); |
||
155 | _mav_put_uint8_t(buf, 14, save_position); |
||
156 | |||
157 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, 15); |
||
158 | #else |
||
159 | mavlink_mount_control_t packet; |
||
160 | packet.target_system = target_system; |
||
161 | packet.target_component = target_component; |
||
162 | packet.input_a = input_a; |
||
163 | packet.input_b = input_b; |
||
164 | packet.input_c = input_c; |
||
165 | packet.save_position = save_position; |
||
166 | |||
167 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, 15); |
||
168 | #endif |
||
169 | } |
||
170 | |||
171 | #endif |
||
172 | |||
173 | // MESSAGE MOUNT_CONTROL UNPACKING |
||
174 | |||
175 | |||
176 | /** |
||
177 | * @brief Get field target_system from mount_control message |
||
178 | * |
||
179 | * @return System ID |
||
180 | */ |
||
181 | static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg) |
||
182 | { |
||
183 | return _MAV_RETURN_uint8_t(msg, 0); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @brief Get field target_component from mount_control message |
||
188 | * |
||
189 | * @return Component ID |
||
190 | */ |
||
191 | static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg) |
||
192 | { |
||
193 | return _MAV_RETURN_uint8_t(msg, 1); |
||
194 | } |
||
195 | |||
196 | /** |
||
197 | * @brief Get field input_a from mount_control message |
||
198 | * |
||
199 | * @return pitch(deg*100) or lat, depending on mount mode |
||
200 | */ |
||
201 | static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg) |
||
202 | { |
||
203 | return _MAV_RETURN_int32_t(msg, 2); |
||
204 | } |
||
205 | |||
206 | /** |
||
207 | * @brief Get field input_b from mount_control message |
||
208 | * |
||
209 | * @return roll(deg*100) or lon depending on mount mode |
||
210 | */ |
||
211 | static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg) |
||
212 | { |
||
213 | return _MAV_RETURN_int32_t(msg, 6); |
||
214 | } |
||
215 | |||
216 | /** |
||
217 | * @brief Get field input_c from mount_control message |
||
218 | * |
||
219 | * @return yaw(deg*100) or alt (in cm) depending on mount mode |
||
220 | */ |
||
221 | static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg) |
||
222 | { |
||
223 | return _MAV_RETURN_int32_t(msg, 10); |
||
224 | } |
||
225 | |||
226 | /** |
||
227 | * @brief Get field save_position from mount_control message |
||
228 | * |
||
229 | * @return if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) |
||
230 | */ |
||
231 | static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg) |
||
232 | { |
||
233 | return _MAV_RETURN_uint8_t(msg, 14); |
||
234 | } |
||
235 | |||
236 | /** |
||
237 | * @brief Decode a mount_control message into a struct |
||
238 | * |
||
239 | * @param msg The message to decode |
||
240 | * @param mount_control C-struct to decode the message contents into |
||
241 | */ |
||
242 | static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control) |
||
243 | { |
||
244 | #if MAVLINK_NEED_BYTE_SWAP |
||
245 | mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg); |
||
246 | mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg); |
||
247 | mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg); |
||
248 | mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg); |
||
249 | mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg); |
||
250 | mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg); |
||
251 | #else |
||
252 | memcpy(mount_control, _MAV_PAYLOAD(msg), 15); |
||
253 | #endif |
||
254 | } |