bb76cfd779
规则定案:常量在右(a>5)、保护宏XXX_H(禁双下划线)、 头文件常量用#define、存储类前缀(g_/s_)优先、允许void返回值 全库32个.h头文件保护宏 __XXX_H → XXX_H 改名(字节级替换) S1检查规则同步更新(拒绝双下划线),Inc/gpio.h 反向验证被正确拦截 规范示例矛盾修复:K&R括号、标准类型、变量初始化、命名常量、注释字段补全
29 lines
517 B
C
29 lines
517 B
C
/*
|
|
* 模块名称:CRC Utility
|
|
* 模块功能:CRC-16 Modbus & CRC-8 查表计算
|
|
* 适用平台:通用嵌入式平台
|
|
* 作者:王建锋
|
|
* 创建日期:2026-07-19
|
|
* 修改记录:
|
|
* v1.0 2026-07-19 王建锋 创建初始版本
|
|
*/
|
|
|
|
#ifndef CRC_H
|
|
#define CRC_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
uint16_t crc16_modbus(const uint8_t *data, size_t len);
|
|
uint8_t crc8(const uint8_t *data, size_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CRC_H */
|