Open Lighting Architecture  0.9.1
 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  uint8_t GetPersonality() const;
41  bool SetPersonality(uint16_t personality);
42  uint16_t GetStartAddress() const;
43  bool SetStartAddress(uint16_t start_address);
44  unsigned int PixelCount() const;
45 
46  std::string Description() const;
47  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
48 
49  void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
50  void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
51  void SendRDMRequest(const ola::rdm::RDMRequest *request,
52  ola::rdm::RDMCallback *callback);
53 
54  private:
55  SPIOutput m_spi_output;
56 };
57 } // namespace spi
58 } // namespace plugin
59 } // namespace ola
60 #endif // PLUGINS_SPI_SPIPORT_H_