AceCRC
0.3.1
Cyclic Redundancy Check (CRC) algorithms (e.g. crc32(), crc16ccitt()) programmatically converted from C99 code generated by pycrc (https://pycrc.org) to Arduino C++ using namespaces and PROGMEM flash memory.
src
ace_crc
crc8_bit.cpp
Go to the documentation of this file.
1
20
#include "
crc8_bit.hpp
"
// header file converted by AceCRC
21
#include <stdlib.h>
22
#include <stdint.h>
23
#include <stdbool.h>
24
25
namespace
ace_crc {
26
namespace
crc8_bit {
27
28
29
30
crc_t
crc_update(
crc_t
crc,
const
void
*data,
size_t
data_len)
31
{
32
const
unsigned
char
*d = (
const
unsigned
char
*)data;
33
unsigned
int
i;
34
bool
bit;
35
unsigned
char
c;
36
37
while
(data_len--) {
38
c = *d++;
39
for
(i = 0x80; i > 0; i >>= 1) {
40
bit = crc & 0x80;
41
if
(c & i) {
42
bit = !bit;
43
}
44
crc <<= 1;
45
if
(bit) {
46
crc ^= 0x07;
47
}
48
}
49
crc &= 0xff;
50
}
51
return
crc & 0xff;
52
}
53
54
}
// crc8_bit
55
}
// ace_crc
ace_crc::crc8_bit::crc_t
uint8_t crc_t
The type of the CRC values.
Definition:
crc8_bit.hpp:68
crc8_bit.hpp
Generated by
1.8.17