3.27_433:实现并验证RF433模块接收相应指令:新增UART路由核心模块,使程序能响应RF433/RS485指令,并向UART2输出LOG(RS485由于硬件原因未验证)
This commit is contained in:
@ -3,12 +3,15 @@
|
||||
* @file io_monitor.h
|
||||
* @brief IO状态监控模块头文件
|
||||
* @author Application Layer
|
||||
* @version 1.0
|
||||
* @version 1.1
|
||||
******************************************************************************
|
||||
* @attention
|
||||
* 本模块实现四路数字输入(DI1-DI4)的状态监控
|
||||
* 采用定时扫描+软件去抖方式检测IO状态变化
|
||||
* 状态变化时通过UART2_Print上报
|
||||
* 状态变化时通过回调函数上报,支持多端口路由
|
||||
*
|
||||
* 修订历史:
|
||||
* v1.1 - 增加事件回调机制,支持多端口路由
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
@ -26,6 +29,15 @@ extern "C" {
|
||||
#define IO_SCAN_PERIOD_MS 10
|
||||
#define IO_DEBOUNCE_COUNT 3
|
||||
|
||||
/**
|
||||
* @brief IO事件回调函数类型
|
||||
* @note 当IO状态变化时调用,用于事件路由
|
||||
* @param channel: 通道号(0-3对应DI1-DI4)
|
||||
* @param state: 当前状态(0=LOW, 1=HIGH)
|
||||
* @param event_msg: 事件消息字符串
|
||||
*/
|
||||
typedef void (*io_event_callback_t)(uint8_t channel, uint8_t state, const char *event_msg);
|
||||
|
||||
/**
|
||||
* @brief 初始化IO监控模块
|
||||
* @note 初始化各通道状态,读取初始IO电平
|
||||
@ -75,6 +87,14 @@ void IO_Monitor_EnableReport(bool enable);
|
||||
*/
|
||||
uint32_t IO_Monitor_GetChangeCount(uint8_t channel);
|
||||
|
||||
/**
|
||||
* @brief 设置IO事件回调函数
|
||||
* @note 设置后,IO状态变化将通过回调函数上报
|
||||
* @param callback: 回调函数指针,NULL则使用默认UART2输出
|
||||
* @retval 无
|
||||
*/
|
||||
void IO_Monitor_SetEventCallback(io_event_callback_t callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user