M5Utility 0.0.2 git rev:5c1a751
Loading...
Searching...
No Matches
m5::utility::CRC16 Class Reference

Base class of the CRC16 calculator. More...

#include <crc.hpp>

Public Member Functions

 CRC16 (const uint16_t init, const uint16_t polynomial, const bool refIn, const bool refOut, const uint16_t xorout)
 
uint16_t range (const uint8_t *data, size_t len)
 Calculate the CRC of the specified range.
 
uint16_t update (const uint8_t *data, size_t len)
 Stores the CRC of the specified array using the current internal information.
 
uint16_t value () const
 CRC value at the time of the call.
 

Static Public Member Functions

static uint16_t calculate (const uint8_t *data, size_t len, const uint16_t init, const uint16_t polynomial, const bool refIn, const bool refOut, const uint16_t xorout, bool do_finalize=true)
 Calculate CRC16.
 

Static Protected Member Functions

static uint16_t finalize (const uint16_t value, const bool refOut, const uint16_t xorout)
 

Detailed Description

Base class of the CRC16 calculator.

Constructor & Destructor Documentation

◆ CRC16()

m5::utility::CRC16::CRC16 ( const uint16_t init,
const uint16_t polynomial,
const bool refIn,
const bool refOut,
const uint16_t xorout )
inline
Parameters
initInitial value
polynormalGenerated polynomial
refInInverted input?
refOutInverted output?
xoroutExclusive OR output

Member Function Documentation

◆ calculate()

static uint16_t m5::utility::CRC16::calculate ( const uint8_t * data,
size_t len,
const uint16_t init,
const uint16_t polynomial,
const bool refIn,
const bool refOut,
const uint16_t xorout,
bool do_finalize = true )
inlinestatic

Calculate CRC16.

Parameters
dataPointer of the array
lenLength of the array
polynormalGenerated polynomial
refInInverted input?
refOutInverted output?
xoroutExclusive OR output
do_finalizeApply processing to output values?(true as defaut)
Returns
CRC value

◆ range()

uint16_t m5::utility::CRC16::range ( const uint8_t * data,
size_t len )
inline

Calculate the CRC of the specified range.

Parameters
dataPointer of the array
lenLength of the array
Returns
CRC value

◆ update()

uint16_t m5::utility::CRC16::update ( const uint8_t * data,
size_t len )
inline

Stores the CRC of the specified array using the current internal information.

Parameters
dataPointer of the array
lenLength of the array
Returns
CRC value
Note
Used when you want to calculate the value of the entire divided continuous data, such as streaming data

◆ value()

uint16_t m5::utility::CRC16::value ( ) const
inline

CRC value at the time of the call.

Returns
CRC value