docs: 优化所有协议文件可读性,增加完整注释和doxygen说明,结构更清晰

This commit is contained in:
claw committed 2026-04-02 22:51:17 +08:00
1 parent e3519bf1f4
commit 102e59d033
6 files changed
+535 -253

No files matched your search

+38 -8
View File
@@ -1,3 +1,7 @@
/**
* @file finsudpmaster.h
* @brief 欧姆龙FINS UDP客户端主站头文件
*/
#ifndef FINSUDPMASTER_H
#define FINSUDPMASTER_H
@@ -8,21 +12,47 @@ extern "C" {
#include <stdint.h>
#include <stdbool.h>
extern uint8_t myRtumSTIdx;
extern uint8_t omrfins_buf[1024];
extern uint16_t fins_timeout;
extern uint16_t comm_count;
// ============================================================================
// 全局变量
// ============================================================================
// 处理接收到的FINS读响应
extern uint8_t myRtumSTIdx; // 当前轮询索引 (0~19)
extern uint8_t omrfins_buf[1024]; // FINS收发缓冲区
extern uint16_t fins_timeout; // 超时计数,由主循环递增
extern uint16_t comm_count; // 通信计数
// ============================================================================
// 接口函数
// ============================================================================
/**
* @brief 处理接收到的FINS读响应
* @param size: 接收数据长度
* @param local_node: 本地节点号
* @return true: 处理成功,false: 不是有效的读响应
*/
_Bool handleReadRecv(uint16_t size, uint16_t local_node);
// 构建FINS请求帧,返回发送长度
/**
* @brief 构建FINS请求帧
* @param local_node: 本地节点号
* @return 发送长度,0表示不发送(参数非法)
*/
uint16_t handleSend(uint16_t local_node);
// 超时计数,由主循环调用
/**
* @brief 超时计数,由主循环每次调用递增
*/
void update_timeout_fins(void);
// FINS UDP客户端主函数
/**
* @brief FINS UDP客户端主函数,W5500socket主循环处理
* @param sn: socket编号
* @param destip: 目标IP地址
* @param destport: 目标端口
* @param local_node: 本地节点号
* @return 0/正表示正常,负表示错误
*/
int32_t loopback_udpc_omrfins(uint8_t sn, uint8_t *destip, uint16_t destport, uint16_t local_node);
#ifdef __cplusplus