Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_radio_status.h
blobdbd187ecd3baea60dde19c9cbd61f8498f5c28b3
1 // MESSAGE RADIO_STATUS PACKING
3 #define MAVLINK_MSG_ID_RADIO_STATUS 109
5 typedef struct __mavlink_radio_status_t
7 uint16_t rxerrors; ///< Receive errors
8 uint16_t fixed; ///< Count of error corrected packets
9 uint8_t rssi; ///< Local signal strength
10 uint8_t remrssi; ///< Remote signal strength
11 uint8_t txbuf; ///< Remaining free buffer space in percent.
12 uint8_t noise; ///< Background noise level
13 uint8_t remnoise; ///< Remote background noise level
14 } mavlink_radio_status_t;
16 #define MAVLINK_MSG_ID_RADIO_STATUS_LEN 9
17 #define MAVLINK_MSG_ID_109_LEN 9
19 #define MAVLINK_MSG_ID_RADIO_STATUS_CRC 185
20 #define MAVLINK_MSG_ID_109_CRC 185
24 #define MAVLINK_MESSAGE_INFO_RADIO_STATUS { \
25 "RADIO_STATUS", \
26 7, \
27 { { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) }, \
28 { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) }, \
29 { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) }, \
30 { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) }, \
31 { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) }, \
32 { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) }, \
33 { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) }, \
34 } \
38 /**
39 * @brief Pack a radio_status message
40 * @param system_id ID of this system
41 * @param component_id ID of this component (e.g. 200 for IMU)
42 * @param msg The MAVLink message to compress the data into
44 * @param rssi Local signal strength
45 * @param remrssi Remote signal strength
46 * @param txbuf Remaining free buffer space in percent.
47 * @param noise Background noise level
48 * @param remnoise Remote background noise level
49 * @param rxerrors Receive errors
50 * @param fixed Count of error corrected packets
51 * @return length of the message in bytes (excluding serial stream start sign)
53 static inline uint16_t mavlink_msg_radio_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54 uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
57 char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN];
58 _mav_put_uint16_t(buf, 0, rxerrors);
59 _mav_put_uint16_t(buf, 2, fixed);
60 _mav_put_uint8_t(buf, 4, rssi);
61 _mav_put_uint8_t(buf, 5, remrssi);
62 _mav_put_uint8_t(buf, 6, txbuf);
63 _mav_put_uint8_t(buf, 7, noise);
64 _mav_put_uint8_t(buf, 8, remnoise);
66 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
67 #else
68 mavlink_radio_status_t packet;
69 packet.rxerrors = rxerrors;
70 packet.fixed = fixed;
71 packet.rssi = rssi;
72 packet.remrssi = remrssi;
73 packet.txbuf = txbuf;
74 packet.noise = noise;
75 packet.remnoise = remnoise;
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
78 #endif
80 msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
81 #if MAVLINK_CRC_EXTRA
82 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
83 #else
84 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
85 #endif
88 /**
89 * @brief Pack a radio_status message on a channel
90 * @param system_id ID of this system
91 * @param component_id ID of this component (e.g. 200 for IMU)
92 * @param chan The MAVLink channel this message will be sent over
93 * @param msg The MAVLink message to compress the data into
94 * @param rssi Local signal strength
95 * @param remrssi Remote signal strength
96 * @param txbuf Remaining free buffer space in percent.
97 * @param noise Background noise level
98 * @param remnoise Remote background noise level
99 * @param rxerrors Receive errors
100 * @param fixed Count of error corrected packets
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_radio_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104 mavlink_message_t* msg,
105 uint8_t rssi,uint8_t remrssi,uint8_t txbuf,uint8_t noise,uint8_t remnoise,uint16_t rxerrors,uint16_t fixed)
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN];
109 _mav_put_uint16_t(buf, 0, rxerrors);
110 _mav_put_uint16_t(buf, 2, fixed);
111 _mav_put_uint8_t(buf, 4, rssi);
112 _mav_put_uint8_t(buf, 5, remrssi);
113 _mav_put_uint8_t(buf, 6, txbuf);
114 _mav_put_uint8_t(buf, 7, noise);
115 _mav_put_uint8_t(buf, 8, remnoise);
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
118 #else
119 mavlink_radio_status_t packet;
120 packet.rxerrors = rxerrors;
121 packet.fixed = fixed;
122 packet.rssi = rssi;
123 packet.remrssi = remrssi;
124 packet.txbuf = txbuf;
125 packet.noise = noise;
126 packet.remnoise = remnoise;
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
129 #endif
131 msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
132 #if MAVLINK_CRC_EXTRA
133 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
134 #else
135 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
136 #endif
140 * @brief Encode a radio_status struct
142 * @param system_id ID of this system
143 * @param component_id ID of this component (e.g. 200 for IMU)
144 * @param msg The MAVLink message to compress the data into
145 * @param radio_status C-struct to read the message contents from
147 static inline uint16_t mavlink_msg_radio_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status)
149 return mavlink_msg_radio_status_pack(system_id, component_id, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
153 * @brief Encode a radio_status struct on a channel
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param chan The MAVLink channel this message will be sent over
158 * @param msg The MAVLink message to compress the data into
159 * @param radio_status C-struct to read the message contents from
161 static inline uint16_t mavlink_msg_radio_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status)
163 return mavlink_msg_radio_status_pack_chan(system_id, component_id, chan, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
167 * @brief Send a radio_status message
168 * @param chan MAVLink channel to send the message
170 * @param rssi Local signal strength
171 * @param remrssi Remote signal strength
172 * @param txbuf Remaining free buffer space in percent.
173 * @param noise Background noise level
174 * @param remnoise Remote background noise level
175 * @param rxerrors Receive errors
176 * @param fixed Count of error corrected packets
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
180 static inline void mavlink_msg_radio_status_send(mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN];
184 _mav_put_uint16_t(buf, 0, rxerrors);
185 _mav_put_uint16_t(buf, 2, fixed);
186 _mav_put_uint8_t(buf, 4, rssi);
187 _mav_put_uint8_t(buf, 5, remrssi);
188 _mav_put_uint8_t(buf, 6, txbuf);
189 _mav_put_uint8_t(buf, 7, noise);
190 _mav_put_uint8_t(buf, 8, remnoise);
192 #if MAVLINK_CRC_EXTRA
193 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
194 #else
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
196 #endif
197 #else
198 mavlink_radio_status_t packet;
199 packet.rxerrors = rxerrors;
200 packet.fixed = fixed;
201 packet.rssi = rssi;
202 packet.remrssi = remrssi;
203 packet.txbuf = txbuf;
204 packet.noise = noise;
205 packet.remnoise = remnoise;
207 #if MAVLINK_CRC_EXTRA
208 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
209 #else
210 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
211 #endif
212 #endif
215 #if MAVLINK_MSG_ID_RADIO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
217 This varient of _send() can be used to save stack space by re-using
218 memory from the receive buffer. The caller provides a
219 mavlink_message_t which is the size of a full mavlink message. This
220 is usually the receive buffer for the channel, and allows a reply to an
221 incoming message with minimum stack space usage.
223 static inline void mavlink_msg_radio_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226 char *buf = (char *)msgbuf;
227 _mav_put_uint16_t(buf, 0, rxerrors);
228 _mav_put_uint16_t(buf, 2, fixed);
229 _mav_put_uint8_t(buf, 4, rssi);
230 _mav_put_uint8_t(buf, 5, remrssi);
231 _mav_put_uint8_t(buf, 6, txbuf);
232 _mav_put_uint8_t(buf, 7, noise);
233 _mav_put_uint8_t(buf, 8, remnoise);
235 #if MAVLINK_CRC_EXTRA
236 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
237 #else
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
239 #endif
240 #else
241 mavlink_radio_status_t *packet = (mavlink_radio_status_t *)msgbuf;
242 packet->rxerrors = rxerrors;
243 packet->fixed = fixed;
244 packet->rssi = rssi;
245 packet->remrssi = remrssi;
246 packet->txbuf = txbuf;
247 packet->noise = noise;
248 packet->remnoise = remnoise;
250 #if MAVLINK_CRC_EXTRA
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
252 #else
253 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
254 #endif
255 #endif
257 #endif
259 #endif
261 // MESSAGE RADIO_STATUS UNPACKING
265 * @brief Get field rssi from radio_status message
267 * @return Local signal strength
269 static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* msg)
271 return _MAV_RETURN_uint8_t(msg, 4);
275 * @brief Get field remrssi from radio_status message
277 * @return Remote signal strength
279 static inline uint8_t mavlink_msg_radio_status_get_remrssi(const mavlink_message_t* msg)
281 return _MAV_RETURN_uint8_t(msg, 5);
285 * @brief Get field txbuf from radio_status message
287 * @return Remaining free buffer space in percent.
289 static inline uint8_t mavlink_msg_radio_status_get_txbuf(const mavlink_message_t* msg)
291 return _MAV_RETURN_uint8_t(msg, 6);
295 * @brief Get field noise from radio_status message
297 * @return Background noise level
299 static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t* msg)
301 return _MAV_RETURN_uint8_t(msg, 7);
305 * @brief Get field remnoise from radio_status message
307 * @return Remote background noise level
309 static inline uint8_t mavlink_msg_radio_status_get_remnoise(const mavlink_message_t* msg)
311 return _MAV_RETURN_uint8_t(msg, 8);
315 * @brief Get field rxerrors from radio_status message
317 * @return Receive errors
319 static inline uint16_t mavlink_msg_radio_status_get_rxerrors(const mavlink_message_t* msg)
321 return _MAV_RETURN_uint16_t(msg, 0);
325 * @brief Get field fixed from radio_status message
327 * @return Count of error corrected packets
329 static inline uint16_t mavlink_msg_radio_status_get_fixed(const mavlink_message_t* msg)
331 return _MAV_RETURN_uint16_t(msg, 2);
335 * @brief Decode a radio_status message into a struct
337 * @param msg The message to decode
338 * @param radio_status C-struct to decode the message contents into
340 static inline void mavlink_msg_radio_status_decode(const mavlink_message_t* msg, mavlink_radio_status_t* radio_status)
342 #if MAVLINK_NEED_BYTE_SWAP
343 radio_status->rxerrors = mavlink_msg_radio_status_get_rxerrors(msg);
344 radio_status->fixed = mavlink_msg_radio_status_get_fixed(msg);
345 radio_status->rssi = mavlink_msg_radio_status_get_rssi(msg);
346 radio_status->remrssi = mavlink_msg_radio_status_get_remrssi(msg);
347 radio_status->txbuf = mavlink_msg_radio_status_get_txbuf(msg);
348 radio_status->noise = mavlink_msg_radio_status_get_noise(msg);
349 radio_status->remnoise = mavlink_msg_radio_status_get_remnoise(msg);
350 #else
351 memcpy(radio_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RADIO_STATUS_LEN);
352 #endif