Open FFBoard
Open source force feedback firmware
CRC.h File Reference

Go to the source code of this file.

Functions

template<typename T >
reverseBits (T value)
 
template<typename T , size_t LEN>
void makeCrcTable (std::array< T, LEN > &table, const T crcpoly, const uint8_t bits, const bool refin=false, const bool refout=false)
 
uint8_t calculateCrc8 (std::array< uint8_t, 256 > &crctable, uint8_t *buf, uint16_t len, uint8_t crc=0)
 
uint16_t calculateCrc16_8 (std::array< uint16_t, 256 > &crctable, uint8_t *buf, uint16_t len, uint16_t crc=0)
 
uint16_t calculateCrc16_8_rev (std::array< uint16_t, 256 > &crctable, uint8_t *buf, uint16_t len, uint16_t crc=0)
 

Function Documentation

◆ calculateCrc16_8()

uint16_t calculateCrc16_8 ( std::array< uint16_t, 256 > &  crctable,
uint8_t *  buf,
uint16_t  len,
uint16_t  crc 
)

Calculates a 16b checksum using a crc16 table on a 8b buffer

Definition at line 23 of file CRC.cpp.

◆ calculateCrc16_8_rev()

uint16_t calculateCrc16_8_rev ( std::array< uint16_t, 256 > &  crctable,
uint8_t *  buf,
uint16_t  len,
uint16_t  crc 
)

CRC16 with reversed table bytes

Definition at line 33 of file CRC.cpp.

◆ calculateCrc8()

uint8_t calculateCrc8 ( std::array< uint8_t, 256 > &  crctable,
uint8_t *  buf,
uint16_t  len,
uint8_t  crc 
)

Calculates a crc8 checksum

Definition at line 13 of file CRC.cpp.

◆ makeCrcTable()

template<typename T , size_t LEN>
void makeCrcTable ( std::array< T, LEN > &  table,
const T  crcpoly,
const uint8_t  bits,
const bool  refin = false,
const bool  refout = false 
)

Helper function to create a CRC table of different sizes and types

Definition at line 36 of file CRC.h.

◆ reverseBits()

template<typename T >
T reverseBits ( value)

Definition at line 15 of file CRC.h.