Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_scaled_pressure2.h
blob674f505963ab0f5a4372fa45d3059c4ed758ee14
1 // MESSAGE SCALED_PRESSURE2 PACKING
3 #define MAVLINK_MSG_ID_SCALED_PRESSURE2 137
5 typedef struct __mavlink_scaled_pressure2_t
7 uint32_t time_boot_ms; ///< Timestamp (milliseconds since system boot)
8 float press_abs; ///< Absolute pressure (hectopascal)
9 float press_diff; ///< Differential pressure 1 (hectopascal)
10 int16_t temperature; ///< Temperature measurement (0.01 degrees celsius)
11 } mavlink_scaled_pressure2_t;
13 #define MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN 14
14 #define MAVLINK_MSG_ID_137_LEN 14
16 #define MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC 195
17 #define MAVLINK_MSG_ID_137_CRC 195
21 #define MAVLINK_MESSAGE_INFO_SCALED_PRESSURE2 { \
22 "SCALED_PRESSURE2", \
23 4, \
24 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_pressure2_t, time_boot_ms) }, \
25 { "press_abs", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_scaled_pressure2_t, press_abs) }, \
26 { "press_diff", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_scaled_pressure2_t, press_diff) }, \
27 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_pressure2_t, temperature) }, \
28 } \
32 /**
33 * @brief Pack a scaled_pressure2 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 time_boot_ms Timestamp (milliseconds since system boot)
39 * @param press_abs Absolute pressure (hectopascal)
40 * @param press_diff Differential pressure 1 (hectopascal)
41 * @param temperature Temperature measurement (0.01 degrees celsius)
42 * @return length of the message in bytes (excluding serial stream start sign)
44 static inline uint16_t mavlink_msg_scaled_pressure2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45 uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48 char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
49 _mav_put_uint32_t(buf, 0, time_boot_ms);
50 _mav_put_float(buf, 4, press_abs);
51 _mav_put_float(buf, 8, press_diff);
52 _mav_put_int16_t(buf, 12, temperature);
54 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
55 #else
56 mavlink_scaled_pressure2_t packet;
57 packet.time_boot_ms = time_boot_ms;
58 packet.press_abs = press_abs;
59 packet.press_diff = press_diff;
60 packet.temperature = temperature;
62 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
63 #endif
65 msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2;
66 #if MAVLINK_CRC_EXTRA
67 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
68 #else
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
70 #endif
73 /**
74 * @brief Pack a scaled_pressure2 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 time_boot_ms Timestamp (milliseconds since system boot)
80 * @param press_abs Absolute pressure (hectopascal)
81 * @param press_diff Differential pressure 1 (hectopascal)
82 * @param temperature Temperature measurement (0.01 degrees celsius)
83 * @return length of the message in bytes (excluding serial stream start sign)
85 static inline uint16_t mavlink_msg_scaled_pressure2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
86 mavlink_message_t* msg,
87 uint32_t time_boot_ms,float press_abs,float press_diff,int16_t temperature)
89 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
91 _mav_put_uint32_t(buf, 0, time_boot_ms);
92 _mav_put_float(buf, 4, press_abs);
93 _mav_put_float(buf, 8, press_diff);
94 _mav_put_int16_t(buf, 12, temperature);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
97 #else
98 mavlink_scaled_pressure2_t packet;
99 packet.time_boot_ms = time_boot_ms;
100 packet.press_abs = press_abs;
101 packet.press_diff = press_diff;
102 packet.temperature = temperature;
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
105 #endif
107 msg->msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2;
108 #if MAVLINK_CRC_EXTRA
109 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
110 #else
111 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
112 #endif
116 * @brief Encode a scaled_pressure2 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 scaled_pressure2 C-struct to read the message contents from
123 static inline uint16_t mavlink_msg_scaled_pressure2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_pressure2_t* scaled_pressure2)
125 return mavlink_msg_scaled_pressure2_pack(system_id, component_id, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature);
129 * @brief Encode a scaled_pressure2 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 scaled_pressure2 C-struct to read the message contents from
137 static inline uint16_t mavlink_msg_scaled_pressure2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_pressure2_t* scaled_pressure2)
139 return mavlink_msg_scaled_pressure2_pack_chan(system_id, component_id, chan, msg, scaled_pressure2->time_boot_ms, scaled_pressure2->press_abs, scaled_pressure2->press_diff, scaled_pressure2->temperature);
143 * @brief Send a scaled_pressure2 message
144 * @param chan MAVLink channel to send the message
146 * @param time_boot_ms Timestamp (milliseconds since system boot)
147 * @param press_abs Absolute pressure (hectopascal)
148 * @param press_diff Differential pressure 1 (hectopascal)
149 * @param temperature Temperature measurement (0.01 degrees celsius)
151 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
153 static inline void mavlink_msg_scaled_pressure2_send(mavlink_channel_t chan, uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 char buf[MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN];
157 _mav_put_uint32_t(buf, 0, time_boot_ms);
158 _mav_put_float(buf, 4, press_abs);
159 _mav_put_float(buf, 8, press_diff);
160 _mav_put_int16_t(buf, 12, temperature);
162 #if MAVLINK_CRC_EXTRA
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
164 #else
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
166 #endif
167 #else
168 mavlink_scaled_pressure2_t packet;
169 packet.time_boot_ms = time_boot_ms;
170 packet.press_abs = press_abs;
171 packet.press_diff = press_diff;
172 packet.temperature = temperature;
174 #if MAVLINK_CRC_EXTRA
175 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
176 #else
177 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
178 #endif
179 #endif
182 #if MAVLINK_MSG_ID_SCALED_PRESSURE2_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_scaled_pressure2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float press_abs, float press_diff, int16_t temperature)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char *buf = (char *)msgbuf;
194 _mav_put_uint32_t(buf, 0, time_boot_ms);
195 _mav_put_float(buf, 4, press_abs);
196 _mav_put_float(buf, 8, press_diff);
197 _mav_put_int16_t(buf, 12, temperature);
199 #if MAVLINK_CRC_EXTRA
200 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
201 #else
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, buf, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
203 #endif
204 #else
205 mavlink_scaled_pressure2_t *packet = (mavlink_scaled_pressure2_t *)msgbuf;
206 packet->time_boot_ms = time_boot_ms;
207 packet->press_abs = press_abs;
208 packet->press_diff = press_diff;
209 packet->temperature = temperature;
211 #if MAVLINK_CRC_EXTRA
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN, MAVLINK_MSG_ID_SCALED_PRESSURE2_CRC);
213 #else
214 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_PRESSURE2, (const char *)packet, MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
215 #endif
216 #endif
218 #endif
220 #endif
222 // MESSAGE SCALED_PRESSURE2 UNPACKING
226 * @brief Get field time_boot_ms from scaled_pressure2 message
228 * @return Timestamp (milliseconds since system boot)
230 static inline uint32_t mavlink_msg_scaled_pressure2_get_time_boot_ms(const mavlink_message_t* msg)
232 return _MAV_RETURN_uint32_t(msg, 0);
236 * @brief Get field press_abs from scaled_pressure2 message
238 * @return Absolute pressure (hectopascal)
240 static inline float mavlink_msg_scaled_pressure2_get_press_abs(const mavlink_message_t* msg)
242 return _MAV_RETURN_float(msg, 4);
246 * @brief Get field press_diff from scaled_pressure2 message
248 * @return Differential pressure 1 (hectopascal)
250 static inline float mavlink_msg_scaled_pressure2_get_press_diff(const mavlink_message_t* msg)
252 return _MAV_RETURN_float(msg, 8);
256 * @brief Get field temperature from scaled_pressure2 message
258 * @return Temperature measurement (0.01 degrees celsius)
260 static inline int16_t mavlink_msg_scaled_pressure2_get_temperature(const mavlink_message_t* msg)
262 return _MAV_RETURN_int16_t(msg, 12);
266 * @brief Decode a scaled_pressure2 message into a struct
268 * @param msg The message to decode
269 * @param scaled_pressure2 C-struct to decode the message contents into
271 static inline void mavlink_msg_scaled_pressure2_decode(const mavlink_message_t* msg, mavlink_scaled_pressure2_t* scaled_pressure2)
273 #if MAVLINK_NEED_BYTE_SWAP
274 scaled_pressure2->time_boot_ms = mavlink_msg_scaled_pressure2_get_time_boot_ms(msg);
275 scaled_pressure2->press_abs = mavlink_msg_scaled_pressure2_get_press_abs(msg);
276 scaled_pressure2->press_diff = mavlink_msg_scaled_pressure2_get_press_diff(msg);
277 scaled_pressure2->temperature = mavlink_msg_scaled_pressure2_get_temperature(msg);
278 #else
279 memcpy(scaled_pressure2, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SCALED_PRESSURE2_LEN);
280 #endif