Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1702 | - | 1 | // MESSAGE AP_ADC PACKING |
| 2 | |||
| 3 | #define MAVLINK_MSG_ID_AP_ADC 153 |
||
| 4 | |||
| 5 | typedef struct __mavlink_ap_adc_t |
||
| 6 | { |
||
| 7 | uint16_t adc1; ///< ADC output 1 |
||
| 8 | uint16_t adc2; ///< ADC output 2 |
||
| 9 | uint16_t adc3; ///< ADC output 3 |
||
| 10 | uint16_t adc4; ///< ADC output 4 |
||
| 11 | uint16_t adc5; ///< ADC output 5 |
||
| 12 | uint16_t adc6; ///< ADC output 6 |
||
| 13 | } mavlink_ap_adc_t; |
||
| 14 | |||
| 15 | #define MAVLINK_MSG_ID_AP_ADC_LEN 12 |
||
| 16 | #define MAVLINK_MSG_ID_153_LEN 12 |
||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | #define MAVLINK_MESSAGE_INFO_AP_ADC { \ |
||
| 21 | "AP_ADC", \ |
||
| 22 | 6, \ |
||
| 23 | { { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \ |
||
| 24 | { "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \ |
||
| 25 | { "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \ |
||
| 26 | { "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \ |
||
| 27 | { "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \ |
||
| 28 | { "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \ |
||
| 29 | } \ |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | /** |
||
| 34 | * @brief Pack a ap_adc message |
||
| 35 | * @param system_id ID of this system |
||
| 36 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
| 37 | * @param msg The MAVLink message to compress the data into |
||
| 38 | * |
||
| 39 | * @param adc1 ADC output 1 |
||
| 40 | * @param adc2 ADC output 2 |
||
| 41 | * @param adc3 ADC output 3 |
||
| 42 | * @param adc4 ADC output 4 |
||
| 43 | * @param adc5 ADC output 5 |
||
| 44 | * @param adc6 ADC output 6 |
||
| 45 | * @return length of the message in bytes (excluding serial stream start sign) |
||
| 46 | */ |
||
| 47 | static inline uint16_t mavlink_msg_ap_adc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
| 48 | uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6) |
||
| 49 | { |
||
| 50 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
| 51 | char buf[12]; |
||
| 52 | _mav_put_uint16_t(buf, 0, adc1); |
||
| 53 | _mav_put_uint16_t(buf, 2, adc2); |
||
| 54 | _mav_put_uint16_t(buf, 4, adc3); |
||
| 55 | _mav_put_uint16_t(buf, 6, adc4); |
||
| 56 | _mav_put_uint16_t(buf, 8, adc5); |
||
| 57 | _mav_put_uint16_t(buf, 10, adc6); |
||
| 58 | |||
| 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12); |
||
| 60 | #else |
||
| 61 | mavlink_ap_adc_t packet; |
||
| 62 | packet.adc1 = adc1; |
||
| 63 | packet.adc2 = adc2; |
||
| 64 | packet.adc3 = adc3; |
||
| 65 | packet.adc4 = adc4; |
||
| 66 | packet.adc5 = adc5; |
||
| 67 | packet.adc6 = adc6; |
||
| 68 | |||
| 69 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12); |
||
| 70 | #endif |
||
| 71 | |||
| 72 | msg->msgid = MAVLINK_MSG_ID_AP_ADC; |
||
| 73 | return mavlink_finalize_message(msg, system_id, component_id, 12, 188); |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @brief Pack a ap_adc message on a channel |
||
| 78 | * @param system_id ID of this system |
||
| 79 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
| 80 | * @param chan The MAVLink channel this message was sent over |
||
| 81 | * @param msg The MAVLink message to compress the data into |
||
| 82 | * @param adc1 ADC output 1 |
||
| 83 | * @param adc2 ADC output 2 |
||
| 84 | * @param adc3 ADC output 3 |
||
| 85 | * @param adc4 ADC output 4 |
||
| 86 | * @param adc5 ADC output 5 |
||
| 87 | * @param adc6 ADC output 6 |
||
| 88 | * @return length of the message in bytes (excluding serial stream start sign) |
||
| 89 | */ |
||
| 90 | static inline uint16_t mavlink_msg_ap_adc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
| 91 | mavlink_message_t* msg, |
||
| 92 | uint16_t adc1,uint16_t adc2,uint16_t adc3,uint16_t adc4,uint16_t adc5,uint16_t adc6) |
||
| 93 | { |
||
| 94 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
| 95 | char buf[12]; |
||
| 96 | _mav_put_uint16_t(buf, 0, adc1); |
||
| 97 | _mav_put_uint16_t(buf, 2, adc2); |
||
| 98 | _mav_put_uint16_t(buf, 4, adc3); |
||
| 99 | _mav_put_uint16_t(buf, 6, adc4); |
||
| 100 | _mav_put_uint16_t(buf, 8, adc5); |
||
| 101 | _mav_put_uint16_t(buf, 10, adc6); |
||
| 102 | |||
| 103 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12); |
||
| 104 | #else |
||
| 105 | mavlink_ap_adc_t packet; |
||
| 106 | packet.adc1 = adc1; |
||
| 107 | packet.adc2 = adc2; |
||
| 108 | packet.adc3 = adc3; |
||
| 109 | packet.adc4 = adc4; |
||
| 110 | packet.adc5 = adc5; |
||
| 111 | packet.adc6 = adc6; |
||
| 112 | |||
| 113 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12); |
||
| 114 | #endif |
||
| 115 | |||
| 116 | msg->msgid = MAVLINK_MSG_ID_AP_ADC; |
||
| 117 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12, 188); |
||
| 118 | } |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @brief Encode a ap_adc struct into a message |
||
| 122 | * |
||
| 123 | * @param system_id ID of this system |
||
| 124 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
| 125 | * @param msg The MAVLink message to compress the data into |
||
| 126 | * @param ap_adc C-struct to read the message contents from |
||
| 127 | */ |
||
| 128 | static inline uint16_t mavlink_msg_ap_adc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc) |
||
| 129 | { |
||
| 130 | return mavlink_msg_ap_adc_pack(system_id, component_id, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6); |
||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @brief Send a ap_adc message |
||
| 135 | * @param chan MAVLink channel to send the message |
||
| 136 | * |
||
| 137 | * @param adc1 ADC output 1 |
||
| 138 | * @param adc2 ADC output 2 |
||
| 139 | * @param adc3 ADC output 3 |
||
| 140 | * @param adc4 ADC output 4 |
||
| 141 | * @param adc5 ADC output 5 |
||
| 142 | * @param adc6 ADC output 6 |
||
| 143 | */ |
||
| 144 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
| 145 | |||
| 146 | static inline void mavlink_msg_ap_adc_send(mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6) |
||
| 147 | { |
||
| 148 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
| 149 | char buf[12]; |
||
| 150 | _mav_put_uint16_t(buf, 0, adc1); |
||
| 151 | _mav_put_uint16_t(buf, 2, adc2); |
||
| 152 | _mav_put_uint16_t(buf, 4, adc3); |
||
| 153 | _mav_put_uint16_t(buf, 6, adc4); |
||
| 154 | _mav_put_uint16_t(buf, 8, adc5); |
||
| 155 | _mav_put_uint16_t(buf, 10, adc6); |
||
| 156 | |||
| 157 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, 12, 188); |
||
| 158 | #else |
||
| 159 | mavlink_ap_adc_t packet; |
||
| 160 | packet.adc1 = adc1; |
||
| 161 | packet.adc2 = adc2; |
||
| 162 | packet.adc3 = adc3; |
||
| 163 | packet.adc4 = adc4; |
||
| 164 | packet.adc5 = adc5; |
||
| 165 | packet.adc6 = adc6; |
||
| 166 | |||
| 167 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)&packet, 12, 188); |
||
| 168 | #endif |
||
| 169 | } |
||
| 170 | |||
| 171 | #endif |
||
| 172 | |||
| 173 | // MESSAGE AP_ADC UNPACKING |
||
| 174 | |||
| 175 | |||
| 176 | /** |
||
| 177 | * @brief Get field adc1 from ap_adc message |
||
| 178 | * |
||
| 179 | * @return ADC output 1 |
||
| 180 | */ |
||
| 181 | static inline uint16_t mavlink_msg_ap_adc_get_adc1(const mavlink_message_t* msg) |
||
| 182 | { |
||
| 183 | return _MAV_RETURN_uint16_t(msg, 0); |
||
| 184 | } |
||
| 185 | |||
| 186 | /** |
||
| 187 | * @brief Get field adc2 from ap_adc message |
||
| 188 | * |
||
| 189 | * @return ADC output 2 |
||
| 190 | */ |
||
| 191 | static inline uint16_t mavlink_msg_ap_adc_get_adc2(const mavlink_message_t* msg) |
||
| 192 | { |
||
| 193 | return _MAV_RETURN_uint16_t(msg, 2); |
||
| 194 | } |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @brief Get field adc3 from ap_adc message |
||
| 198 | * |
||
| 199 | * @return ADC output 3 |
||
| 200 | */ |
||
| 201 | static inline uint16_t mavlink_msg_ap_adc_get_adc3(const mavlink_message_t* msg) |
||
| 202 | { |
||
| 203 | return _MAV_RETURN_uint16_t(msg, 4); |
||
| 204 | } |
||
| 205 | |||
| 206 | /** |
||
| 207 | * @brief Get field adc4 from ap_adc message |
||
| 208 | * |
||
| 209 | * @return ADC output 4 |
||
| 210 | */ |
||
| 211 | static inline uint16_t mavlink_msg_ap_adc_get_adc4(const mavlink_message_t* msg) |
||
| 212 | { |
||
| 213 | return _MAV_RETURN_uint16_t(msg, 6); |
||
| 214 | } |
||
| 215 | |||
| 216 | /** |
||
| 217 | * @brief Get field adc5 from ap_adc message |
||
| 218 | * |
||
| 219 | * @return ADC output 5 |
||
| 220 | */ |
||
| 221 | static inline uint16_t mavlink_msg_ap_adc_get_adc5(const mavlink_message_t* msg) |
||
| 222 | { |
||
| 223 | return _MAV_RETURN_uint16_t(msg, 8); |
||
| 224 | } |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @brief Get field adc6 from ap_adc message |
||
| 228 | * |
||
| 229 | * @return ADC output 6 |
||
| 230 | */ |
||
| 231 | static inline uint16_t mavlink_msg_ap_adc_get_adc6(const mavlink_message_t* msg) |
||
| 232 | { |
||
| 233 | return _MAV_RETURN_uint16_t(msg, 10); |
||
| 234 | } |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @brief Decode a ap_adc message into a struct |
||
| 238 | * |
||
| 239 | * @param msg The message to decode |
||
| 240 | * @param ap_adc C-struct to decode the message contents into |
||
| 241 | */ |
||
| 242 | static inline void mavlink_msg_ap_adc_decode(const mavlink_message_t* msg, mavlink_ap_adc_t* ap_adc) |
||
| 243 | { |
||
| 244 | #if MAVLINK_NEED_BYTE_SWAP |
||
| 245 | ap_adc->adc1 = mavlink_msg_ap_adc_get_adc1(msg); |
||
| 246 | ap_adc->adc2 = mavlink_msg_ap_adc_get_adc2(msg); |
||
| 247 | ap_adc->adc3 = mavlink_msg_ap_adc_get_adc3(msg); |
||
| 248 | ap_adc->adc4 = mavlink_msg_ap_adc_get_adc4(msg); |
||
| 249 | ap_adc->adc5 = mavlink_msg_ap_adc_get_adc5(msg); |
||
| 250 | ap_adc->adc6 = mavlink_msg_ap_adc_get_adc6(msg); |
||
| 251 | #else |
||
| 252 | memcpy(ap_adc, _MAV_PAYLOAD(msg), 12); |
||
| 253 | #endif |
||
| 254 | } |