时间同步已经完成
This commit is contained in:
40
App/time_sync.h
Normal file
40
App/time_sync.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 模块名称:Time Sync — PC 本地时间推送接收(TCP)
|
||||
* 模块功能:以 TCP Server 方式监听 TIME_SYNC_PORT,接收 PC 推送的本地时间包,
|
||||
* 更新系统墙钟并写回 SD2506 RTC
|
||||
* 适用平台:STM32F407ZGTx + CH395F
|
||||
* 作者:王建锋
|
||||
* 创建日期:2026-08-27
|
||||
* 修改记录:
|
||||
* v1.0 2026-08-27 王建锋 创建初始版本(UDP 推送)
|
||||
* v1.1 2026-08-28 王建锋 改为 TCP Server,迁入独立任务 timeSyncTask
|
||||
*/
|
||||
|
||||
#ifndef __TIME_SYNC_H
|
||||
#define __TIME_SYNC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 监听端口:PC 推送端(TCP 客户端)需连到本端口 */
|
||||
#define TIME_SYNC_PORT 8888
|
||||
|
||||
/*
|
||||
* 函数功能:时间同步任务主体(独立 FreeRTOS 任务)
|
||||
* 入口参数:argument - FreeRTOS 传入参数(未使用)
|
||||
* 返回值:无
|
||||
* 限定条件:net_init() 已由 netTask 完成;网络消息队列由 netTask 处理
|
||||
* 函数说明:以 TCP Server 方式监听 TIME_SYNC_PORT,接收 PC 推送的本地时间包,
|
||||
* 经消息队列(由 netTask 串行执行)完成 socket 操作,更新系统墙钟。
|
||||
* 该任务与 FTP 等其它网络任务并发安全。
|
||||
*/
|
||||
void timeSyncTask(void *argument);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIME_SYNC_H */
|
||||
Reference in New Issue
Block a user