AceCRC  1.1.0
Cyclic Redundancy Check (CRC) algorithms (e.g. crc16ccitt, crc32) programmatically converted from C99 code generated by pycrc (https://pycrc.org) to Arduino C++ using namespaces and PROGMEM flash memory.
Typedefs | Functions | Variables
crc16modbus_bit.hpp File Reference

Functions and types for CRC checks. More...

#include <stdlib.h>
#include <stdint.h>
Include dependency graph for crc16modbus_bit.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint16_t ace_crc::crc16modbus_bit::crc_t
 The type of the CRC values. More...
 

Functions

crc_t ace_crc::crc16modbus_bit::crc_reflect (crc_t data, size_t data_len)
 Reflect all bits of a data word of data_len bytes. More...
 
crc_t ace_crc::crc16modbus_bit::crc_init (void)
 Calculate the initial crc value. More...
 
crc_t ace_crc::crc16modbus_bit::crc_update (crc_t crc, const void *data, size_t data_len)
 Update the crc value with new data. More...
 
crc_t ace_crc::crc16modbus_bit::crc_finalize (crc_t crc)
 Calculate the final crc value. More...
 
crc_t ace_crc::crc16modbus_bit::crc_calculate (const void *data, size_t data_len)
 Calculate the crc in one-shot. More...
 

Variables

const uint8_t ace_crc::crc16modbus_bit::CRC_ALGO_BIT_BY_BIT_FAST = 1
 The definition of the used algorithm. More...
 

Detailed Description

Functions and types for CRC checks.

Generated on Fri Feb 3 16:16:46 2023 by pycrc v0.10.0, https://pycrc.org using the configuration:

This file defines the functions crc_init(), crc_update() and crc_finalize().

The crc_init() function returns the initial crc value and must be called before the first call to crc_update(). Similarly, the crc_finalize() function must be called after the last call to crc_update(), before the crc is being used. is being used.

The crc_update() function can be called any number of times (including zero times) in between the crc_init() and crc_finalize() calls.

This pseudo-code shows an example usage of the API:

crc_t crc;
unsigned char data[MAX_DATA_LEN];
size_t data_len;
crc = crc_init();
while ((data_len = read_data(data, MAX_DATA_LEN)) > 0) {
crc = crc_update(crc, data, data_len);
}
crc = crc_finalize(crc);
crc_t crc_update(crc_t crc, const void *data, size_t data_len)
Update the crc value with new data.
crc_t crc_finalize(crc_t crc)
Calculate the final crc value.
uint16_t crc_t
The type of the CRC values.
crc_t crc_init(void)
Calculate the initial crc value.

Auto converted to Arduino C++ on Fri Feb 3 16:16:46 PST 2023 by AceCRC (https://github.com/bxparks/AceCRC). DO NOT EDIT

Definition in file crc16modbus_bit.hpp.

Typedef Documentation

◆ crc_t

The type of the CRC values.

This type must be big enough to contain at least 16 bits.

Definition at line 68 of file crc16modbus_bit.hpp.

Function Documentation

◆ crc_calculate()

crc_t ace_crc::crc16modbus_bit::crc_calculate ( const void *  data,
size_t  data_len 
)
inline

Calculate the crc in one-shot.

This is a convenience function added by AceCRC.

Parameters
[in]dataPointer to a buffer of data_len bytes.
[in]data_lenNumber of bytes in the data buffer.

Definition at line 122 of file crc16modbus_bit.hpp.

◆ crc_finalize()

crc_t ace_crc::crc16modbus_bit::crc_finalize ( crc_t  crc)
inline

Calculate the final crc value.

Parameters
[in]crcThe current crc value.
Returns
The final crc value.

Definition at line 109 of file crc16modbus_bit.hpp.

◆ crc_init()

crc_t ace_crc::crc16modbus_bit::crc_init ( void  )
inline

Calculate the initial crc value.

Returns
The initial crc value.

Definition at line 86 of file crc16modbus_bit.hpp.

◆ crc_reflect()

crc_t ace_crc::crc16modbus_bit::crc_reflect ( crc_t  data,
size_t  data_len 
)

Reflect all bits of a data word of data_len bytes.

Parameters
[in]dataThe data word to be reflected.
[in]data_lenThe width of data expressed in number of bits.
Returns
The reflected data.

Definition at line 30 of file crc16modbus_bit.cpp.

◆ crc_update()

crc_t ace_crc::crc16modbus_bit::crc_update ( crc_t  crc,
const void *  data,
size_t  data_len 
)

Update the crc value with new data.

Parameters
[in]crcThe current crc value.
[in]dataPointer to a buffer of data_len bytes.
[in]data_lenNumber of bytes in the data buffer.
Returns
The updated crc value.

Definition at line 44 of file crc16modbus_bit.cpp.

Variable Documentation

◆ CRC_ALGO_BIT_BY_BIT_FAST

const uint8_t ace_crc::crc16modbus_bit::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 60 of file crc16modbus_bit.hpp.