Wirepas SDK
crc.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
7 #ifndef CRC_H
8 #define CRC_H
9 
10 #include <stdint.h>
11 
19 /* Select only one of the alternative implementations below: */
20 
22 #define CRC_CCITT_FAST_LUT
23 
25 //#define CRC_CCITT_LEGACY
26 
27 typedef union
28 {
29  struct
30  {
31  uint8_t lsb;
32  uint8_t msb;
33  };
34  uint16_t crc;
35 } crc_t;
36 
40 #define Crc_initValue() 0xffff
41 
49 uint16_t Crc_addByte(uint16_t crc, uint8_t byte);
50 
58 uint16_t Crc_fromBuffer(const uint8_t * buf, uint32_t len);
59 
67 uint16_t Crc_fromBuffer32(const uint32_t * buf, uint32_t len);
68 
69 #endif
crc_t::crc
uint16_t crc
Definition: crc.h:34
Crc_addByte
uint16_t Crc_addByte(uint16_t crc, uint8_t byte)
crc_t
Definition: crc.h:27
Crc_fromBuffer
uint16_t Crc_fromBuffer(const uint8_t *buf, uint32_t len)
Crc_fromBuffer32
uint16_t Crc_fromBuffer32(const uint32_t *buf, uint32_t len)