semf
digitalinpolling.h
Go to the documentation of this file.
1
10#ifndef SEMF_INPUT_DIGITALIN_DIGITALINPOLLING_H_
11#define SEMF_INPUT_DIGITALIN_DIGITALINPOLLING_H_
12
16
17namespace semf
18{
30{
31public:
37 explicit DigitalInPolling(Gpio& gpio, bool inverted = false);
44 DigitalInPolling(Gpio& gpio, app::TimeBase& timeBase, bool inverted = false);
45 explicit DigitalInPolling(const DigitalInPolling& other) = delete;
46 virtual ~DigitalInPolling() = default;
47
49 void tick() override;
50 State state() const override;
51
52protected:
58 void setState(State state);
59
60private:
62 State m_state;
63};
64} /* namespace semf */
65#endif /* SEMF_INPUT_DIGITALIN_DIGITALINPOLLING_H_ */
Base class for having access to the level state of a digital input.
Definition: digitalin.h:23
Gpio & gpio() const
Returns the pointer to the GPIO to check the status from.
Definition: digitalin.cpp:40
Class for reading a digital input in polling mode.
State state() const override
Returns the level status of the hardware pin.
DigitalInPolling(const DigitalInPolling &other)=delete
void setState(State state)
Sets the hardware pin status internally.
DigitalInPolling(Gpio &gpio, bool inverted=false)
Constructor.
virtual ~DigitalInPolling()=default
Interface class for using a GPIO pin of the microcontroller.
Definition: gpio.h:23
Interface for all classes receiving ticks like DigitalInPolling or SoftwareTimer.
Definition: tickreceiver.h:29
A TimeBase is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver o...
Definition: timebase.h:36