hal_led.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 COLOR_BLACK 0xFF000000
  50. #define COLOR_LOWWHITE 0x0F0F0F0F
  51. #define COLOR_WHITE 0xFF1F1F1F
  52. #define COLOR_RED 0xFF6F0000
  53. #define COLOR_GREEN 0xFF009F00
  54. #define COLOR_BLUE 0xFF0000AF
  55. #define COLOR_ORANGE 0xFF3F1000
  56. #define COLOR_PURPLE 0xFF9F009F
  57. #define COLOR_YELLOW 0xFF7F7F00
  58. #define COLOR_CYAN 0xFF005F5F
  59. #define LED_ENABLE 0
  60. #define LED_DISABLE 1
  61. ////显示优先级 0~250
  62. //enum {
  63. // LED_PRIO_NONE = 0, //保留
  64. // LED_PRIO_OVERTURN, //翻转显示电量
  65. // LED_PRIO_CHARGE, //充电显示电量
  66. //
  67. //};
  68. //显示优先级 0~250
  69. enum {
  70. LED_NONE = 0, //保留
  71. LED_RUN, //测试灯
  72. LED_CONNECT, //连接完成灯
  73. LED_SELF_CHECK, //自检灯
  74. LED_OVERTURN, //翻转显示电量
  75. LED_CHARGE, //充电显示电量
  76. // LED_SCAN, //扫描连接灯
  77. LED_LRCHECK, //左右鞋区分灯
  78. LED_PAIR, //匹配完成灯
  79. LED_ONPURPLE, //常亮紫色灯
  80. LED_EXCEPT, //故障灯
  81. LED_NUM_OF_LED, //LED成员变量
  82. };
  83. void LED_Init(void);
  84. void LED_Stop(uint8_t n);
  85. void LED_Start(uint8_t n,uint32_t color);
  86. void LED_Close_Enforce(void);
  87. void LED_SetColor(uint8_t n,uint32_t color);
  88. void WS2812_DisplayDot(uint32_t col);
  89. void WS2812_Pwm_Play(void);
  90. #endif