/** * @file pcan_crc.h * @brief CRC-16/CCITT-FALSE: poly 0x1021, init 0xFFFF, без рефлексии, * без финального XOR. Контрольное значение для "123456789" - 0x29B1. */ #ifndef PCAN_CRC_H #define PCAN_CRC_H #include #include #include "pcan_config.h" #ifdef __cplusplus extern "C" { #endif /** Начальное значение для инкрементального расчёта. */ #define PCAN_CRC_INIT 0xFFFFU uint16_t pcan_crc16_update(uint16_t crc, uint8_t byte); uint16_t pcan_crc16(const uint8_t *data, size_t len); #ifdef __cplusplus } #endif #endif /* PCAN_CRC_H */