MiLightRadioConfig.h 1.5 KB

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