distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
SpiDeviceSelectGuard.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIDEVICESELECTGUARD_HPP_
13 #define INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIDEVICESELECTGUARD_HPP_
14 
16 
17 namespace distortos
18 {
19 
20 namespace devices
21 {
22 
30 {
31 public:
32 
39  explicit SpiDeviceSelectGuard(OutputPin& slaveSelectPin) :
40  slaveSelectPin_{slaveSelectPin}
41  {
42  slaveSelectPin_.set(false);
43  }
44 
50  {
51  slaveSelectPin_.set(true);
52  }
53 
55  SpiDeviceSelectGuard& operator=(const SpiDeviceSelectGuard&) = delete;
56 
57 private:
58 
61 };
62 
63 } // namespace devices
64 
65 } // namespace distortos
66 
67 #endif // INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIDEVICESELECTGUARD_HPP_
~SpiDeviceSelectGuard()
SpiDeviceSelectGuard's destructor.
Definition: SpiDeviceSelectGuard.hpp:49
Definition: SpiDeviceSelectGuard.hpp:29
OutputPin & slaveSelectPin_
reference to slave select pin of this SPI slave device
Definition: SpiDeviceSelectGuard.hpp:60
Definition: OutputPin.hpp:29
virtual void set(bool state)=0
Sets state of pin.
OutputPin class header.
Top-level namespace of distortos project.
Definition: buttons.hpp:33
SpiDeviceSelectGuard(OutputPin &slaveSelectPin)
SpiDeviceSelectGuard's constructor.
Definition: SpiDeviceSelectGuard.hpp:39