Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE RAW_PRESSURE PACKING
2
 
3
#define MAVLINK_MSG_ID_RAW_PRESSURE 28
4
 
5
typedef struct __mavlink_raw_pressure_t
6
{
7
 uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
8
 int16_t press_abs; ///< Absolute pressure (raw)
9
 int16_t press_diff1; ///< Differential pressure 1 (raw)
10
 int16_t press_diff2; ///< Differential pressure 2 (raw)
11
 int16_t temperature; ///< Raw Temperature measurement (raw)
12
} mavlink_raw_pressure_t;
13
 
14
#define MAVLINK_MSG_ID_RAW_PRESSURE_LEN 16
15
#define MAVLINK_MSG_ID_28_LEN 16
16
 
17
 
18
 
19
#define MAVLINK_MESSAGE_INFO_RAW_PRESSURE { \
20
        "RAW_PRESSURE", \
21
        5, \
22
        {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_raw_pressure_t, time_usec) }, \
23
         { "press_abs", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_raw_pressure_t, press_abs) }, \
24
         { "press_diff1", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_raw_pressure_t, press_diff1) }, \
25
         { "press_diff2", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_raw_pressure_t, press_diff2) }, \
26
         { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_raw_pressure_t, temperature) }, \
27
         } \
28
}
29
 
30
 
31
/**
32
 * @brief Pack a raw_pressure message
33
 * @param system_id ID of this system
34
 * @param component_id ID of this component (e.g. 200 for IMU)
35
 * @param msg The MAVLink message to compress the data into
36
 *
37
 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
38
 * @param press_abs Absolute pressure (raw)
39
 * @param press_diff1 Differential pressure 1 (raw)
40
 * @param press_diff2 Differential pressure 2 (raw)
41
 * @param temperature Raw Temperature measurement (raw)
42
 * @return length of the message in bytes (excluding serial stream start sign)
43
 */
44
static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45
                                                       uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
46
{
47
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48
        char buf[16];
49
        _mav_put_uint64_t(buf, 0, time_usec);
50
        _mav_put_int16_t(buf, 8, press_abs);
51
        _mav_put_int16_t(buf, 10, press_diff1);
52
        _mav_put_int16_t(buf, 12, press_diff2);
53
        _mav_put_int16_t(buf, 14, temperature);
54
 
55
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 16);
56
#else
57
        mavlink_raw_pressure_t packet;
58
        packet.time_usec = time_usec;
59
        packet.press_abs = press_abs;
60
        packet.press_diff1 = press_diff1;
61
        packet.press_diff2 = press_diff2;
62
        packet.temperature = temperature;
63
 
64
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 16);
65
#endif
66
 
67
        msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
68
        return mavlink_finalize_message(msg, system_id, component_id, 16, 67);
69
}
70
 
71
/**
72
 * @brief Pack a raw_pressure message on a channel
73
 * @param system_id ID of this system
74
 * @param component_id ID of this component (e.g. 200 for IMU)
75
 * @param chan The MAVLink channel this message was sent over
76
 * @param msg The MAVLink message to compress the data into
77
 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
78
 * @param press_abs Absolute pressure (raw)
79
 * @param press_diff1 Differential pressure 1 (raw)
80
 * @param press_diff2 Differential pressure 2 (raw)
81
 * @param temperature Raw Temperature measurement (raw)
82
 * @return length of the message in bytes (excluding serial stream start sign)
83
 */
84
static inline uint16_t mavlink_msg_raw_pressure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
85
                                                           mavlink_message_t* msg,
86
                                                           uint64_t time_usec,int16_t press_abs,int16_t press_diff1,int16_t press_diff2,int16_t temperature)
87
{
88
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89
        char buf[16];
90
        _mav_put_uint64_t(buf, 0, time_usec);
91
        _mav_put_int16_t(buf, 8, press_abs);
92
        _mav_put_int16_t(buf, 10, press_diff1);
93
        _mav_put_int16_t(buf, 12, press_diff2);
94
        _mav_put_int16_t(buf, 14, temperature);
95
 
96
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 16);
97
#else
98
        mavlink_raw_pressure_t packet;
99
        packet.time_usec = time_usec;
100
        packet.press_abs = press_abs;
101
        packet.press_diff1 = press_diff1;
102
        packet.press_diff2 = press_diff2;
103
        packet.temperature = temperature;
104
 
105
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 16);
106
#endif
107
 
108
        msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
109
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 16, 67);
110
}
111
 
112
/**
113
 * @brief Encode a raw_pressure struct into a message
114
 *
115
 * @param system_id ID of this system
116
 * @param component_id ID of this component (e.g. 200 for IMU)
117
 * @param msg The MAVLink message to compress the data into
118
 * @param raw_pressure C-struct to read the message contents from
119
 */
