ADS124S08 Example C Code  1.0.0
crc.h
Go to the documentation of this file.
1 
38 // APP NOTE: Communication Methods for Data Integrity Using Delta-Sigma Data Converters
39 // URL: https://www.ti.com/lit/an/sbaa106/sbaa106.pdf
40 
41 #ifndef CRC_H_
42 #define CRC_H_
43 
44 // Standard libraries
45 #include <stdbool.h>
46 #include <stdint.h>
47 
48 
49 //****************************************************************************
50 //
51 // Constants
52 //
53 //****************************************************************************
54 
55 //
56 // Select CRC calculation mode...either lookup or calculation
57 //
58 #define CRC_LOOKUP
59 //#define CRC_CALCULATION
60 
61 //
62 // Select CRC word length...
63 //
64 #define CRC8 // CRC word is 8-bits wide
65 
66 #define CRCWORD uint8_t
67 
68 // Initial seed value for CRC calculation
69 #define CRC_INITIAL_SEED ((CRCWORD) 0x00)
70 
71 // Initial seed value for CRC calculation
72 // ADS1x4S0x device family is based on the CRC-8-ATM (HEC) polynomial: X^8 + X^2 + X + 1
73 #define CRC_POLYNOMIAL ((CRCWORD) 0x07)
74 
75 
76 //*****************************************************************************
77 //
78 // Function Prototypes
79 //
80 //*****************************************************************************
81 void initCRC(void);
82 CRCWORD getCRC(const uint8_t dataBytes[], uint8_t numberBytes, CRCWORD initialValue);
83 
84 #endif /* CRC_H_ */
uint8_t getCRC(const uint8_t dataBytes[], uint8_t numberBytes, uint8_t initialValue)
getCRC() Performs CRC lookup or calculation
Definition: crc.c:99
#define CRCWORD
Definition: crc.h:66
void initCRC(void)
initCRC() Initializes CRC module and creates lookup table (if using lookup method) ...
Definition: crc.c:71