提交 | 用户 | age
|
5dd1b7
|
1 |
#ifndef _CRC_H_ |
Q |
2 |
#define _CRC_H_ |
|
3 |
|
|
4 |
#include <stdint.h> |
|
5 |
|
|
6 |
// CRC types |
|
7 |
#define CRC_TYPE_CCITT 0 |
|
8 |
#define CRC_TYPE_IBM 1 |
|
9 |
// Polynomial = X^16 + X^12 + X^5 + 1 |
|
10 |
#define POLYNOMIAL_CCITT 0x1021 |
|
11 |
// Polynomial = X^16 + X^15 + X^2 + 1 |
|
12 |
#define POLYNOMIAL_IBM 0x8005 |
|
13 |
// Seeds |
|
14 |
#define CRC_IBM_SEED 0xFFFF |
|
15 |
#define CRC_CCITT_SEED 0x1D0F |
|
16 |
|
|
17 |
|
|
18 |
uint16_t RadioComputeCRC( uint8_t *buffer, uint8_t length, uint8_t crcType ); |
|
19 |
uint16_t ComputeCrc( uint16_t crc, uint8_t dataByte, uint16_t polynomial ); |
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
#endif |
|
24 |
|