user_ws2812b.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef USER_WS2812B_H__
  2. #define USER_WS2812B_H__
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #include "define.h"
  6. #include "ws2812b_spi.h"
  7. #define USER_WS2812B_INTERVAL 10
  8. #define WS2812B_LOW 0xC0
  9. #define WS2812B_HIGH 0xF0
  10. typedef enum
  11. {
  12. WS2812B_QUEUE_TIME = 0,
  13. WS2812B_QUEUE_INT = 1,
  14. }USER_WS2812B_QUEUE_TYPE;
  15. typedef struct{
  16. bool change; //是否有变化
  17. uint8_t bright; //灯亮度
  18. uint8_t rValue;
  19. uint8_t gValue;
  20. uint8_t bValue;
  21. }ws2812b_led_param_s;
  22. typedef struct{
  23. bool txStat; //数据写状态
  24. uint8_t count; //灯的数量
  25. ws2812b_led_param_s *led_param;
  26. uint8_t *rgbValue;
  27. }user_ws2812b_work_s;
  28. void vUser_ws2812b_init(uint8_t count);
  29. void vUser_ws2812b_task_start(void);
  30. void vUser_ws2812b_set_tx_stat(bool stat);
  31. void vUser_ws2812b_set_stat(uint8_t idx, uint8_t r, uint8_t g, uint8_t b, uint8_t bright);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif // USER_WS2812B_H__
  36. /** @} */