P0/P1/P2功能实现:接入业务组合根(按键/LED/过零/配网/OTA),联动、11B定时、运行记录、灯泡寿命(DP3/DP4/DP25)、CBR0 VM、512分包
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/******************************************************************************
|
||||
* @file bsp_zc.h
|
||||
* @brief PA1 过零检测(MCPWM FPIN 双沿中断)
|
||||
* @author cyWu <1917507415@qq.com>
|
||||
* @date 2026.09.04
|
||||
* @version V3.1.0
|
||||
* @history
|
||||
* - V3.1.0, 2026.09.04, cyWu, 精简注释
|
||||
* - V3.0.0, 2026.09.04, cyWu, FPIN 硬件边沿中断
|
||||
*
|
||||
* @note BR28 无通用 GPIO 中断,沿检测复用 MCPWM FPIN(例程 usr_hw_gpio_int.c)。
|
||||
* PA1 占两个通道实现双沿。ISR 只准清 pending、计数、回调切 GPIO。
|
||||
* 软件兜底必须用真实 1ms 定时器,禁止在 20ms 节拍里空循环采样。
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __BSP_ZC_H__
|
||||
#define __BSP_ZC_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef void (*BspZcEdgeCb_t)(void);
|
||||
|
||||
/**
|
||||
* @brief 初始化 PA1 并挂 FPIN 双沿中断
|
||||
* @param cb 沿回调(app_relay 提供),NULL 则只计数
|
||||
* @return 无
|
||||
*/
|
||||
void bsp_zc_init(BspZcEdgeCb_t cb);
|
||||
|
||||
/**
|
||||
* @brief 1ms 软件采样兜底
|
||||
* @note 须由真实 1ms 定时器调用
|
||||
* @return 无
|
||||
*/
|
||||
void bsp_zc_scan_1ms(void);
|
||||
|
||||
/**
|
||||
* @brief 累计过零沿次数
|
||||
* @return 沿计数
|
||||
*/
|
||||
uint32_t bsp_zc_edge_count(void);
|
||||
|
||||
/**
|
||||
* @brief 最近一次沿的时间戳
|
||||
* @return timer_get_ms(),0=从未检测到
|
||||
*/
|
||||
uint32_t bsp_zc_last_edge_ms(void);
|
||||
|
||||
/**
|
||||
* @brief 当前 PA1 电平
|
||||
* @return 0 或 1
|
||||
*/
|
||||
uint8_t bsp_zc_level(void);
|
||||
|
||||
#endif /* __BSP_ZC_H__ */
|
||||
Reference in New Issue
Block a user