semf
digitalin.h
Go to the documentation of this file.
1
10#ifndef SEMF_INPUT_DIGITALIN_DIGITALIN_H_
11#define SEMF_INPUT_DIGITALIN_DIGITALIN_H_
12
14#include <semf/system/gpio.h>
15
16namespace semf
17{
23{
24public:
30 explicit DigitalIn(Gpio& gpio, bool inverted = false);
31 explicit DigitalIn(const DigitalIn& other) = delete;
33 virtual ~DigitalIn() = default;
35
40 bool isInverted() const override;
45 void setInverted(bool inverted) override;
51 State state() const override;
52
53protected:
58 Gpio& gpio() const;
59
60private:
62 Gpio* m_gpio;
64 bool m_inverted;
65};
66} /* namespace semf */
67#endif /* SEMF_INPUT_DIGITALIN_DIGITALIN_H_ */
Base class for having access to the level state of a digital input.
Definition: digitalin.h:23
DigitalIn(const DigitalIn &other)=delete
bool isInverted() const override
Returns of the pin level logic is inverted.
Definition: digitalin.cpp:21
Gpio & gpio() const
Returns the pointer to the GPIO to check the status from.
Definition: digitalin.cpp:40
void setInverted(bool inverted) override
Configures the inversion of the input reading.
Definition: digitalin.cpp:26
DigitalIn(Gpio &gpio, bool inverted=false)
Constructor.
Definition: digitalin.cpp:15
State state() const override
Returns the level status of the hardware pin.
Definition: digitalin.cpp:32
Interface class for using a GPIO pin of the microcontroller.
Definition: gpio.h:23
Interfaces for having access to the level state of a digital input.
Definition: digitalin.h:35
virtual ~DigitalIn()=default