ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
|
#include <stdint.h>
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | CRC_ALGO_TABLE_DRIVEN 1 |
Typedefs | |
typedef uint_fast16_t | crc_16_dnp_tbl4bit_t |
Functions | |
static crc_16_dnp_tbl4bit_t | crc_16_dnp_tbl4bit_init (void) |
crc_16_dnp_tbl4bit_t | crc_16_dnp_tbl4bit_update (crc_16_dnp_tbl4bit_t crc, const void *data, size_t data_len) |
static crc_16_dnp_tbl4bit_t | crc_16_dnp_tbl4bit_finalize (crc_16_dnp_tbl4bit_t crc) |
Functions and types for CRC checks.
Generated on Mon Aug 24 06:27:49 2020 by pycrc v0.9.2, https://pycrc.org using the configuration:
This file defines the functions crc_16_dnp_tbl4bit_init(), crc_16_dnp_tbl4bit_update() and crc_16_dnp_tbl4bit_finalize().
The crc_16_dnp_tbl4bit_init() function returns the inital crc
value and must be called before the first call to crc_16_dnp_tbl4bit_update(). Similarly, the crc_16_dnp_tbl4bit_finalize() function must be called after the last call to crc_16_dnp_tbl4bit_update(), before the crc
is being used. is being used.
The crc_16_dnp_tbl4bit_update() function can be called any number of times (including zero times) in between the crc_16_dnp_tbl4bit_init() and crc_16_dnp_tbl4bit_finalize() calls.
This pseudo-code shows an example usage of the API:
Definition in file crc_16_dnp_tbl4bit.h.
#define CRC_ALGO_TABLE_DRIVEN 1 |
The definition of the used algorithm.
This is not used anywhere in the generated code, but it may be used by the application code to call algorithm-specific code, if desired.
Definition at line 58 of file crc_16_dnp_tbl4bit.h.
typedef uint_fast16_t crc_16_dnp_tbl4bit_t |
The type of the CRC values.
This type must be big enough to contain at least 16 bits.
Definition at line 65 of file crc_16_dnp_tbl4bit.h.
|
inlinestatic |
Calculate the final crc value.
[in] | crc | The current crc value. |
Definition at line 95 of file crc_16_dnp_tbl4bit.h.
|
inlinestatic |
Calculate the initial crc value.
Definition at line 72 of file crc_16_dnp_tbl4bit.h.
crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_update | ( | crc_16_dnp_tbl4bit_t | crc, |
const void * | data, | ||
size_t | data_len ) |
Update the crc value with new data.
[in] | crc | The current crc value. |
[in] | data | Pointer to a buffer of data_len bytes. |
[in] | data_len | Number of bytes in the data buffer. |
Definition at line 27 of file crc_16_dnp_tbl4bit.c.
References crc_table.