120
static inline uint16_t mavlink_msg_raw_pressure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_raw_pressure_t* raw_pressure)
121
{
122
        return mavlink_msg_raw_pressure_pack(system_id, component_id, msg, raw_pressure->time_usec, raw_pressure->press_abs, raw_pressure->press_diff1, raw_pressure->press_diff2, raw_pressure->temperature);
123
}
124
 
125
/**
126
 * @brief Send a raw_pressure message
127
 * @param chan MAVLink channel to send the message
128
 *
129
 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
130
 * @param press_abs Absolute pressure (raw)
131
 * @param press_diff1 Differential pressure 1 (raw)
132
 * @param press_diff2 Differential pressure 2 (raw)
133
 * @param temperature Raw Temperature measurement (raw)
134
 */
135
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
136
 
137
static inline void mavlink_msg_raw_pressure_send(mavlink_channel_t chan, uint64_t time_usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
138
{
139
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
140
        char buf[16];
141
        _mav_put_uint64_t(buf, 0, time_usec);
142
        _mav_put_int16_t(buf, 8, press_abs);
143
        _mav_put_int16_t(buf, 10, press_diff1);
144
        _mav_put_int16_t(buf, 12, press_diff2);
145
        _mav_put_int16_t(buf, 14, temperature);
146
 
147
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, buf, 16, 67);
148
#else
149
        mavlink_raw_pressure_t packet;
150
        packet.time_usec = time_usec;
151
        packet.press_abs = press_abs;
152
        packet.press_diff1 = press_diff1;
153
        packet.press_diff2 = press_diff2;
154
        packet.temperature = temperature;
155
 
156
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_PRESSURE, (const char *)&packet, 16, 67);
157
#endif
158
}
159
 
160
#endif
161
 
162
// MESSAGE RAW_PRESSURE UNPACKING
163
 
164
 
165
/**
166
 * @brief Get field time_usec from raw_pressure message
167
 *
168
 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
169
 */
170
static inline uint64_t mavlink_msg_raw_pressure_get_time_usec(const mavlink_message_t* msg)
171
{
172
        return _MAV_RETURN_uint64_t(msg,  0);
173
}
174
 
175
/**
176
 * @brief Get field press_abs from raw_pressure message
177
 *
178
 * @return Absolute pressure (raw)
179
 */
180
static inline int16_t mavlink_msg_raw_pressure_get_press_abs(const mavlink_message_t* msg)
181
{
182
        return _MAV_RETURN_int16_t(msg,  8);
183
}
184
 
185
/**
186
 * @brief Get field press_diff1 from raw_pressure message
187
 *
188
 * @return Differential pressure 1 (raw)
189
 */
190
static inline int16_t mavlink_msg_raw_pressure_get_press_diff1(const mavlink_message_t* msg)
191
{
192
        return _MAV_RETURN_int16_t(msg,  10);
193
}
194
 
195
/**
196
 * @brief Get field press_diff2 from raw_pressure message
197
 *
198
 * @return Differential pressure 2 (raw)
199
 */
200
static inline int16_t mavlink_msg_raw_pressure_get_press_diff2(const mavlink_message_t* msg)
201
{
202
        return _MAV_RETURN_int16_t(msg,  12);
203
}
204
 
205
/**
206
 * @brief Get field temperature from raw_pressure message
207
 *
208
 * @return Raw Temperature measurement (raw)
209
 */
210
static inline int16_t mavlink_msg_raw_pressure_get_temperature(const mavlink_message_t* msg)
211
{
212
        return _MAV_RETURN_int16_t(msg,  14);
213
}
214
 
215
/**
216
 * @brief Decode a raw_pressure message into a struct
217
 *
218
 * @param msg The message to decode
219
 * @param raw_pressure C-struct to decode the message contents into
220
 */
221
static inline void mavlink_msg_raw_pressure_decode(const mavlink_message_t* msg, mavlink_raw_pressure_t* raw_pressure)
222
{
223
#if MAVLINK_NEED_BYTE_SWAP
224
        raw_pressure->time_usec = mavlink_msg_raw_pressure_get_time_usec(msg);
225
        raw_pressure->press_abs = mavlink_msg_raw_pressure_get_press_abs(msg);
226
        raw_pressure->press_diff1 = mavlink_msg_raw_pressure_get_press_diff1(msg);
227
        raw_pressure->press_diff2 = mavlink_msg_raw_pressure_get_press_diff2(msg);
228
        raw_pressure->temperature = mavlink_msg_raw_pressure_get_temperature(msg);
229
#else
230
        memcpy(raw_pressure, _MAV_PAYLOAD(msg), 16);
231
#endif
232
}