339 lines
12 KiB
C
339 lines
12 KiB
C
|
|
#pragma once
|
||
|
|
// MESSAGE PBIT_RESULT PACKING
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_PBIT_RESULT 20108
|
||
|
|
|
||
|
|
|
||
|
|
typedef struct __mavlink_pbit_result_t {
|
||
|
|
uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/
|
||
|
|
uint32_t CPM1; /*< CPM1*/
|
||
|
|
uint32_t CPM2; /*< CPM2*/
|
||
|
|
uint32_t CPM3; /*< CPM3*/
|
||
|
|
uint32_t BIM1; /*< BIM1*/
|
||
|
|
uint32_t BIM2; /*< BIM2*/
|
||
|
|
} mavlink_pbit_result_t;
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_PBIT_RESULT_LEN 24
|
||
|
|
#define MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN 24
|
||
|
|
#define MAVLINK_MSG_ID_20108_LEN 24
|
||
|
|
#define MAVLINK_MSG_ID_20108_MIN_LEN 24
|
||
|
|
|
||
|
|
#define MAVLINK_MSG_ID_PBIT_RESULT_CRC 18
|
||
|
|
#define MAVLINK_MSG_ID_20108_CRC 18
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#if MAVLINK_COMMAND_24BIT
|
||
|
|
#define MAVLINK_MESSAGE_INFO_PBIT_RESULT { \
|
||
|
|
20108, \
|
||
|
|
"PBIT_RESULT", \
|
||
|
|
6, \
|
||
|
|
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_pbit_result_t, time_boot_ms) }, \
|
||
|
|
{ "CPM1", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_pbit_result_t, CPM1) }, \
|
||
|
|
{ "CPM2", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_pbit_result_t, CPM2) }, \
|
||
|
|
{ "CPM3", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_pbit_result_t, CPM3) }, \
|
||
|
|
{ "BIM1", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_pbit_result_t, BIM1) }, \
|
||
|
|
{ "BIM2", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_pbit_result_t, BIM2) }, \
|
||
|
|
} \
|
||
|
|
}
|
||
|
|
#else
|
||
|
|
#define MAVLINK_MESSAGE_INFO_PBIT_RESULT { \
|
||
|
|
"PBIT_RESULT", \
|
||
|
|
6, \
|
||
|
|
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_pbit_result_t, time_boot_ms) }, \
|
||
|
|
{ "CPM1", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_pbit_result_t, CPM1) }, \
|
||
|
|
{ "CPM2", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_pbit_result_t, CPM2) }, \
|
||
|
|
{ "CPM3", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_pbit_result_t, CPM3) }, \
|
||
|
|
{ "BIM1", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_pbit_result_t, BIM1) }, \
|
||
|
|
{ "BIM2", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_pbit_result_t, BIM2) }, \
|
||
|
|
} \
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Pack a pbit_result message
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
*
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param CPM1 CPM1
|
||
|
|
* @param CPM2 CPM2
|
||
|
|
* @param CPM3 CPM3
|
||
|
|
* @param BIM1 BIM1
|
||
|
|
* @param BIM2 BIM2
|
||
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_pbit_result_pack(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||
|
|
uint32_t time_boot_ms, uint32_t CPM1, uint32_t CPM2, uint32_t CPM3, uint32_t BIM1, uint32_t BIM2)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_PBIT_RESULT_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint32_t(buf, 4, CPM1);
|
||
|
|
_mav_put_uint32_t(buf, 8, CPM2);
|
||
|
|
_mav_put_uint32_t(buf, 12, CPM3);
|
||
|
|
_mav_put_uint32_t(buf, 16, BIM1);
|
||
|
|
_mav_put_uint32_t(buf, 20, BIM2);
|
||
|
|
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PBIT_RESULT_LEN);
|
||
|
|
#else
|
||
|
|
mavlink_pbit_result_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.CPM1 = CPM1;
|
||
|
|
packet.CPM2 = CPM2;
|
||
|
|
packet.CPM3 = CPM3;
|
||
|
|
packet.BIM1 = BIM1;
|
||
|
|
packet.BIM2 = BIM2;
|
||
|
|
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PBIT_RESULT_LEN);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
msg->msgid = MAVLINK_MSG_ID_PBIT_RESULT;
|
||
|
|
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Pack a pbit_result message on a channel
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param chan The MAVLink channel this message will be sent over
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param CPM1 CPM1
|
||
|
|
* @param CPM2 CPM2
|
||
|
|
* @param CPM3 CPM3
|
||
|
|
* @param BIM1 BIM1
|
||
|
|
* @param BIM2 BIM2
|
||
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_pbit_result_pack_chan(uint16_t system_id, uint8_t component_id, uint8_t chan,
|
||
|
|
mavlink_message_t* msg,
|
||
|
|
uint32_t time_boot_ms,uint32_t CPM1,uint32_t CPM2,uint32_t CPM3,uint32_t BIM1,uint32_t BIM2)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_PBIT_RESULT_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint32_t(buf, 4, CPM1);
|
||
|
|
_mav_put_uint32_t(buf, 8, CPM2);
|
||
|
|
_mav_put_uint32_t(buf, 12, CPM3);
|
||
|
|
_mav_put_uint32_t(buf, 16, BIM1);
|
||
|
|
_mav_put_uint32_t(buf, 20, BIM2);
|
||
|
|
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PBIT_RESULT_LEN);
|
||
|
|
#else
|
||
|
|
mavlink_pbit_result_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.CPM1 = CPM1;
|
||
|
|
packet.CPM2 = CPM2;
|
||
|
|
packet.CPM3 = CPM3;
|
||
|
|
packet.BIM1 = BIM1;
|
||
|
|
packet.BIM2 = BIM2;
|
||
|
|
|
||
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PBIT_RESULT_LEN);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
msg->msgid = MAVLINK_MSG_ID_PBIT_RESULT;
|
||
|
|
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Encode a pbit_result struct
|
||
|
|
*
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param pbit_result C-struct to read the message contents from
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_pbit_result_encode(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pbit_result_t* pbit_result)
|
||
|
|
{
|
||
|
|
return mavlink_msg_pbit_result_pack(system_id, component_id, msg, pbit_result->time_boot_ms, pbit_result->CPM1, pbit_result->CPM2, pbit_result->CPM3, pbit_result->BIM1, pbit_result->BIM2);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Encode a pbit_result struct on a channel
|
||
|
|
*
|
||
|
|
* @param system_id ID of this system
|
||
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
||
|
|
* @param chan The MAVLink channel this message will be sent over
|
||
|
|
* @param msg The MAVLink message to compress the data into
|
||
|
|
* @param pbit_result C-struct to read the message contents from
|
||
|
|
*/
|
||
|
|
static inline uint16_t mavlink_msg_pbit_result_encode_chan(uint16_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pbit_result_t* pbit_result)
|
||
|
|
{
|
||
|
|
return mavlink_msg_pbit_result_pack_chan(system_id, component_id, chan, msg, pbit_result->time_boot_ms, pbit_result->CPM1, pbit_result->CPM2, pbit_result->CPM3, pbit_result->BIM1, pbit_result->BIM2);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Send a pbit_result message
|
||
|
|
* @param chan MAVLink channel to send the message
|
||
|
|
*
|
||
|
|
* @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
|
||
|
|
* @param CPM1 CPM1
|
||
|
|
* @param CPM2 CPM2
|
||
|
|
* @param CPM3 CPM3
|
||
|
|
* @param BIM1 BIM1
|
||
|
|
* @param BIM2 BIM2
|
||
|
|
*/
|
||
|
|
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||
|
|
|
||
|
|
static inline void mavlink_msg_pbit_result_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t CPM1, uint32_t CPM2, uint32_t CPM3, uint32_t BIM1, uint32_t BIM2)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char buf[MAVLINK_MSG_ID_PBIT_RESULT_LEN];
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint32_t(buf, 4, CPM1);
|
||
|
|
_mav_put_uint32_t(buf, 8, CPM2);
|
||
|
|
_mav_put_uint32_t(buf, 12, CPM3);
|
||
|
|
_mav_put_uint32_t(buf, 16, BIM1);
|
||
|
|
_mav_put_uint32_t(buf, 20, BIM2);
|
||
|
|
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PBIT_RESULT, buf, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
#else
|
||
|
|
mavlink_pbit_result_t packet;
|
||
|
|
packet.time_boot_ms = time_boot_ms;
|
||
|
|
packet.CPM1 = CPM1;
|
||
|
|
packet.CPM2 = CPM2;
|
||
|
|
packet.CPM3 = CPM3;
|
||
|
|
packet.BIM1 = BIM1;
|
||
|
|
packet.BIM2 = BIM2;
|
||
|
|
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PBIT_RESULT, (const char *)&packet, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Send a pbit_result message
|
||
|
|
* @param chan MAVLink channel to send the message
|
||
|
|
* @param struct The MAVLink struct to serialize
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_pbit_result_send_struct(mavlink_channel_t chan, const mavlink_pbit_result_t* pbit_result)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
mavlink_msg_pbit_result_send(chan, pbit_result->time_boot_ms, pbit_result->CPM1, pbit_result->CPM2, pbit_result->CPM3, pbit_result->BIM1, pbit_result->BIM2);
|
||
|
|
#else
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PBIT_RESULT, (const char *)pbit_result, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
#if MAVLINK_MSG_ID_PBIT_RESULT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
||
|
|
/*
|
||
|
|
This varient of _send() can be used to save stack space by re-using
|
||
|
|
memory from the receive buffer. The caller provides a
|
||
|
|
mavlink_message_t which is the size of a full mavlink message. This
|
||
|
|
is usually the receive buffer for the channel, and allows a reply to an
|
||
|
|
incoming message with minimum stack space usage.
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_pbit_result_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t CPM1, uint32_t CPM2, uint32_t CPM3, uint32_t BIM1, uint32_t BIM2)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
char *buf = (char *)msgbuf;
|
||
|
|
_mav_put_uint32_t(buf, 0, time_boot_ms);
|
||
|
|
_mav_put_uint32_t(buf, 4, CPM1);
|
||
|
|
_mav_put_uint32_t(buf, 8, CPM2);
|
||
|
|
_mav_put_uint32_t(buf, 12, CPM3);
|
||
|
|
_mav_put_uint32_t(buf, 16, BIM1);
|
||
|
|
_mav_put_uint32_t(buf, 20, BIM2);
|
||
|
|
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PBIT_RESULT, buf, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
#else
|
||
|
|
mavlink_pbit_result_t *packet = (mavlink_pbit_result_t *)msgbuf;
|
||
|
|
packet->time_boot_ms = time_boot_ms;
|
||
|
|
packet->CPM1 = CPM1;
|
||
|
|
packet->CPM2 = CPM2;
|
||
|
|
packet->CPM3 = CPM3;
|
||
|
|
packet->BIM1 = BIM1;
|
||
|
|
packet->BIM2 = BIM2;
|
||
|
|
|
||
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PBIT_RESULT, (const char *)packet, MAVLINK_MSG_ID_PBIT_RESULT_MIN_LEN, MAVLINK_MSG_ID_PBIT_RESULT_LEN, MAVLINK_MSG_ID_PBIT_RESULT_CRC);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
// MESSAGE PBIT_RESULT UNPACKING
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field time_boot_ms from pbit_result message
|
||
|
|
*
|
||
|
|
* @return [ms] Timestamp (milliseconds since system boot)
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_time_boot_ms(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field CPM1 from pbit_result message
|
||
|
|
*
|
||
|
|
* @return CPM1
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_CPM1(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 4);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field CPM2 from pbit_result message
|
||
|
|
*
|
||
|
|
* @return CPM2
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_CPM2(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 8);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field CPM3 from pbit_result message
|
||
|
|
*
|
||
|
|
* @return CPM3
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_CPM3(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 12);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field BIM1 from pbit_result message
|
||
|
|
*
|
||
|
|
* @return BIM1
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_BIM1(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 16);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Get field BIM2 from pbit_result message
|
||
|
|
*
|
||
|
|
* @return BIM2
|
||
|
|
*/
|
||
|
|
static inline uint32_t mavlink_msg_pbit_result_get_BIM2(const mavlink_message_t* msg)
|
||
|
|
{
|
||
|
|
return _MAV_RETURN_uint32_t(msg, 20);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Decode a pbit_result message into a struct
|
||
|
|
*
|
||
|
|
* @param msg The message to decode
|
||
|
|
* @param pbit_result C-struct to decode the message contents into
|
||
|
|
*/
|
||
|
|
static inline void mavlink_msg_pbit_result_decode(const mavlink_message_t* msg, mavlink_pbit_result_t* pbit_result)
|
||
|
|
{
|
||
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||
|
|
pbit_result->time_boot_ms = mavlink_msg_pbit_result_get_time_boot_ms(msg);
|
||
|
|
pbit_result->CPM1 = mavlink_msg_pbit_result_get_CPM1(msg);
|
||
|
|
pbit_result->CPM2 = mavlink_msg_pbit_result_get_CPM2(msg);
|
||
|
|
pbit_result->CPM3 = mavlink_msg_pbit_result_get_CPM3(msg);
|
||
|
|
pbit_result->BIM1 = mavlink_msg_pbit_result_get_BIM1(msg);
|
||
|
|
pbit_result->BIM2 = mavlink_msg_pbit_result_get_BIM2(msg);
|
||
|
|
#else
|
||
|
|
uint8_t len = msg->len < MAVLINK_MSG_ID_PBIT_RESULT_LEN? msg->len : MAVLINK_MSG_ID_PBIT_RESULT_LEN;
|
||
|
|
memset(pbit_result, 0, MAVLINK_MSG_ID_PBIT_RESULT_LEN);
|
||
|
|
memcpy(pbit_result, _MAV_PAYLOAD(msg), len);
|
||
|
|
#endif
|
||
|
|
}
|