hal_led.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __hal_led_h__
  2. #define __hal_led_h__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <string.h>
  6. #include "sdk_common.h"
  7. #include "SEGGER_RTT.h"
  8. #include "usr_config.h"
  9. //ARGB
  10. #define COLOR_BLACK 0xFF000000
  11. #define COLOR_WHITE 0xFF070707
  12. #define COLOR_RED 0xFF070000
  13. #define COLOR_GREEN 0xFF000700
  14. #define COLOR_BLUE 0xFF000007
  15. #define COLOR_ORANGE 0xFF070300
  16. #define COLOR_PURPLE 0xFF070007
  17. #define COLOR_YELLOW 0xFF070700
  18. #define COLOR_CYAN 0xFF000707
  19. ////显示优先级 0~250
  20. //enum {
  21. // LED_PRIO_NONE = 0, //保留
  22. // LED_PRIO_OVERTURN, //翻转显示电量
  23. // LED_PRIO_CHARGE, //充电显示电量
  24. //
  25. //};
  26. //显示优先级 0~250
  27. enum {
  28. LED_NONE = 0, //保留
  29. LED_RUN, //测试灯
  30. LED_CHARGE, //充电显示电量
  31. LED_OVERTURN, //翻转显示电量
  32. LED_CONFIG, //匹配完成灯
  33. LED_CONNECT, //连接完成灯
  34. LED_GAME,
  35. MEMBER_NUM_OF_LED, //LED成员变量
  36. };
  37. typedef struct _LED{
  38. uint8_t onoff;
  39. uint8_t R;
  40. uint8_t G;
  41. uint8_t B;
  42. uint8_t pwm;
  43. uint32_t color; //颜色
  44. }LED_t;
  45. void LED_Init(void);
  46. void LED_Start(uint8_t n);
  47. void LED_Stop(uint8_t n);
  48. void LED_SetColor(uint8_t n,uint32_t color);
  49. void LED_Close_Enforce(void);
  50. #endif