hal_ws2812.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __hal_ws2812_h__
  2. #define __hal_ws2812_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 WS2812_COLOR_BLACK 0xFF000000
  29. #define WS2812_COLOR_WHITE 0xFFFFFFFF
  30. #define WS2812_COLOR_RED 0xFFFF0000
  31. #define WS2812_COLOR_GREEN 0xFF00FF00
  32. #define WS2812_COLOR_BLUE 0xFF0000FF
  33. #define WS2812_COLOR_ORANGE 0xFFff3f00
  34. #define WS2812_COLOR_PURPLE 0xFFFF00FF
  35. #define WS2812_COLOR_YELLOW 0xFFFFFF00
  36. #define WS2812_COLOR_CYAN 0xFF00FFFF
  37. ////显示优先级 0~250
  38. //enum {
  39. // LED_PRIO_NONE = 0, //保留
  40. // LED_PRIO_OVERTURN, //翻转显示电量
  41. // LED_PRIO_CHARGE, //充电显示电量
  42. //
  43. //};
  44. //显示优先级 0~250
  45. enum {
  46. WS2812_NONE = 0, //保留
  47. #if DEBUG_LEDRUN
  48. WS2812_TEST, //测试灯
  49. #endif
  50. MEMBER_NUM_OF_WS2812, //LED成员数量
  51. };
  52. void WS2812_Initialize(void);
  53. void WS2812_Start(uint8_t n,uint32_t color);
  54. void WS2812_Resum(uint8_t n);
  55. void WS2812_Stop(uint8_t n);
  56. void WS2812_SetColor(uint8_t n,uint32_t color);
  57. #endif