LUA: show protocol2 only on receivers with serial1_TX or PWM pins defined (#2999)
[ExpressLRS.git] / src / lib / CRC / crc.h
blob497b98a1709b4db8c14f2b68160d183e7b35a8e4
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, uint16_t len, uint8_t crc = 0);
19 class Crc2Byte
21 private:
22 uint16_t _crctab[crclen];
23 uint8_t _bits;
24 uint16_t _bitmask;
25 uint16_t _poly;
27 public:
28 void init(uint8_t bits, uint16_t poly);
29 uint16_t calc(uint8_t *data, uint8_t len, uint16_t crc);