|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
28 #ifndef MAVLINK_DECODER_H
29 #define MAVLINK_DECODER_H
32 #include "pprzlink/pprzlink_transport.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
184 if (t->
trans.msg_received) {
188 t->
trans.payload_len =
c +
203 #if MAVLINK_DECODER_DEBUG
204 mavlink_send_debug(t);
206 #ifndef MAVLINK_NO_CRC_EXTRA
219 t->
trans.msg_received =
true;
237 for (el = t->
req; el; el = el->
next) {
245 for (i = 0; i < t->
trans.payload_len; i++) {
256 if (
dev->char_available(
dev->periph)) {
257 while (
dev->char_available(
dev->periph) && !trans->
trans.msg_received) {
260 if (trans->
trans.msg_received) {
262 trans->
trans.msg_received =
false;
268 #define MavlinkDatalinkEvent() mavlink_check_and_parse(&(MAVLINK_UART).device, &mavlink_tp)
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
#define MAVLINK_PAYLOAD_OFFSET
mavlink_parse_state status
#define MAVLINK_MSG_ID_IDX
struct mavlink_transport mavlink_tp
Structure to submit a callback.
mavlink_parse_state
Receiving mavlink messages.
static void mavlink_crc_accumulate(uint8_t data, uint16_t *crcAccum)
Accumulate the X.25 CRC by adding one char at a time.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static void mavlink_check_and_parse(struct link_device *dev, struct mavlink_transport *trans)
@ MAVLINK_PARSE_STATE_GOT_CRC1
@ MAVLINK_PARSE_STATE_UNINIT
static const struct usb_device_descriptor dev
Mavlink transport protocol.
struct mavlink_msg_req * next
@ MAVLINK_PARSE_STATE_GOT_LENGTH
@ MAVLINK_PARSE_STATE_GOT_PAYLOAD
uint8_t mavlink_crc_extra[256]
static uint16_t mavlink_crc_calculate(const uint8_t *pBuffer, uint16_t length)
Calculates the X.25 checksum on a byte buffer.
void(* callback)(struct mavlink_message *msg)
Callback function.
#define MAVLINK_SYS_ID_IDX
struct mavlink_message msg
Mavlink message.
@ MAVLINK_PARSE_STATE_IDLE
uint8_t msg_id
Requested message ID.
struct transport_rx trans
static void mavlink_crc_init(uint16_t *crcAccum)
Initiliaze the buffer for the X.25 CRC.
Mavlink v1.0 message structure.
static void mavlink_register_msg(struct mavlink_transport *t, struct mavlink_msg_req *req)
Register a callback for a mavlink message.
static void mavlink_parse_payload(struct mavlink_transport *t)
#define X25_INIT_CRC
MAVLINK CHECKSUM.
#define MAVLINK_COMP_ID_IDX
static void parse_mavlink(struct mavlink_transport *t, uint8_t c)
Mavlink character parser.
struct mavlink_msg_req * req
@ MAVLINK_PARSE_STATE_GOT_STX