21 #ifndef PLUGINS_SPI_SPIOUTPUT_H_
22 #define PLUGINS_SPI_SPIOUTPUT_H_
42 Personality(uint16_t footprint,
const string &description)
43 : m_footprint(footprint),
44 m_description(description) {
47 uint16_t footprint()
const {
return m_footprint; }
48 string description()
const {
return m_description; }
52 const string m_description;
63 void AddPersonality(uint16_t footprint,
const string &description) {
64 m_personalities.push_back(
new Personality(footprint, description));
67 uint8_t PersonalityCount()
const {
return m_personalities.size(); }
69 bool SetActivePersonality(uint8_t personality) {
70 if (personality == 0 || personality > m_personalities.size())
72 m_active_personality = personality;
76 uint8_t ActivePersonalityNumber()
const {
return m_active_personality; }
79 return Lookup(m_active_personality);
82 uint16_t ActivePersonalityFootprint()
const {
83 const Personality *personality = Lookup(m_active_personality);
84 return personality ? personality->footprint() : 0;
87 string ActivePersonalityDescription()
const {
88 const Personality *personality = Lookup(m_active_personality);
89 return personality ? personality->description() :
"";
93 const Personality *Lookup(uint8_t personality)
const {
94 if (personality == 0 || personality > m_personalities.size())
96 return m_personalities[personality - 1];
100 std::vector<Personality*> m_personalities;
101 uint8_t m_active_personality;
109 uint8_t output_number;
111 explicit Options(uint8_t output_number)
113 output_number(output_number) {
121 uint8_t GetPersonality()
const;
122 bool SetPersonality(uint16_t personality);
123 uint16_t GetStartAddress()
const;
124 bool SetStartAddress(uint16_t start_address);
125 unsigned int PixelCount()
const {
return m_pixel_count; }
127 string Description()
const;
141 static RDMOps *Instance() {
143 instance =
new RDMOps();
148 RDMOps() : ola::rdm::ResponderOps<SPIOutput>(PARAM_HANDLERS) {}
150 static RDMOps *instance;
153 class SPIBackendInterface *m_backend;
154 const uint8_t m_output_number;
155 string m_spi_device_name;
157 const unsigned int m_pixel_count;
158 uint16_t m_start_address;
159 bool m_identify_mode;
160 PersonalityManager m_personality_manager;
163 void IndividualWS2801Control(
const DmxBuffer &buffer);
164 void CombinedWS2801Control(
const DmxBuffer &buffer);
165 void IndividualLPD8806Control(
const DmxBuffer &buffer);
166 void CombinedLPD8806Control(
const DmxBuffer &buffer);
167 unsigned int LPD8806BufferSize()
const;
168 void WriteSPIData(
const uint8_t *data,
unsigned int length);
171 const RDMResponse *GetDeviceInfo(
const RDMRequest *request);
172 const RDMResponse *GetProductDetailList(
const RDMRequest *request);
173 const RDMResponse *GetDeviceModelDescription(
const RDMRequest *request);
174 const RDMResponse *GetManufacturerLabel(
const RDMRequest *request);
175 const RDMResponse *GetDeviceLabel(
const RDMRequest *request);
176 const RDMResponse *GetSoftwareVersionLabel(
const RDMRequest *request);
177 const RDMResponse *GetDmxPersonality(
const RDMRequest *request);
178 const RDMResponse *SetDmxPersonality(
const RDMRequest *request);
179 const RDMResponse *GetPersonalityDescription(
const RDMRequest *request);
180 const RDMResponse *GetDmxStartAddress(
const RDMRequest *request);
181 const RDMResponse *SetDmxStartAddress(
const RDMRequest *request);
182 const RDMResponse *GetIdentify(
const RDMRequest *request);
183 const RDMResponse *SetIdentify(
const RDMRequest *request);
185 static const uint8_t SPI_MODE;
186 static const uint8_t SPI_BITS_PER_WORD;
187 static const uint16_t SPI_DELAY;
188 static const uint32_t SPI_SPEED;
189 static const uint16_t WS2801_SLOTS_PER_PIXEL;
190 static const uint16_t LPD8806_SLOTS_PER_PIXEL;
198 #endif // PLUGINS_SPI_SPIOUTPUT_H_