1 // MESSAGE SCALED_PRESSURE PACKING
3 #define MAVLINK_MSG_ID_SCALED_PRESSURE 29
5 typedef struct __mavlink_scaled_pressure_t
{
6 uint32_t time_boot_ms
; ///< Timestamp (milliseconds since system boot)
7 float press_abs
; ///< Absolute pressure (hectopascal)
8 float press_diff
; ///< Differential pressure 1 (hectopascal)
9 int16_t temperature
; ///< Temperature measurement (0.01 degrees celsius)
10 } mavlink_scaled_pressure_t
;
12 #define MAVLINK_MSG_ID_SCALED_PRESSURE_LEN 14
13 #define MAVLINK_MSG_ID_29_LEN 14
16 #define MAVLINK_MESSAGE_INFO_SCALED_PRESSURE \
21 { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_pressure_t, time_boot_ms) }, \
22 { "press_abs", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_scaled_pressure_t, press_abs) }, \
23 { "press_diff", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_scaled_pressure_t, press_diff) }, \
24 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_pressure_t, temperature) }, \
30 * @brief Pack a scaled_pressure message
31 * @param system_id ID of this system
32 * @param component_id ID of this component (e.g. 200 for IMU)
33 * @param msg The MAVLink message to compress the data into
35 * @param time_boot_ms Timestamp (milliseconds since system boot)
36 * @param press_abs Absolute pressure (hectopascal)
37 * @param press_diff Differential pressure 1 (hectopascal)
38 * @param temperature Temperature measurement (0.01 degrees celsius)
39 * @return length of the message in bytes (excluding serial stream start sign)
41 static inline uint16_t mavlink_msg_scaled_pressure_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
,
42 uint32_t time_boot_ms
, float press_abs
, float press_diff
, int16_t temperature
)
44 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
46 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
47 _mav_put_float(buf
, 4, press_abs
);
48 _mav_put_float(buf
, 8, press_diff
);
49 _mav_put_int16_t(buf
, 12, temperature
);
51 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 14);
53 mavlink_scaled_pressure_t packet
;
54 packet
.time_boot_ms
= time_boot_ms
;
55 packet
.press_abs
= press_abs
;
56 packet
.press_diff
= press_diff
;
57 packet
.temperature
= temperature
;
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 14);
62 msg
->msgid
= MAVLINK_MSG_ID_SCALED_PRESSURE
;
63 return mavlink_finalize_message(msg
, system_id
, component_id
, 14, 115);
67 * @brief Pack a scaled_pressure message on a channel
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param chan The MAVLink channel this message was sent over
71 * @param msg The MAVLink message to compress the data into
72 * @param time_boot_ms Timestamp (milliseconds since system boot)
73 * @param press_abs Absolute pressure (hectopascal)
74 * @param press_diff Differential pressure 1 (hectopascal)
75 * @param temperature Temperature measurement (0.01 degrees celsius)
76 * @return length of the message in bytes (excluding serial stream start sign)
78 static inline uint16_t mavlink_msg_scaled_pressure_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
79 mavlink_message_t
*msg
,
80 uint32_t time_boot_ms
, float press_abs
, float press_diff
, int16_t temperature
)
82 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
84 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
85 _mav_put_float(buf
, 4, press_abs
);
86 _mav_put_float(buf
, 8, press_diff
);
87 _mav_put_int16_t(buf
, 12, temperature
);
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 14);
91 mavlink_scaled_pressure_t packet
;
92 packet
.time_boot_ms
= time_boot_ms
;
93 packet
.press_abs
= press_abs
;
94 packet
.press_diff
= press_diff
;
95 packet
.temperature
= temperature
;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 14);
100 msg
->msgid
= MAVLINK_MSG_ID_SCALED_PRESSURE
;
101 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, 14, 115);
105 * @brief Encode a scaled_pressure struct into a message
107 * @param system_id ID of this system
108 * @param component_id ID of this component (e.g. 200 for IMU)
109 * @param msg The MAVLink message to compress the data into
110 * @param scaled_pressure C-struct to read the message contents from
112 static inline uint16_t mavlink_msg_scaled_pressure_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
, const mavlink_scaled_pressure_t
*scaled_pressure
)
114 return mavlink_msg_scaled_pressure_pack(system_id
, component_id
, msg
, scaled_pressure
->time_boot_ms
, scaled_pressure
->press_abs
, scaled_pressure
->press_diff
, scaled_pressure
->temperature
);
118 * @brief Send a scaled_pressure message
119 * @param chan MAVLink channel to send the message
121 * @param time_boot_ms Timestamp (milliseconds since system boot)
122 * @param press_abs Absolute pressure (hectopascal)
123 * @param press_diff Differential pressure 1 (hectopascal)
124 * @param temperature Temperature measurement (0.01 degrees celsius)
126 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
128 static inline void mavlink_msg_scaled_pressure_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, float press_abs
, float press_diff
, int16_t temperature
)
130 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
132 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
133 _mav_put_float(buf
, 4, press_abs
);
134 _mav_put_float(buf
, 8, press_diff
);
135 _mav_put_int16_t(buf
, 12, temperature
);
137 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_PRESSURE
, buf
, 14, 115);
139 mavlink_scaled_pressure_t packet
;
140 packet
.time_boot_ms
= time_boot_ms
;
141 packet
.press_abs
= press_abs
;
142 packet
.press_diff
= press_diff
;
143 packet
.temperature
= temperature
;
145 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_PRESSURE
, (const char *)&packet
, 14, 115);
149 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
151 // MESSAGE SCALED_PRESSURE UNPACKING
155 * @brief Get field time_boot_ms from scaled_pressure message
157 * @return Timestamp (milliseconds since system boot)
159 static inline uint32_t mavlink_msg_scaled_pressure_get_time_boot_ms(const mavlink_message_t
*msg
)
161 return _MAV_RETURN_uint32_t(msg
, 0);
165 * @brief Get field press_abs from scaled_pressure message
167 * @return Absolute pressure (hectopascal)
169 static inline float mavlink_msg_scaled_pressure_get_press_abs(const mavlink_message_t
*msg
)
171 return _MAV_RETURN_float(msg
, 4);
175 * @brief Get field press_diff from scaled_pressure message
177 * @return Differential pressure 1 (hectopascal)
179 static inline float mavlink_msg_scaled_pressure_get_press_diff(const mavlink_message_t
*msg
)
181 return _MAV_RETURN_float(msg
, 8);
185 * @brief Get field temperature from scaled_pressure message
187 * @return Temperature measurement (0.01 degrees celsius)
189 static inline int16_t mavlink_msg_scaled_pressure_get_temperature(const mavlink_message_t
*msg
)
191 return _MAV_RETURN_int16_t(msg
, 12);
195 * @brief Decode a scaled_pressure message into a struct
197 * @param msg The message to decode
198 * @param scaled_pressure C-struct to decode the message contents into
200 static inline void mavlink_msg_scaled_pressure_decode(const mavlink_message_t
*msg
, mavlink_scaled_pressure_t
*scaled_pressure
)
202 #if MAVLINK_NEED_BYTE_SWAP
203 scaled_pressure
->time_boot_ms
= mavlink_msg_scaled_pressure_get_time_boot_ms(msg
);
204 scaled_pressure
->press_abs
= mavlink_msg_scaled_pressure_get_press_abs(msg
);
205 scaled_pressure
->press_diff
= mavlink_msg_scaled_pressure_get_press_diff(msg
);
206 scaled_pressure
->temperature
= mavlink_msg_scaled_pressure_get_temperature(msg
);
208 memcpy(scaled_pressure
, _MAV_PAYLOAD(msg
), 14);