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_BIT_BY_BIT_FAST 1 |
Typedefs | |
typedef uint_fast16_t | crc_16_dnp_bbf_t |
Functions | |
crc_16_dnp_bbf_t | crc_16_dnp_bbf_reflect (crc_16_dnp_bbf_t data, size_t data_len) |
static crc_16_dnp_bbf_t | crc_16_dnp_bbf_init (void) |
crc_16_dnp_bbf_t | crc_16_dnp_bbf_update (crc_16_dnp_bbf_t crc, const void *data, size_t data_len) |
static crc_16_dnp_bbf_t | crc_16_dnp_bbf_finalize (crc_16_dnp_bbf_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_bbf_init(), crc_16_dnp_bbf_update() and crc_16_dnp_bbf_finalize().
The crc_16_dnp_bbf_init() function returns the inital crc
value and must be called before the first call to crc_16_dnp_bbf_update(). Similarly, the crc_16_dnp_bbf_finalize() function must be called after the last call to crc_16_dnp_bbf_update(), before the crc
is being used. is being used.
The crc_16_dnp_bbf_update() function can be called any number of times (including zero times) in between the crc_16_dnp_bbf_init() and crc_16_dnp_bbf_finalize() calls.
This pseudo-code shows an example usage of the API:
Definition in file crc_16_dnp_bbf.h.
#define CRC_ALGO_BIT_BY_BIT_FAST 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 57 of file crc_16_dnp_bbf.h.
typedef uint_fast16_t crc_16_dnp_bbf_t |
The type of the CRC values.
This type must be big enough to contain at least 16 bits.
Definition at line 64 of file crc_16_dnp_bbf.h.
|
inlinestatic |
Calculate the final crc value.
[in] | crc | The current crc value. |
Definition at line 99 of file crc_16_dnp_bbf.h.
References crc_16_dnp_bbf_reflect().
|
inlinestatic |
Calculate the initial crc value.
Definition at line 80 of file crc_16_dnp_bbf.h.
crc_16_dnp_bbf_t crc_16_dnp_bbf_reflect | ( | crc_16_dnp_bbf_t | data, |
size_t | data_len ) |
Reflect all bits of a data word of data_len bytes.
[in] | data | The data word to be reflected. |
[in] | data_len | The width of data expressed in number of bits. |
Definition at line 21 of file crc_16_dnp_bbf.c.
Referenced by crc_16_dnp_bbf_finalize().
crc_16_dnp_bbf_t crc_16_dnp_bbf_update | ( | crc_16_dnp_bbf_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 34 of file crc_16_dnp_bbf.c.