led.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. @copyright None
  3. @file led.h
  4. @author Comment Vivre
  5. @date 2025-12-19
  6. @brief None
  7. */
  8. #ifndef __LED_H_
  9. #define __LED_H_
  10. #include <FU65_72.h>
  11. // LED指示灯控制
  12. // ------------------------------------------------------------------------
  13. typedef enum
  14. {
  15. LED_STATE_OFF, // 熄灭
  16. LED_STATE_ON, // 常亮
  17. LED_STATE_BLINK_FAULT, // 故障闪烁
  18. LED_STATE_POST_FAULT_DELAY // 延时等待
  19. } LED_State_t;
  20. typedef struct
  21. {
  22. uint16_t PauseDelayCnt; // 延时
  23. uint8_t BlinkCnt; // 当前闪烁次数
  24. } LED_Count_t;
  25. extern LED_State_t ledState;
  26. extern LED_Count_t ledCount;
  27. void LED_GPIO_Init(void);
  28. void LED_State_Display(unsigned char Xn0);
  29. // IO选择
  30. // ------------------------------------------------------------------------
  31. #define LED_PXIN (P2_OE) // LED所在端口组
  32. #define LED_PINX (P21) // LED端口号
  33. #define LED_PIN (GP21) // LED IO PIN
  34. #define LED_ON (LED_PIN = 0) // LED ON
  35. #define LED_OFF (LED_PIN = 1) // LED OFF
  36. #define LEDPinONOFF (LED_PIN ^= 1)
  37. extern bool data isCtrlPowOn;
  38. #endif