Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPIPort.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * SPIPort.h
17  * An OLA SPI Port. This simply wraps the SPIOutput.
18  * Copyright (C) 2013 Simon Newton
19  */
20 
21 #ifndef PLUGINS_SPI_SPIPORT_H_
22 #define PLUGINS_SPI_SPIPORT_H_
23 
24 #include <string>
25 #include "ola/DmxBuffer.h"
26 #include "olad/Port.h"
27 #include "plugins/spi/SPIDevice.h"
28 #include "plugins/spi/SPIOutput.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace spi {
33 
35  public:
36  SPIOutputPort(SPIDevice *parent, class SPIBackendInterface *backend,
37  const ola::rdm::UID &uid, const SPIOutput::Options &options);
38  ~SPIOutputPort() {}
39 
40  std::string GetDeviceLabel() const;
41  bool SetDeviceLabel(const std::string &device_label);
42  uint8_t GetPersonality() const;
43  bool SetPersonality(uint16_t personality);
44  uint16_t GetStartAddress() const;
45  bool SetStartAddress(uint16_t start_address);
46  unsigned int PixelCount() const;
47 
48  std::string Description() const;
49  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
50 
51  void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
52  void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
53  void SendRDMRequest(const ola::rdm::RDMRequest *request,
54  ola::rdm::RDMCallback *callback);
55 
56  private:
57  SPIOutput m_spi_output;
58 };
59 } // namespace spi
60 } // namespace plugin
61 } // namespace ola
62 #endif // PLUGINS_SPI_SPIPORT_H_