CARMA C++
GpioDio.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_CANBUS_GPIODIO_H
11 #define CARMA_CANBUS_GPIODIO_H
12 
13 #include "carma/canbus/Dio.h"
14 
15 #include <boost/thread.hpp>
16 #include <vector>
17 
18 namespace carma {
19 namespace canbus {
20 
24  class GpioDio : public Dio {
25  public:
26 
30  GpioDio( );
31 
40  GpioDio( std::vector< int > basePins, bool resetOnStart );
41 
45  ~GpioDio( );
46 
51  void powerOn();
52 
57  void powerOff();
58 
63  void resetHi();
64 
69  void resetLo();
70 
75  void reservedHi();
76 
81  void reservedLo();
82 
87  void clear();
88 
89  protected:
90 
91  private:
92 
93  void set( unsigned char bits );
94  void unset( unsigned char bits );
95  void writeHoldingLock( );
96 
97  struct GpioInfo {
98  std::vector< int > fds; // File descriptors for all 8 pins
99  int basePin; // Base pin
100  };
101 
102  unsigned char state_;
103  std::vector< GpioInfo > gpioDevs_;
104  boost::mutex mutex_; // Coarse lock
105  const bool emulate_;
106 
107  }; // class GpioDio
108 
109 }} // namespace carma::canbus
110 #endif // #ifndef CARMA_CANBUS_GPIODIO_H
Dio abstract base class.
Definition: Dio.h:19
void resetLo()
Unassert the &#39;reset&#39; line.
void resetHi()
Assert the reset line.
GpioDio()
Constructor for emulation.
void clear()
Clear (unassert) all lines.
~GpioDio()
Destructor.
void powerOn()
Assert the &#39;power&#39; line.
void powerOff()
Unassert the &#39;power&#39; line.
void reservedHi()
Assert the &#39;reserved&#39; line.
void reservedLo()
Unassert the &#39;reserved&#39; line.
Declaration of carma::canbus::Dio class.
GpioDio class for use with gpio framework.
Definition: GpioDio.h:24