Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_terrain_request.h
blob3a85b8564f1e7362ff05d04a08b6fbc5a7eebc99
1 // MESSAGE TERRAIN_REQUEST PACKING
3 #define MAVLINK_MSG_ID_TERRAIN_REQUEST 133
5 typedef struct __mavlink_terrain_request_t
7 uint64_t mask; ///< Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
8 int32_t lat; ///< Latitude of SW corner of first grid (degrees *10^7)
9 int32_t lon; ///< Longitude of SW corner of first grid (in degrees *10^7)
10 uint16_t grid_spacing; ///< Grid spacing in meters
11 } mavlink_terrain_request_t;
13 #define MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN 18
14 #define MAVLINK_MSG_ID_133_LEN 18
16 #define MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC 6
17 #define MAVLINK_MSG_ID_133_CRC 6
21 #define MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST { \
22 "TERRAIN_REQUEST", \
23 4, \
24 { { "mask", "0x%07x", MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_terrain_request_t, mask) }, \
25 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_terrain_request_t, lat) }, \
26 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_terrain_request_t, lon) }, \
27 { "grid_spacing", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_terrain_request_t, grid_spacing) }, \
28 } \
32 /**
33 * @brief Pack a terrain_request message
34 * @param system_id ID of this system
35 * @param component_id ID of this component (e.g. 200 for IMU)
36 * @param msg The MAVLink message to compress the data into
38 * @param lat Latitude of SW corner of first grid (degrees *10^7)
39 * @param lon Longitude of SW corner of first grid (in degrees *10^7)
40 * @param grid_spacing Grid spacing in meters
41 * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
42 * @return length of the message in bytes (excluding serial stream start sign)
44 static inline uint16_t mavlink_msg_terrain_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45 int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48 char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
49 _mav_put_uint64_t(buf, 0, mask);
50 _mav_put_int32_t(buf, 8, lat);
51 _mav_put_int32_t(buf, 12, lon);
52 _mav_put_uint16_t(buf, 16, grid_spacing);
54 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
55 #else
56 mavlink_terrain_request_t packet;
57 packet.mask = mask;
58 packet.lat = lat;
59 packet.lon = lon;
60 packet.grid_spacing = grid_spacing;
62 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
63 #endif
65 msg->msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST;
66 #if MAVLINK_CRC_EXTRA
67 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
68 #else
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
70 #endif
73 /**
74 * @brief Pack a terrain_request message on a channel
75 * @param system_id ID of this system
76 * @param component_id ID of this component (e.g. 200 for IMU)
77 * @param chan The MAVLink channel this message will be sent over
78 * @param msg The MAVLink message to compress the data into
79 * @param lat Latitude of SW corner of first grid (degrees *10^7)
80 * @param lon Longitude of SW corner of first grid (in degrees *10^7)
81 * @param grid_spacing Grid spacing in meters
82 * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
83 * @return length of the message in bytes (excluding serial stream start sign)
85 static inline uint16_t mavlink_msg_terrain_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
86 mavlink_message_t* msg,
87 int32_t lat,int32_t lon,uint16_t grid_spacing,uint64_t mask)
89 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
91 _mav_put_uint64_t(buf, 0, mask);
92 _mav_put_int32_t(buf, 8, lat);
93 _mav_put_int32_t(buf, 12, lon);
94 _mav_put_uint16_t(buf, 16, grid_spacing);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
97 #else
98 mavlink_terrain_request_t packet;
99 packet.mask = mask;
100 packet.lat = lat;
101 packet.lon = lon;
102 packet.grid_spacing = grid_spacing;
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
105 #endif
107 msg->msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST;
108 #if MAVLINK_CRC_EXTRA
109 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
110 #else
111 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
112 #endif
116 * @brief Encode a terrain_request struct
118 * @param system_id ID of this system
119 * @param component_id ID of this component (e.g. 200 for IMU)
120 * @param msg The MAVLink message to compress the data into
121 * @param terrain_request C-struct to read the message contents from
123 static inline uint16_t mavlink_msg_terrain_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_terrain_request_t* terrain_request)
125 return mavlink_msg_terrain_request_pack(system_id, component_id, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask);
129 * @brief Encode a terrain_request struct on a channel
131 * @param system_id ID of this system
132 * @param component_id ID of this component (e.g. 200 for IMU)
133 * @param chan The MAVLink channel this message will be sent over
134 * @param msg The MAVLink message to compress the data into
135 * @param terrain_request C-struct to read the message contents from
137 static inline uint16_t mavlink_msg_terrain_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_terrain_request_t* terrain_request)
139 return mavlink_msg_terrain_request_pack_chan(system_id, component_id, chan, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask);
143 * @brief Send a terrain_request message
144 * @param chan MAVLink channel to send the message
146 * @param lat Latitude of SW corner of first grid (degrees *10^7)
147 * @param lon Longitude of SW corner of first grid (in degrees *10^7)
148 * @param grid_spacing Grid spacing in meters
149 * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
151 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
153 static inline void mavlink_msg_terrain_request_send(mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
157 _mav_put_uint64_t(buf, 0, mask);
158 _mav_put_int32_t(buf, 8, lat);
159 _mav_put_int32_t(buf, 12, lon);
160 _mav_put_uint16_t(buf, 16, grid_spacing);
162 #if MAVLINK_CRC_EXTRA
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
164 #else
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
166 #endif
167 #else
168 mavlink_terrain_request_t packet;
169 packet.mask = mask;
170 packet.lat = lat;
171 packet.lon = lon;
172 packet.grid_spacing = grid_spacing;
174 #if MAVLINK_CRC_EXTRA
175 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
176 #else
177 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
178 #endif
179 #endif
182 #if MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN
184 This varient of _send() can be used to save stack space by re-using
185 memory from the receive buffer. The caller provides a
186 mavlink_message_t which is the size of a full mavlink message. This
187 is usually the receive buffer for the channel, and allows a reply to an
188 incoming message with minimum stack space usage.
190 static inline void mavlink_msg_terrain_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char *buf = (char *)msgbuf;
194 _mav_put_uint64_t(buf, 0, mask);
195 _mav_put_int32_t(buf, 8, lat);
196 _mav_put_int32_t(buf, 12, lon);
197 _mav_put_uint16_t(buf, 16, grid_spacing);
199 #if MAVLINK_CRC_EXTRA
200 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
201 #else
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
203 #endif
204 #else
205 mavlink_terrain_request_t *packet = (mavlink_terrain_request_t *)msgbuf;
206 packet->mask = mask;
207 packet->lat = lat;
208 packet->lon = lon;
209 packet->grid_spacing = grid_spacing;
211 #if MAVLINK_CRC_EXTRA
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
213 #else
214 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
215 #endif
216 #endif
218 #endif
220 #endif
222 // MESSAGE TERRAIN_REQUEST UNPACKING
226 * @brief Get field lat from terrain_request message
228 * @return Latitude of SW corner of first grid (degrees *10^7)
230 static inline int32_t mavlink_msg_terrain_request_get_lat(const mavlink_message_t* msg)
232 return _MAV_RETURN_int32_t(msg, 8);
236 * @brief Get field lon from terrain_request message
238 * @return Longitude of SW corner of first grid (in degrees *10^7)
240 static inline int32_t mavlink_msg_terrain_request_get_lon(const mavlink_message_t* msg)
242 return _MAV_RETURN_int32_t(msg, 12);
246 * @brief Get field grid_spacing from terrain_request message
248 * @return Grid spacing in meters
250 static inline uint16_t mavlink_msg_terrain_request_get_grid_spacing(const mavlink_message_t* msg)
252 return _MAV_RETURN_uint16_t(msg, 16);
256 * @brief Get field mask from terrain_request message
258 * @return Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
260 static inline uint64_t mavlink_msg_terrain_request_get_mask(const mavlink_message_t* msg)
262 return _MAV_RETURN_uint64_t(msg, 0);
266 * @brief Decode a terrain_request message into a struct
268 * @param msg The message to decode
269 * @param terrain_request C-struct to decode the message contents into
271 static inline void mavlink_msg_terrain_request_decode(const mavlink_message_t* msg, mavlink_terrain_request_t* terrain_request)
273 #if MAVLINK_NEED_BYTE_SWAP
274 terrain_request->mask = mavlink_msg_terrain_request_get_mask(msg);
275 terrain_request->lat = mavlink_msg_terrain_request_get_lat(msg);
276 terrain_request->lon = mavlink_msg_terrain_request_get_lon(msg);
277 terrain_request->grid_spacing = mavlink_msg_terrain_request_get_grid_spacing(msg);
278 #else
279 memcpy(terrain_request, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
280 #endif