28 #ifndef MAVLINK_DECODER_H
29 #define MAVLINK_DECODER_H
56 #define MAVLINK_PAYLOAD_OFFSET 4
58 #define MAVLINK_SEQ_IDX 0
59 #define MAVLINK_SYS_ID_IDX 1
60 #define MAVLINK_COMP_ID_IDX 2
61 #define MAVLINK_MSG_ID_IDX 3
64 #define X25_INIT_CRC 0xffff
66 #ifndef MAVLINK_NO_CRC_EXTRA
85 tmp = data ^ (
uint8_t)(*crcAccum & 0xff);
87 *crcAccum = (*crcAccum >> 8) ^ (tmp << 8) ^ (tmp << 3) ^ (tmp >> 4);
153 #if MAVLINK_DECODER_DEBUG
203 #if MAVLINK_DECODER_DEBUG
204 mavlink_send_debug(t);
206 #ifndef MAVLINK_NO_CRC_EXTRA
237 for (el = t->
req; el; el = el->
next) {
268 #define MavlinkDatalinkEvent() mavlink_check_and_parse(&(MAVLINK_UART).device, &mavlink_tp)
struct mavlink_msg_req * next
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
volatile bool_t msg_received
message received flag
static void mavlink_crc_init(uint16_t *crcAccum)
Initiliaze the buffer for the X.25 CRC.
Generic reception transport header.
Mavlink v1.0 message structure.
uint8_t payload[TRANSPORT_PAYLOAD_LEN]
payload buffer
static void parse_mavlink(struct mavlink_transport *t, uint8_t c)
Mavlink character parser.
mavlink_parse_state
Receiving mavlink messages.
static void mavlink_parse_payload(struct mavlink_transport *t)
volatile uint8_t payload_len
payload buffer length
uint8_t mavlink_crc_extra[256]
#define MAVLINK_PAYLOAD_OFFSET
void * periph
pointer to parent implementation
#define MAVLINK_COMP_ID_IDX
static void mavlink_register_msg(struct mavlink_transport *t, struct mavlink_msg_req *req)
Register a callback for a mavlink message.
struct mavlink_transport mavlink_tp
struct mavlink_msg_req * req
struct mavlink_message msg
Mavlink message.
void(* callback)(struct mavlink_message *msg)
Callback function.
#define MAVLINK_MSG_ID_IDX
mavlink_parse_state status
get_byte_t get_byte
get a new char
struct transport_rx trans
static const struct usb_device_descriptor dev
#define X25_INIT_CRC
MAVLINK CHECKSUM.
static uint16_t mavlink_crc_calculate(const uint8_t *pBuffer, uint16_t length)
Calculates the X.25 checksum on a byte buffer.
Structure to submit a callback.
static void mavlink_crc_accumulate(uint8_t data, uint16_t *crcAccum)
Accumulate the X.25 CRC by adding one char at a time.
#define MAVLINK_SYS_ID_IDX
uint8_t msg_id
Requested message ID.
struct mavlink_msg_req req
static void mavlink_check_and_parse(struct link_device *dev, struct mavlink_transport *trans)
char_available_t char_available
check if a new character is available
Mavlink transport protocol.
uint8_t error
overrun and error flags