Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
simple decoder of mavlink message More...
Go to the source code of this file.
Data Structures | |
struct | mavlink_msg_req |
Structure to submit a callback. More... | |
struct | mavlink_transport |
Mavlink transport protocol. More... | |
Macros | |
#define | STXMAV 0xFE |
#define | MAVLINK_PAYLOAD_OFFSET 4 |
#define | MAVLINK_SEQ_IDX 0 |
#define | MAVLINK_SYS_ID_IDX 1 |
#define | MAVLINK_COMP_ID_IDX 2 |
#define | MAVLINK_MSG_ID_IDX 3 |
#define | X25_INIT_CRC 0xffff |
MAVLINK CHECKSUM. More... | |
#define | MavlinkDatalinkEvent() mavlink_check_and_parse(&(MAVLINK_UART).device, &mavlink_tp) |
Enumerations | |
enum | mavlink_parse_state { MAVLINK_PARSE_STATE_UNINIT = 0, MAVLINK_PARSE_STATE_IDLE, MAVLINK_PARSE_STATE_GOT_STX, MAVLINK_PARSE_STATE_GOT_LENGTH, MAVLINK_PARSE_STATE_GOT_PAYLOAD, MAVLINK_PARSE_STATE_GOT_CRC1 } |
Receiving mavlink messages. More... | |
Functions | |
static void | mavlink_crc_accumulate (uint8_t data, uint16_t *crcAccum) |
Accumulate the X.25 CRC by adding one char at a time. More... | |
static void | mavlink_crc_init (uint16_t *crcAccum) |
Initiliaze the buffer for the X.25 CRC. More... | |
static uint16_t | mavlink_crc_calculate (const uint8_t *pBuffer, uint16_t length) |
Calculates the X.25 checksum on a byte buffer. More... | |
static void | mavlink_register_msg (struct mavlink_transport *t, struct mavlink_msg_req *req) |
Register a callback for a mavlink message. More... | |
static void | parse_mavlink (struct mavlink_transport *t, uint8_t c) |
Mavlink character parser. More... | |
static void | mavlink_parse_payload (struct mavlink_transport *t) |
static void | mavlink_check_and_parse (struct link_device *dev, struct mavlink_transport *trans) |
Variables | |
uint8_t | mavlink_crc_extra [256] |
struct mavlink_transport | mavlink_tp |
simple decoder of mavlink message
Definition in file mavlink_decoder.h.
struct mavlink_message |
struct mavlink_transport |
Mavlink transport protocol.
Definition at line 140 of file mavlink_decoder.h.
Data Fields | ||
---|---|---|
uint16_t | checksum | |
uint8_t | payload_idx | |
struct mavlink_msg_req * | req | |
mavlink_parse_state | status | |
struct transport_rx | trans |
#define MAVLINK_COMP_ID_IDX 2 |
Definition at line 60 of file mavlink_decoder.h.
Referenced by mavlink_parse_payload().
#define MAVLINK_MSG_ID_IDX 3 |
Definition at line 61 of file mavlink_decoder.h.
Referenced by mavlink_parse_payload(), and parse_mavlink().
#define MAVLINK_PAYLOAD_OFFSET 4 |
Definition at line 56 of file mavlink_decoder.h.
Referenced by mavlink_parse_payload(), and parse_mavlink().
#define MAVLINK_SEQ_IDX 0 |
Definition at line 58 of file mavlink_decoder.h.
Referenced by mavlink_parse_payload().
#define MAVLINK_SYS_ID_IDX 1 |
Definition at line 59 of file mavlink_decoder.h.
Referenced by mavlink_parse_payload().
#define MavlinkDatalinkEvent | ( | ) | mavlink_check_and_parse(&(MAVLINK_UART).device, &mavlink_tp) |
Definition at line 268 of file mavlink_decoder.h.
#define STXMAV 0xFE |
Definition at line 38 of file mavlink_decoder.h.
Referenced by parse_mavlink().
#define X25_INIT_CRC 0xffff |
MAVLINK CHECKSUM.
Definition at line 64 of file mavlink_decoder.h.
Referenced by mavlink_crc_init().
enum mavlink_parse_state |
Receiving mavlink messages.
Enumerator | |
---|---|
MAVLINK_PARSE_STATE_UNINIT | |
MAVLINK_PARSE_STATE_IDLE | |
MAVLINK_PARSE_STATE_GOT_STX | |
MAVLINK_PARSE_STATE_GOT_LENGTH | |
MAVLINK_PARSE_STATE_GOT_PAYLOAD | |
MAVLINK_PARSE_STATE_GOT_CRC1 |
Definition at line 120 of file mavlink_decoder.h.
|
inlinestatic |
Definition at line 254 of file mavlink_decoder.h.
References mavlink_parse_payload(), parse_mavlink(), and mavlink_transport::trans.
Accumulate the X.25 CRC by adding one char at a time.
The checksum function adds the hash of one char at a time to the 16 bit checksum (uint16_t).
data | new char to hash |
crcAccum | the already accumulated checksum |
Definition at line 80 of file mavlink_decoder.h.
Referenced by mavlink_crc_calculate(), and parse_mavlink().
Calculates the X.25 checksum on a byte buffer.
pBuffer | buffer containing the byte array to hash |
length | length of the byte array |
Definition at line 107 of file mavlink_decoder.h.
References mavlink_crc_accumulate(), and mavlink_crc_init().
|
inlinestatic |
Initiliaze the buffer for the X.25 CRC.
crcAccum | the 16 bit X.25 CRC |
Definition at line 95 of file mavlink_decoder.h.
References X25_INIT_CRC.
Referenced by mavlink_crc_calculate(), and parse_mavlink().
|
inlinestatic |
Definition at line 232 of file mavlink_decoder.h.
References mavlink_msg_req::callback, mavlink_message::comp_id, MAVLINK_COMP_ID_IDX, MAVLINK_MSG_ID_IDX, MAVLINK_PAYLOAD_OFFSET, MAVLINK_SEQ_IDX, MAVLINK_SYS_ID_IDX, mavlink_msg_req::msg, mavlink_message::msg_id, mavlink_msg_req::msg_id, mavlink_msg_req::next, mavlink_message::payload, mavlink_transport::req, mavlink_message::seq, mavlink_message::sys_id, and mavlink_transport::trans.
Referenced by mavlink_check_and_parse().
|
inlinestatic |
Register a callback for a mavlink message.
Definition at line 163 of file mavlink_decoder.h.
References mavlink_msg_req::next, and mavlink_transport::req.
Referenced by px4flow_init().
|
inlinestatic |
Mavlink character parser.
Definition at line 172 of file mavlink_decoder.h.
References mavlink_transport::checksum, mavlink_crc_accumulate(), mavlink_crc_extra, mavlink_crc_init(), MAVLINK_MSG_ID_IDX, MAVLINK_PARSE_STATE_GOT_CRC1, MAVLINK_PARSE_STATE_GOT_LENGTH, MAVLINK_PARSE_STATE_GOT_PAYLOAD, MAVLINK_PARSE_STATE_GOT_STX, MAVLINK_PARSE_STATE_IDLE, MAVLINK_PARSE_STATE_UNINIT, MAVLINK_PAYLOAD_OFFSET, mavlink_transport::payload_idx, mavlink_transport::status, STXMAV, and mavlink_transport::trans.
Referenced by mavlink_check_and_parse().
uint8_t mavlink_crc_extra[256] |
Definition at line 32 of file mavlink_decoder.c.
Referenced by parse_mavlink().
struct mavlink_transport mavlink_tp |
Definition at line 29 of file mavlink_decoder.c.
Referenced by px4flow_init().