Files
JBao_Temp_Humi_Fan_FW/apps/usr_app/app_function.h
T
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

75 lines
2.5 KiB
C
Raw 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_function.h
* @brief CBR3 功能总装:按键动作(短按切档 / 长按 5s 配对 / 长按 12s OTA+ DP 同步
* @author cyWu <1917507415@qq.com>
* @date 2026.08.31
* @version V2.2.0,上电即开机:长按分级回调 usr_on_key_pair_hint/pair_start/
* ota_startDP0 power 恒为开机态(无软关机),已删除
* app_function_soft_off/is_power_on 等死代码
*
* @note 本模块只做"按键 → 动作"和"状态 → DP",不写业务算法。
* 档位/模式/条件的执行在各自 app_* 模块(规格书第 0 章第 2 条)。
******************************************************************************/
#ifndef __APP_FUNCTION_H__
#define __APP_FUNCTION_H__
#include <stdint.h>
/**
* @brief 初始化功能模块状态
* @return 无
*/
void app_function_init(void);
/**
* @brief 同步 DPfan_gear、mode、fault_code),每个业务 tick 调用
* @note DP0 power 不在这里同步:恒为开机态,写死在 app_function_init
* @return 无
*/
void app_function_poll(void);
/**
* @brief 任务上下文周期处理(由 usr_timer_loop 500ms 调用)
* @note ⚠ VM 落盘(syscfg_write)与配对/OTA 落地只允许在这里做:usr_timer_loop
* 跑在 BLE 线程(任务上下文,栈充足);usr_timer_tick 是硬件定时器
* 中断上下文,做这些会栈溢出复位。
* @return 无
*/
void app_function_loop(void);
/**
* @brief 业务层短按回调(key_manager 触发):档位 1→2→3→0→1…
* @return 无
*/
void usr_on_key_short(void);
/**
* @brief 业务层"按住满 5s"回调(key_manager 触发,20ms 中断上下文)
* @note 只切提示灯,不清绑定
* @return 无
*/
void usr_on_key_pair_hint(void);
/**
* @brief 业务层"按满 5s 后松手"回调(key_manager 触发,20ms 中断上下文)
* @note 只置标志:清绑定要写 VM,由 app_function_loop 在任务上下文执行
* @return 无
*/
void usr_on_key_pair_start(void);
/**
* @brief 业务层"按住满 12s"回调(key_manager 触发,20ms 中断上下文)
* @note 只置标志:usr_app_ota_init 由 app_function_loop 在任务上下文执行
* @return 无
*/
void usr_on_key_ota_start(void);
/**
* @brief 出厂重置:清业务 VM 与 RAM,保留 BLE 配对(规格书 14 章)
* @return 无
*/
void app_function_factory_reset(void);
#endif /* __APP_FUNCTION_H__ */