makes GPIO_PIN_RST optional for the sx1276
[ExpressLRS.git] / src / lib / CRC / crc.h
blob0a6dc781b0e4d3f5effe094f5ea8d5985e40b053
1 #pragma once
2 #include <stdint.h>
3 #include "targets.h"
5 #define crclen 256
7 class GENERIC_CRC8
9 private:
10 uint8_t crc8tab[crclen];
11 uint8_t crcpoly;
13 public:
14 GENERIC_CRC8(uint8_t poly);
15 uint8_t calc(const uint8_t data);
16 uint8_t calc(const uint8_t *data, uint8_t len, uint8_t crc = 0);
19 class GENERIC_CRC14
21 private:
22 uint16_t crc14tab[crclen];
23 uint16_t crcpoly;
25 public:
26 GENERIC_CRC14(uint16_t poly);
27 uint16_t calc(uint8_t *data, uint8_t len, uint16_t crc);
28 uint16_t calc(volatile uint8_t *data, uint8_t len, uint16_t crc);