Files
JBao_Door_Clamp_FW/apps/usr_app/app_led.h
T
2026-08-25 14:59:39 +08:00

65 lines
1.8 KiB
C

/******************************************************************************
* @file app_led.h
* @brief CBC2 灯效:红绿独立通道,充电红与待机绿可同时亮
* @author cyWu <1917507415@qq.com>
* @date 2026.08.25
* @version V2.0.0
* @history
* - V1.0.0, 2026.08.21, cyWu, 首次发布
* - V1.1.0, 2026.08.25, cyWu, 开机绿灯只提示几秒,避免待机常亮耗电
* - V2.0.0, 2026.08.25, cyWu, 改用充电板 LED 事件表
* - V2.1.0, 2026.08.25, cyWu, 改为自己从 app_power/app_pair 取数,
* 调用方不用再手填 AppLedCtx_t
******************************************************************************/
#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_power 取,配对从 app_pair 取,
* 只有“功能是否开”这一项由调用方(app_function)传入
* @param dt 距上次调用的毫秒数
* @param app_power 1=功能开(DP0),0=功能关,功能灯全灭
* @return 无
*/
void app_led_run(uint16_t dt, uint8_t app_power);
/**
* @brief 请求切模式绿灯闪两下
* @return 无
*/
void app_led_request_mode_blink(void);
/**
* @brief 重新亮几秒开机绿灯
* @return 无
*/
void app_led_hint_power_on(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__ */