# RadioLib: src/utils/CRC.h Source File

CRC.h
#if !defined(_RADIOLIB_CRC_H)
#define _RADIOLIB_CRC_H
#include "../TypeDef.h"
#include "../Module.h"
#if defined(RADIOLIB_BUILD_ARDUINO)
#include "../ArduinoHal.h"
#endif
// CCITT CRC properties (used by AX.25)
#define RADIOLIB_CRC_CCITT_POLY (0x1021)
#define RADIOLIB_CRC_CCITT_INIT (0xFFFF)
#define RADIOLIB_CRC_CCITT_OUT (0xFFFF)
class RadioLibCRC {
public:
uint8_t size = 8;
uint32_t poly = 0;
uint32_t init = 0;
uint32_t out = 0;
bool refIn = false;
bool refOut = false;
RadioLibCRC();
uint32_t checksum(const uint8_t* buff, size_t len);
};
// the global singleton
extern RadioLibCRC RadioLibCRCInstance;
#endif
RadioLibCRC
Class to calculate CRCs of varying formats.
Definition: CRC.h:19
RadioLibCRC::out
uint32_t out
Final XOR value.
Definition: CRC.h:39
RadioLibCRC::RadioLibCRC
RadioLibCRC()
Default constructor.
Definition: CRC.cpp:3
RadioLibCRC::init
uint32_t init
Initial value.
Definition: CRC.h:34
RadioLibCRC::checksum
uint32_t checksum(const uint8_t *buff, size_t len)
Calculate checksum of a buffer.
Definition: CRC.cpp:7
RadioLibCRC::refOut
bool refOut
Whether to reflect the result.
Definition: CRC.h:49
RadioLibCRC::refIn
bool refIn
Whether to reflect input bytes.
Definition: CRC.h:44
RadioLibCRC::size
uint8_t size
CRC size in bits.
Definition: CRC.h:24
RadioLibCRC::poly
uint32_t poly
CRC polynomial.
Definition: CRC.h:29