distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
ChipOutputPin.hpp
Go to the documentation of this file.
1 
12 #ifndef SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_CHIPOUTPUTPIN_HPP_
13 #define SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_CHIPOUTPUTPIN_HPP_
14 
16 
18 
19 namespace distortos
20 {
21 
22 namespace chip
23 {
24 
32 {
33 public:
34 
49  explicit ChipOutputPin(Pin pin, bool openDrain = {}, PinOutputSpeed outputSpeed = {}, PinPull pull = {},
50  bool initialState = {}, bool inverted = {});
51 
56  bool get() const override;
57 
64  void set(bool state) override;
65 
66 protected:
67 
72  bool getInvertedMode() const
73  {
74  return inverted_;
75  }
76 
83  void setInvertedMode(const bool inverted)
84  {
85  inverted_ = inverted;
86  }
87 
88 private:
89 
92 
94  bool inverted_;
95 };
96 
97 } // namespace chip
98 
99 } // namespace distortos
100 
101 #endif // SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_CHIPOUTPUTPIN_HPP_
bool inverted_
selects whether the pin is inverted (true) or not (false)
Definition: ChipOutputPin.hpp:94
Header for GPIOv2 functions for STM32.
Definition: OutputPin.hpp:29
bool getInvertedMode() const
Definition: ChipOutputPin.hpp:72
void setInvertedMode(const bool inverted)
Enables or disables inverted mode.
Definition: ChipOutputPin.hpp:83
Pin pin_
identifier of pin
Definition: ChipOutputPin.hpp:91
Definition: ChipOutputPin.hpp:31
PinPull
all possible pull-up/pull-down configurations of pin
Definition: STM32-GPIOv2.hpp:552
OutputPin class header.
Top-level namespace of distortos project.
ChipOutputPin(Pin pin, bool openDrain={}, PinOutputSpeed outputSpeed={}, PinPull pull={}, bool initialState={}, bool inverted={})
ChipOutputPin's constructor.
Definition: STM32-GPIOv2-ChipOutputPin.cpp:24
PinOutputSpeed
all possible output speeds of pin
Definition: STM32-GPIOv2.hpp:537
Pin
identifier of single pin - combined address of GPIO port with pin number
Definition: STM32-GPIOv2.hpp:74