WS2812_ATY.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * @file WS2812_ATY.h
  3. *
  4. * @param Project DEVICE_DRIVER_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2026 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief functions of WS2812 for C platform
  20. *
  21. * @version
  22. * - 1_01_251112 > ATY
  23. * -# Refactor to Dev-style; remove legacy global interfaces
  24. * - 1_02_251218 > ATY
  25. * -# Refactor all
  26. ********************************************************************************
  27. */
  28. #ifndef __WS2812_ATY_H
  29. #define __WS2812_ATY_H
  30. #include "INCLUDE_ATY.h"
  31. /******************************* For user *************************************/
  32. /******************************************************************************/
  33. struct WS2812_ATY_Dev{
  34. uint8_t (*set)(uint8_t* buffer, uint8_t count);
  35. uint8_t count;
  36. uint8_t* buffer;
  37. float brightness; // 0.0 - 1.0
  38. uint8_t code0;
  39. uint8_t code1;
  40. uint8_t autoUpdate;
  41. uint8_t lock;
  42. };
  43. uint8_t WS2812_Flush(struct WS2812_ATY_Dev* dev);
  44. void WS2812_GetRGB(struct WS2812_ATY_Dev* dev, uint16_t index, uint8_t* R, uint8_t* G, uint8_t* B);
  45. uint8_t WS2812_Fill(struct WS2812_ATY_Dev* dev, uint8_t R, uint8_t G, uint8_t B);
  46. uint8_t WS2812_SetPixel(struct WS2812_ATY_Dev* dev, uint16_t index, uint8_t R, uint8_t G, uint8_t B);
  47. uint8_t WS2812_GetPixel(struct WS2812_ATY_Dev* dev, uint16_t index, uint8_t* R, uint8_t* G, uint8_t* B);
  48. uint8_t WS2812_Clear(struct WS2812_ATY_Dev* dev);
  49. #endif /* __WS2812_ATY_H */
  50. /******************************** End Of File *********************************/