Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_set_gps_global_origin.h
blobf5d918f4379f9a408ef98d85950dfb90609b2897
1 // MESSAGE SET_GPS_GLOBAL_ORIGIN PACKING
3 #define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN 48
5 typedef struct __mavlink_set_gps_global_origin_t
7 int32_t latitude; ///< Latitude (WGS84), in degrees * 1E7
8 int32_t longitude; ///< Longitude (WGS84, in degrees * 1E7
9 int32_t altitude; ///< Altitude (AMSL), in meters * 1000 (positive for up)
10 uint8_t target_system; ///< System ID
11 } mavlink_set_gps_global_origin_t;
13 #define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN 13
14 #define MAVLINK_MSG_ID_48_LEN 13
16 #define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC 41
17 #define MAVLINK_MSG_ID_48_CRC 41
21 #define MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN { \
22 "SET_GPS_GLOBAL_ORIGIN", \
23 4, \
24 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_gps_global_origin_t, latitude) }, \
25 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_gps_global_origin_t, longitude) }, \
26 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_gps_global_origin_t, altitude) }, \
27 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_gps_global_origin_t, target_system) }, \
28 } \
32 /**
33 * @brief Pack a set_gps_global_origin 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 target_system System ID
39 * @param latitude Latitude (WGS84), in degrees * 1E7
40 * @param longitude Longitude (WGS84, in degrees * 1E7
41 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
42 * @return length of the message in bytes (excluding serial stream start sign)
44 static inline uint16_t mavlink_msg_set_gps_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45 uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
49 _mav_put_int32_t(buf, 0, latitude);
50 _mav_put_int32_t(buf, 4, longitude);
51 _mav_put_int32_t(buf, 8, altitude);
52 _mav_put_uint8_t(buf, 12, target_system);
54 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
55 #else
56 mavlink_set_gps_global_origin_t packet;
57 packet.latitude = latitude;
58 packet.longitude = longitude;
59 packet.altitude = altitude;
60 packet.target_system = target_system;
62 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
63 #endif
65 msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
66 #if MAVLINK_CRC_EXTRA
67 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
68 #else
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
70 #endif
73 /**
74 * @brief Pack a set_gps_global_origin 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 target_system System ID
80 * @param latitude Latitude (WGS84), in degrees * 1E7
81 * @param longitude Longitude (WGS84, in degrees * 1E7
82 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
83 * @return length of the message in bytes (excluding serial stream start sign)
85 static inline uint16_t mavlink_msg_set_gps_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
86 mavlink_message_t* msg,
87 uint8_t target_system,int32_t latitude,int32_t longitude,int32_t altitude)
89 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
91 _mav_put_int32_t(buf, 0, latitude);
92 _mav_put_int32_t(buf, 4, longitude);
93 _mav_put_int32_t(buf, 8, altitude);
94 _mav_put_uint8_t(buf, 12, target_system);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
97 #else
98 mavlink_set_gps_global_origin_t packet;
99 packet.latitude = latitude;
100 packet.longitude = longitude;
101 packet.altitude = altitude;
102 packet.target_system = target_system;
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
105 #endif
107 msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
108 #if MAVLINK_CRC_EXTRA
109 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
110 #else
111 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
112 #endif
116 * @brief Encode a set_gps_global_origin 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 set_gps_global_origin C-struct to read the message contents from
123 static inline uint16_t mavlink_msg_set_gps_global_origin_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_gps_global_origin_t* set_gps_global_origin)
125 return mavlink_msg_set_gps_global_origin_pack(system_id, component_id, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude);
129 * @brief Encode a set_gps_global_origin 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 set_gps_global_origin C-struct to read the message contents from
137 static inline uint16_t mavlink_msg_set_gps_global_origin_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_gps_global_origin_t* set_gps_global_origin)
139 return mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, chan, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude);
143 * @brief Send a set_gps_global_origin message
144 * @param chan MAVLink channel to send the message
146 * @param target_system System ID
147 * @param latitude Latitude (WGS84), in degrees * 1E7
148 * @param longitude Longitude (WGS84, in degrees * 1E7
149 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
151 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
153 static inline void mavlink_msg_set_gps_global_origin_send(mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
157 _mav_put_int32_t(buf, 0, latitude);
158 _mav_put_int32_t(buf, 4, longitude);
159 _mav_put_int32_t(buf, 8, altitude);
160 _mav_put_uint8_t(buf, 12, target_system);
162 #if MAVLINK_CRC_EXTRA
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
164 #else
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
166 #endif
167 #else
168 mavlink_set_gps_global_origin_t packet;
169 packet.latitude = latitude;
170 packet.longitude = longitude;
171 packet.altitude = altitude;
172 packet.target_system = target_system;
174 #if MAVLINK_CRC_EXTRA
175 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)&packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
176 #else
177 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)&packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
178 #endif
179 #endif
182 #if MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_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_set_gps_global_origin_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char *buf = (char *)msgbuf;
194 _mav_put_int32_t(buf, 0, latitude);
195 _mav_put_int32_t(buf, 4, longitude);
196 _mav_put_int32_t(buf, 8, altitude);
197 _mav_put_uint8_t(buf, 12, target_system);
199 #if MAVLINK_CRC_EXTRA
200 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
201 #else
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
203 #endif
204 #else
205 mavlink_set_gps_global_origin_t *packet = (mavlink_set_gps_global_origin_t *)msgbuf;
206 packet->latitude = latitude;
207 packet->longitude = longitude;
208 packet->altitude = altitude;
209 packet->target_system = target_system;
211 #if MAVLINK_CRC_EXTRA
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
213 #else
214 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
215 #endif
216 #endif
218 #endif
220 #endif
222 // MESSAGE SET_GPS_GLOBAL_ORIGIN UNPACKING
226 * @brief Get field target_system from set_gps_global_origin message
228 * @return System ID
230 static inline uint8_t mavlink_msg_set_gps_global_origin_get_target_system(const mavlink_message_t* msg)
232 return _MAV_RETURN_uint8_t(msg, 12);
236 * @brief Get field latitude from set_gps_global_origin message
238 * @return Latitude (WGS84), in degrees * 1E7
240 static inline int32_t mavlink_msg_set_gps_global_origin_get_latitude(const mavlink_message_t* msg)
242 return _MAV_RETURN_int32_t(msg, 0);
246 * @brief Get field longitude from set_gps_global_origin message
248 * @return Longitude (WGS84, in degrees * 1E7
250 static inline int32_t mavlink_msg_set_gps_global_origin_get_longitude(const mavlink_message_t* msg)
252 return _MAV_RETURN_int32_t(msg, 4);
256 * @brief Get field altitude from set_gps_global_origin message
258 * @return Altitude (AMSL), in meters * 1000 (positive for up)
260 static inline int32_t mavlink_msg_set_gps_global_origin_get_altitude(const mavlink_message_t* msg)
262 return _MAV_RETURN_int32_t(msg, 8);
266 * @brief Decode a set_gps_global_origin message into a struct
268 * @param msg The message to decode
269 * @param set_gps_global_origin C-struct to decode the message contents into
271 static inline void mavlink_msg_set_gps_global_origin_decode(const mavlink_message_t* msg, mavlink_set_gps_global_origin_t* set_gps_global_origin)
273 #if MAVLINK_NEED_BYTE_SWAP
274 set_gps_global_origin->latitude = mavlink_msg_set_gps_global_origin_get_latitude(msg);
275 set_gps_global_origin->longitude = mavlink_msg_set_gps_global_origin_get_longitude(msg);
276 set_gps_global_origin->altitude = mavlink_msg_set_gps_global_origin_get_altitude(msg);
277 set_gps_global_origin->target_system = mavlink_msg_set_gps_global_origin_get_target_system(msg);
278 #else
279 memcpy(set_gps_global_origin, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
280 #endif