#ifndef _MULTI_LED_H_ #define _MULTI_LED_H_ //#include "stdint.h" #include "TypeDef.h" #include #include //According to your need to modify the constants. #define LED_SCAN 100 typedef void (*LedCallback)(bool); enum LED_NUM_DEF { LED_WORK, LED_TX, LED_GZ, LED_MAX }; enum LED_STATE_DEF { LED_STATE0_OFF, //关 LED_STATE1_ON, //开 LED_STATE2_FLASH, //闪烁 LED_STATE3_CONUT, //延时关闭 LED_STATE4_NOT, //取反 LED_STATE5_FLASH_DELAY, //闪烁,延时关闭 LED_STATE_MAX }; typedef struct { u8 ID; //LED号 bool OnOff; //状态 u8 Type; //类型:0.关 1.开 2.闪烁 3.定时开关 u16 FlashTime; //闪烁时间 u16 CloseTime; //关闭时间/闪烁占空比 u16 Count; //计时 bool Res; //最后结果 } pLed; typedef struct Led { pLed Play; LedCallback led_set_gpio; struct Led* next; }Led; #ifdef __cplusplus extern "C" { #endif void led_init_Head(void); void led_init(struct Led* handle, LedCallback led_set_gpio); void led_set_state(struct Led* handle, u8 ID, u8 OnOff, u8 Type, u16 FlashTime, u16 CloseTime, bool Res ); int led_start(struct Led* handle); void led_stop(struct Led* handle); void led_ticks(void); #ifdef __cplusplus } #endif #endif