dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msp.c File Reference
#include "msp.h"

Go to the source code of this file.

Data Structures

struct  msp_parser
 

Macros

#define MSP_OVERHEAD_BYTES
 
#define MSP_PARSER_MAGIC   0x32aedc07
 

Enumerations

enum  msp_state {
  MSP_STATE_IDLE, MSP_STATE_PREAMBLE, MSP_STATE_DIRECTION, MSP_STATE_SIZE,
  MSP_STATE_COMMAND, MSP_STATE_DATA, MSP_STATE_CHECKSUM, MSP_STATE_DISCARD
}
 

Functions

static bool parser_validate (struct msp_parser *p)
 
static bool call_handler (struct msp_parser *p, enum msp_message_id id, void *buf, uint8_t len)
 
static enum msp_state msp_parse_idle (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_preamble (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_direction (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_size (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_command (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_data (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_checksum (struct msp_parser *p, uint8_t b)
 
static enum msp_state msp_parse_discard (struct msp_parser *p, uint8_t b)
 
static void process_byte (struct msp_parser *p, uint8_t b)
 
struct msp_parsermsp_parser_init (enum msp_parser_type type)
 Initialize a new parser instance. More...
 
int32_t msp_process_buffer (struct msp_parser *parser, void *buf, uint8_t len)
 Process MSP stream from buffer. More...
 
int32_t msp_process_com (struct msp_parser *parser, struct pios_com_dev *com)
 Process MSP stream from PIOS_COM. More...
 
int32_t msp_send_com (struct msp_parser *parser, struct pios_com_dev *com, enum msp_message_id msg_id, void *payload, uint8_t len)
 Construct and send an MSP message via PIOS_COM. More...
 
int32_t msp_register_handler (struct msp_parser *parser, msp_handler_t handler, void *context)
 Register a handler for valid received messages. More...
 

Detailed Description

Author
dRonin, http://dRonin.org/, Copyright (C) 2016

Definition in file msp.c.