Files
wuchuyuan e324ebd99b 精简 usr_app 架构:去掉关机/休眠死代码,按键复用 key.c 状态机,ISR 重活统一延后到任务上下文
Type-C 长供电、上电即工作、无软关机,删除 app_boot/app_power 及 DP0 开关相关逻辑,
去掉空占位 app_fan_run 和无效的 usr_timer_pick_mode/rearm(数码管 4ms 扫描已 priority=1,
系统本来就不会进低功耗)。按键 5s 配对 / 12s OTA 改走 key.c 长按分级,去掉自计时与 1~5s 死区。
新增 app_defer,NVM/配对/OTA 只在 ISR 置位、在 500ms 任务上下文落地,避免再在 usr_timer 里写 flash。
规格书与注释同步精简。
2026-08-31 17:57:52 +08:00

78 lines
1.9 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/******************************************************************************
* @file app_led.h
* @brief CBR3 灯效:单灯 PC2OTA/配对/常亮按优先级
* @author cyWu <1917507415@qq.com>
* @date 2026.08.31
* @version V1.1.0,新增长按 5s 的"将配网"提示灯(配对改由运行态长按触发,
* 需要在按住期间给反馈)
******************************************************************************/
#ifndef __APP_LED_H__
#define __APP_LED_H__
#include <stdint.h>
typedef enum {
APP_LED_OK = 0,
APP_LED_ERR_NOT_INIT
} AppLed_Ret_t;
/**
* @brief 灯效初始化,先全灭
* @return APP_LED_OK=成功
*/
AppLed_Ret_t app_led_init(void);
/**
* @brief 按优先级刷新灯:配对从 app_pair 取,功能开关由调用方传入
* @param dt 距上次调用的毫秒数
* @param power_on 1=开机态,0=关机态(灯灭)
* @return 无
*/
void app_led_run(uint16_t dt, uint8_t power_on);
/**
* @brief 重新挂开机常亮
* @return 无
*/
void app_led_hint_power_on(void);
/**
* @brief 长按满 5s 的"松手即配网"提示:清掉其它灯,挂配对快闪
* @note 此时还没清绑定(要等松手),只是给按住的用户一个反馈
* @return 无
*/
void app_led_hint_pair(void);
/**
* @brief 结束"将配网"提示(配对会话已由 app_pair 接管,或改判为 OTA
* @return 无
*/
void app_led_clear_pair_hint(void);
/**
* @brief 进入 OTA:清掉其它灯,挂 200ms 闪一直闪
* @return 无
*/
void app_led_request_ota(void);
/**
* @brief 查询是否处于 OTA 灯效
* @return 1=OTA 灯效中,0=否
*/
uint8_t app_led_is_ota(void);
/**
* @brief 清空全部灯事件并灭灯(关机前调用)
* @return 无
*/
void app_led_clear(void);
/**
* @brief 查询是否已初始化
* @return APP_LED_OK=已初始化,APP_LED_ERR_NOT_INIT=未初始化
*/
AppLed_Ret_t app_led_get_status(void);
#endif /* __APP_LED_H__ */