Skip to content

File baton_protocol.c

FileList > src > baton_protocol.c

Go to the source code of this file

  • #include <string.h>
  • #include "baton_protocol.h"

Public Static Functions

Type Name
int parse_crc_low (struct baton_parser * parser, uint8_t byte)
Last CRC byte: the frame is complete, valid or not.
int parse_header (struct baton_parser * parser, uint8_t byte)
Store one of DST, SRC, CTRL, LEN; reject an invalid LEN as soon as it is read.
int parse_payload (struct baton_parser * parser, uint8_t byte)
Store one payload byte; the bound check also catches a corrupted parser structure.

Macros

Type Name
define BATON_CRC_POLY 0x1021U
CRC-16/CCITT-FALSE polynomial.
define PARSE_CRC_HIGH 3U
define PARSE_CRC_LOW 4U
define PARSE_HEADER 1U
define PARSE_HEADER_BYTES 4U
Header bytes after SYNC: DST, SRC, CTRL, LEN.
define PARSE_PAYLOAD 2U
define PARSE_SYNC [**BATON\_PARSER\_IDLE**](group__baton__protocol.md#define-baton_parser_idle)
Parser states.

Public Static Functions Documentation

function parse_crc_low

Last CRC byte: the frame is complete, valid or not.

static int parse_crc_low (
    struct baton_parser * parser,
    uint8_t byte
) 


function parse_header

Store one of DST, SRC, CTRL, LEN; reject an invalid LEN as soon as it is read.

static int parse_header (
    struct baton_parser * parser,
    uint8_t byte
) 


function parse_payload

Store one payload byte; the bound check also catches a corrupted parser structure.

static int parse_payload (
    struct baton_parser * parser,
    uint8_t byte
) 


Macro Definition Documentation

define BATON_CRC_POLY

CRC-16/CCITT-FALSE polynomial.

#define BATON_CRC_POLY `0x1021U`


define PARSE_CRC_HIGH

#define PARSE_CRC_HIGH `3U`

define PARSE_CRC_LOW

#define PARSE_CRC_LOW `4U`

define PARSE_HEADER

#define PARSE_HEADER `1U`

define PARSE_HEADER_BYTES

Header bytes after SYNC: DST, SRC, CTRL, LEN.

#define PARSE_HEADER_BYTES `4U`


define PARSE_PAYLOAD

#define PARSE_PAYLOAD `2U`

define PARSE_SYNC

Parser states.

#define PARSE_SYNC `BATON_PARSER_IDLE`



The documentation for this class was generated from the following file src/baton_protocol.c