MiLightRadioConfig.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include <Arduino.h>
  2. #ifndef _MILIGHT_RADIO_CONFIG
  3. #define _MILIGHT_RADIO_CONFIG
  4. enum MiLightRadioType {
  5. UNKNOWN = 0,
  6. RGBW = 0xB8,
  7. CCT = 0x5A,
  8. RGB_CCT = 0x20
  9. };
  10. class MiLightRadioConfig {
  11. public:
  12. MiLightRadioConfig(const uint16_t syncword0,
  13. const uint16_t syncword3,
  14. const size_t packetLength,
  15. const uint8_t* channels,
  16. const size_t numChannels,
  17. const MiLightRadioType type)
  18. : syncword0(syncword0),
  19. syncword3(syncword3),
  20. packetLength(packetLength),
  21. channels(channels),
  22. numChannels(numChannels),
  23. type(type)
  24. {}
  25. const uint16_t syncword0;
  26. const uint16_t syncword3;
  27. const size_t packetLength;
  28. const uint8_t* channels;
  29. const size_t numChannels;
  30. const MiLightRadioType type;
  31. };
  32. const uint8_t RGBW_CHANNELS[] = {9, 40, 71};
  33. static MiLightRadioConfig MilightRgbwConfig(
  34. 0x147A, 0x258B, 7, RGBW_CHANNELS, 3, RGBW
  35. );
  36. const uint8_t CCT_CHANNELS[] = {4, 39, 74};
  37. static MiLightRadioConfig MilightCctConfig(
  38. 0x050A, 0x55AA, 7, CCT_CHANNELS, 3, CCT
  39. );
  40. const uint8_t RGBCCT_CHANNELS[] = {70, 39, 8};
  41. static MiLightRadioConfig MilightRgbCctConfig(
  42. 0x7236, 0x1809, 9, RGBCCT_CHANNELS, 3, RGB_CCT
  43. );
  44. #endif