/**
    @copyright None
    @file      led.h
    @author    Comment Vivre
    @date      2025-12-19
    @brief     None
*/
#ifndef __LED_H_
#define __LED_H_


#include <FU65_72.h>
// LED指示灯控制
// ------------------------------------------------------------------------
typedef enum
{
    LED_STATE_OFF,                          // 熄灭
    LED_STATE_ON,                           // 常亮
    LED_STATE_BLINK_FAULT,                  // 故障闪烁
    LED_STATE_POST_FAULT_DELAY              // 延时等待
} LED_State_t;

typedef struct
{
    uint16_t PauseDelayCnt;                 // 延时
    uint8_t BlinkCnt;                       // 当前闪烁次数
} LED_Count_t;

extern LED_State_t ledState;
extern LED_Count_t ledCount;

void LED_GPIO_Init(void);
void LED_State_Display(unsigned char Xn0);

// IO选择
// ------------------------------------------------------------------------
#define LED_PXIN                            (P2_OE)                             // LED所在端口组
#define LED_PINX                            (P21)                               // LED端口号
#define LED_PIN                             (GP21)                              // LED IO PIN 
#define LED_ON                              (LED_PIN = 0)                       // LED ON    
#define LED_OFF                             (LED_PIN = 1)                       // LED OFF
#define LEDPinONOFF                         (LED_PIN ^= 1)



extern bool data isCtrlPowOn;


#endif