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

Base class of the CRC8 calculator. More...

#include <crc.hpp>

Inheritance diagram for m5::utility::CRC8:
m5::utility::CRC8_Checksum

Public Member Functions

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

Static Public Member Functions

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

Static Protected Member Functions

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

Detailed Description

Base class of the CRC8 calculator.

Constructor & Destructor Documentation

◆ CRC8()

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

Member Function Documentation

◆ calculate()

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

Calculate CRC8.

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()

uint8_t m5::utility::CRC8::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()

uint8_t m5::utility::CRC8::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()

uint8_t m5::utility::CRC8::value ( ) const
inline

CRC value at the time of the call.

Returns
CRC value