23 lines
307 B
C
23 lines
307 B
C
|
/*
|
||
|
参考了Linux
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stddef.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#define CRC8_INIT 0xFF
|
||
|
|
||
|
uint8_t CRC8_Calc(const uint8_t *buf, size_t len, uint8_t crc);
|
||
|
bool CRC8_Verify(const uint8_t *buf, size_t len);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|