3 GENERIC_CRC8::GENERIC_CRC8(uint8_t poly
)
7 for (uint16_t i
= 0; i
< crclen
; i
++)
10 for (uint8_t j
= 0; j
< 8; j
++)
12 crc
= (crc
<< 1) ^ ((crc
& 0x80) ? poly
: 0);
14 crc8tab
[i
] = crc
& 0xFF;
18 uint8_t ICACHE_RAM_ATTR
GENERIC_CRC8::calc(const uint8_t data
)
23 uint8_t ICACHE_RAM_ATTR
GENERIC_CRC8::calc(const uint8_t *data
, uint8_t len
, uint8_t crc
)
27 crc
= crc8tab
[crc
^ *data
++];
32 GENERIC_CRC14::GENERIC_CRC14(uint16_t poly
)
35 for (uint16_t i
= 0; i
< crclen
; i
++)
38 for (uint8_t j
= 0; j
< 8; j
++)
40 crc
= (crc
<< 1) ^ ((crc
& 0x2000) ? poly
: 0);
46 uint16_t ICACHE_RAM_ATTR
GENERIC_CRC14::calc(uint8_t *data
, uint8_t len
, uint16_t crc
)
50 crc
= (crc
<< 8) ^ crc14tab
[((crc
>> 6) ^ (uint16_t) *data
++) & 0x00FF];
55 uint16_t ICACHE_RAM_ATTR
GENERIC_CRC14::calc(volatile uint8_t *data
, uint8_t len
, uint16_t crc
)
59 crc
= (crc
<< 8) ^ crc14tab
[((crc
>> 6) ^ (uint16_t) *data
++) & 0x00FF];