21 #ifndef PLUGINS_SPI_SPIOUTPUT_H_
22 #define PLUGINS_SPI_SPIOUTPUT_H_
31 #include "ola/rdm/ResponderPersonality.h"
41 std::string device_label;
43 uint8_t output_number;
45 explicit Options(uint8_t output_number,
const std::string &spi_device_name)
46 : device_label(
"SPI Device - " + spi_device_name),
48 output_number(output_number) {
57 std::string GetDeviceLabel()
const;
58 bool SetDeviceLabel(
const std::string &device_label);
59 uint8_t GetPersonality()
const;
60 bool SetPersonality(uint16_t personality);
61 uint16_t GetStartAddress()
const;
62 bool SetStartAddress(uint16_t start_address);
63 unsigned int PixelCount()
const {
return m_pixel_count; }
65 std::string Description()
const;
79 static RDMOps *Instance() {
81 instance =
new RDMOps();
86 RDMOps() : ola::rdm::ResponderOps<SPIOutput>(PARAM_HANDLERS) {}
88 static RDMOps *instance;
91 class SPIBackendInterface *m_backend;
92 const uint8_t m_output_number;
93 std::string m_spi_device_name;
95 const unsigned int m_pixel_count;
96 std::string m_device_label;
97 uint16_t m_start_address;
99 std::auto_ptr<ola::rdm::PersonalityCollection> m_personality_collection;
100 std::auto_ptr<ola::rdm::PersonalityManager> m_personality_manager;
101 ola::rdm::Sensors m_sensors;
104 bool InternalWriteDMX(
const DmxBuffer &buffer);
105 void IndividualWS2801Control(
const DmxBuffer &buffer);
106 void CombinedWS2801Control(
const DmxBuffer &buffer);
107 void IndividualLPD8806Control(
const DmxBuffer &buffer);
108 void CombinedLPD8806Control(
const DmxBuffer &buffer);
109 void IndividualP9813Control(
const DmxBuffer &buffer);
110 void CombinedP9813Control(
const DmxBuffer &buffer);
111 unsigned int LPD8806BufferSize()
const;
112 void WriteSPIData(
const uint8_t *data,
unsigned int length);
154 uint8_t P9813CreateFlag(uint8_t red, uint8_t green, uint8_t blue);
156 static const uint8_t SPI_MODE;
157 static const uint8_t SPI_BITS_PER_WORD;
158 static const uint16_t SPI_DELAY;
159 static const uint32_t SPI_SPEED;
160 static const uint16_t WS2801_SLOTS_PER_PIXEL;
161 static const uint16_t LPD8806_SLOTS_PER_PIXEL;
162 static const uint16_t P9813_SLOTS_PER_PIXEL;
163 static const uint16_t P9813_SPI_BYTES_PER_PIXEL;
171 #endif // PLUGINS_SPI_SPIOUTPUT_H_