Files
2026-09-09 15:03:50 +08:00

72 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 灯效:绿=作业态、红=配对态;OTA / 配对失败占双灯(规格书第 6 章)
* @author cyWu <1917507415@qq.com>
* @date 2026.09.09
* @version V1.0.0
******************************************************************************/
#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 按优先级刷新灯(每 20ms 业务节拍调用)
* @param dt 距上次调用的毫秒数
* @note 绿灯跟作业态(app_spray_is_running,含间隔等待);红灯跟配对态。
* 同时推进配对会话计时(app_pair_tick_1ms)并消费成功/失败边沿。
* @return 无
*/
void app_led_run(uint16_t dt);
/**
* @brief 配网键满 5s 的"松手即配网"提示:红灯 100ms 快闪(绿灯不受影响)
* @note 此时还没清绑定(要等松手),只是给按住的用户反馈
* @return 无
*/
void app_led_hint_pair(void);
/**
* @brief 结束"将配网"提示(配对会话已由 app_pair 接管,或改判为 OTA
* @return 无
*/
void app_led_clear_pair_hint(void);
/**
* @brief 进入 OTA:清掉其它灯,挂红绿交替一直闪(最高优先级)
* @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__ */