/** * @file ALGO_CRC_ATY.h * * @param Project ALGO_Algorithm_ATY_LIB * * @author ATY * * @copyright * - Copyright 2017 - 2025 MZ-ATY * - This code follows: * - MZ-ATY Various Contents Joint Statement - * * https://mengze.top/MZ-ATY_VCJS * - CC 4.0 BY-NC-SA - * * https://creativecommons.org/licenses/by-nc-sa/4.0/ * - Your use will be deemed to have accepted the terms of this statement. * * @brief Familiar functions of CRC16 Modbus(others to be supplemented) for all codes * * @version * - 1_01_200318 > ATY * -# Preliminary version, first Release * - 1_03_200318 > ATY * -# Add Conditional Compilation * -# Add user port * - 1_05_200722 > ATY * -# Change parameters ********************************************************************************** */ #ifndef __ALGO_CRC_ATY_H #define __ALGO_CRC_ATY_H #include "INCLUDE_ATY.h" #include "ALGO_AlgorithmBase_ATY.h" /******************************* For user *************************************/ // #define __DEBUG_ALGO_CRC_ATY #define __CRC_CALC_ATY //use look-up table or calculate /******************************************************************************/ uint16_t GenCrc16Modbus(uint8_t* buf, uint8_t size); uint8_t GenCrc16ModbusHL(uint8_t* buf, uint8_t size, uint8_t highLow); uint8_t CheckCrc16Modbus(uint8_t* buf, uint8_t size); #ifdef __DEBUG_ALGO_CRC_ATY void TestCrc16Modbus(void); #endif /* __DEBUG_ALGO_CRC_ATY */ // http://api.ip33.com/ss/crc/c?data=12+32&width=16&poly=8005&init=FFFF&xor=0000&refin=true&refout=true // { // "code": 0, // "hex": "C58C", // "bin": "1100010110001100" // } #endif /* __ALGO_CRC_ATY_H */ /******************************** End Of File *********************************/