hal_led.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. //#define COLOR_BLACK 0xFF000000
  20. //#define COLOR_WHITE 0xFFFFFFFF
  21. //#define COLOR_RED 0xFFFF0000
  22. //#define COLOR_GREEN 0xFF00FF00
  23. //#define COLOR_BLUE 0xFF0000FF
  24. //#define COLOR_ORANGE 0xFFFF6000
  25. //#define COLOR_PURPLE 0xFFFF00FF
  26. //#define COLOR_YELLOW 0xFFFFFF00
  27. //#define COLOR_CYAN 0xFF00FFFF
  28. #define COLOR_BLACK 0xFF000000
  29. #define COLOR_LOWWHITE 0x0F0F0F0F
  30. #define COLOR_WHITE 0x2F2F2F2F
  31. #define COLOR_RED 0xFFFF0000
  32. #define COLOR_LIGHRED 0xFF070000
  33. #define COLOR_GREEN 0xFF007F00
  34. #define COLOR_BLUE 0xFF0000FF
  35. #define COLOR_ORANGE 0xFF6F1000
  36. #define COLOR_PURPLE 0xFFFF00FF
  37. #define COLOR_YELLOW 0xFFFFFF00
  38. #define COLOR_CYAN 0xFF000707
  39. //#define COLOR_BLACK 0xFF000000
  40. //#define COLOR_LOWWHITE 0x0F0F0F0F
  41. //#define COLOR_WHITE 0xFF0E0E0E
  42. //#define COLOR_RED 0xFF2F0000
  43. //#define COLOR_GREEN 0xFF002F00
  44. //#define COLOR_BLUE 0xFF00002F
  45. //#define COLOR_ORANGE 0xFF1F1000
  46. //#define COLOR_PURPLE 0xFF2F002F
  47. //#define COLOR_YELLOW 0xFF5F5F00
  48. //#define COLOR_CYAN 0xFF005F5F
  49. #define LED_ENABLE 0
  50. #define LED_DISABLE 1
  51. ////显示优先级 0~250
  52. //enum {
  53. // LED_PRIO_NONE = 0, //保留
  54. // LED_PRIO_OVERTURN, //翻转显示电量
  55. // LED_PRIO_CHARGE, //充电显示电量
  56. //
  57. //};
  58. //显示优先级 0~250
  59. enum {
  60. LED_NONE = 0, //保留
  61. LED_RUN, //测试灯
  62. LED_CONNECT, //连接完成灯
  63. LED_SELF_CHECK, //自检灯
  64. LED_OVERTURN, //翻转显示电量
  65. LED_CHARGE, //充电显示电量
  66. LED_PAIR, //匹配完成灯
  67. LED_EXCEPT, //故障灯
  68. LED_RESTART, //重启亮灯
  69. LED_NUM_OF_LED, //LED成员变量
  70. };
  71. void LED_Init(void);
  72. void LED_Stop(uint8_t n);
  73. void LED_Start(uint8_t n,uint32_t color);
  74. void LED_Close_Enforce(void);
  75. void LED_SetColor(uint8_t n,uint32_t color);
  76. void WS2812_DisplayDot(uint32_t col);
  77. void WS2812_Pwm_Play(void);
  78. #endif