AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
sci_crc8.h
Go to the documentation of this file.
1/*************************************************************************/
38#ifndef SCI_CRC8_H
39#define SCI_CRC8_H
40
41/*!***************************************************************************
42 * @defgroup sci_crc SCI: CRC8
43 * @ingroup sci
44 * @brief SCI CRC8 (Cyclic Redundancy Check)
45 * @details CRC8 checksum calculation with an optimized algorithm that
46 * utilizes an look-up table and proceeds a whole byte at each step.
47 * @see http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html
48 * @addtogroup sci_crc
49 * @{
50 *****************************************************************************/
51
52#include <stdint.h>
53#include <stddef.h>
54#include <stdbool.h>
55
56/*!***************************************************************************
57 * @brief Initialization of the CRC8 module.
58 * @details Prepares the CRC8 lookup table.
59 *****************************************************************************/
60void SCI_CRC8_Init(void);
61
62/*!***************************************************************************
63 * @brief Calculation routine for the CRC8 checksum.
64 * @details Uses an optimized algorithm that utilizes an look-up table with
65 * 256 entries of 8-bit values (total: 256 bytes) and
66 * proceeds a whole byte at each step.
67 * @see http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html
68 * @param crc The previous CRC8. If starting, pass zero.
69 * @param data Pointer to the send or receive array.
70 * @param length Number of bytes in the frame array.
71 * @return Returns the CRC8 checksum.
72 *****************************************************************************/
73uint8_t SCI_CRC8_Compute(uint8_t crc, const uint8_t * data, size_t length);
74
76#endif /* SCI_CRC8_H */
uint8_t SCI_CRC8_Compute(uint8_t crc, const uint8_t *data, size_t length)
Calculation routine for the CRC8 checksum.
Definition sci_crc8.c:89
void SCI_CRC8_Init(void)
Initialization of the CRC8 module.
Definition sci_crc8.c:66