MiLightRadioConfig.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. static const size_t NUM_CHANNELS = 3;
  12. MiLightRadioConfig(const uint16_t syncword0,
  13. const uint16_t syncword3,
  14. PacketFormatter* packetFormatter,
  15. const MiLightRadioType type,
  16. const uint8_t channel0,
  17. const uint8_t channel1,
  18. const uint8_t channel2)
  19. : syncword0(syncword0),
  20. syncword3(syncword3),
  21. packetFormatter(packetFormatter),
  22. type(type)
  23. {
  24. channels[0] = channel0;
  25. channels[1] = channel1;
  26. channels[2] = channel2;
  27. }
  28. const uint16_t syncword0;
  29. const uint16_t syncword3;
  30. uint8_t channels[3];
  31. PacketFormatter* packetFormatter;
  32. const MiLightRadioType type;
  33. static MiLightRadioConfig* fromString(const String& s);
  34. size_t getPacketLength() const;
  35. };
  36. static MiLightRadioConfig MilightRgbwConfig(
  37. 0x147A, 0x258B, new RgbwPacketFormatter(8), RGBW, 9, 40, 71
  38. );
  39. static MiLightRadioConfig MilightCctConfig(
  40. 0x050A, 0x55AA, new CctPacketFormatter(8), CCT, 4, 39, 74
  41. );
  42. static MiLightRadioConfig MilightRgbCctConfig(
  43. 0x7236, 0x1809, new RgbCctPacketFormatter(9), RGB_CCT, 8, 39, 70
  44. );
  45. #endif