semf
|
Class for reading a digital input in polling mode. More...
#include <digitalinpolling.h>
Public Member Functions | |
DigitalInPolling (Gpio &gpio, bool inverted=false) | |
Constructor. More... | |
DigitalInPolling (Gpio &gpio, app::TimeBase &timeBase, bool inverted=false) | |
Constructor. More... | |
DigitalInPolling (const DigitalInPolling &other)=delete | |
virtual | ~DigitalInPolling ()=default |
void | tick () override |
State | state () const override |
Returns the level status of the hardware pin. More... | |
Public Member Functions inherited from semf::DigitalIn | |
DigitalIn (Gpio &gpio, bool inverted=false) | |
Constructor. More... | |
DigitalIn (const DigitalIn &other)=delete | |
bool | isInverted () const override |
Returns of the pin level logic is inverted. More... | |
void | setInverted (bool inverted) override |
Configures the inversion of the input reading. More... | |
State | state () const override |
Returns the level status of the hardware pin. More... | |
Public Member Functions inherited from semf::app::DigitalIn | |
virtual | ~DigitalIn ()=default |
virtual bool | isInverted () const =0 |
Returns of the pin level logic is inverted. More... | |
virtual void | setInverted (bool inverted)=0 |
Configures the inversion of the input reading. More... | |
virtual State | state () const =0 |
Returns the level status of the hardware pin. More... | |
Public Member Functions inherited from semf::TickReceiver | |
virtual | ~TickReceiver ()=default |
virtual void | tick ()=0 |
Is called by every tick. Is called periodically e.g. by a Timer object. More... | |
Public Member Functions inherited from semf::LinkedList< T >::Node | |
virtual | ~Node ()=default |
T * | next () const |
Returns a pointer to the next element in a list. More... | |
void | setNext (T *next) |
Sets a pointer to the next element in a list. More... | |
T * | previous () const |
Returns a pointer to the previous element in a list. More... | |
void | setPrevious (T *previous) |
Sets a pointer to the previous element in a list. More... | |
bool | isInAList () |
Returns if a node is part of a LinkedList . More... | |
Protected Member Functions | |
void | setState (State state) |
Sets the hardware pin status internally. More... | |
Protected Member Functions inherited from semf::DigitalIn | |
Gpio & | gpio () const |
Returns the pointer to the GPIO to check the status from. More... | |
Additional Inherited Members | |
Public Types inherited from semf::app::DigitalIn | |
enum | State : bool { Low = false , High = true } |
Public Attributes inherited from semf::app::DigitalIn | |
Signal | changedToHigh |
Signal | changedToLow |
Class for reading a digital input in polling mode.
This class will be registered in the TimeBase
to get updated every TimeBase
cycle.
For reading the actual hardware pin level, call the function DigitalIn::state()
.
app::DigitalIn
TickReceiver
Definition at line 29 of file digitalinpolling.h.
|
explicit |
Constructor.
gpio | GPIO interface object for hardware access. |
inverted | true sets high level of a pin as low and low level of a pin as high. |
Definition at line 15 of file digitalinpolling.cpp.
semf::DigitalInPolling::DigitalInPolling | ( | Gpio & | gpio, |
app::TimeBase & | timeBase, | ||
bool | inverted = false |
||
) |
Constructor.
gpio | GPIO interface object for hardware access. |
timeBase | The timebase, registering in this object to update pin level. |
inverted | true sets high level of a pin as low and low level of a pin as high. |
Definition at line 21 of file digitalinpolling.cpp.
|
explicitdelete |
|
virtualdefault |
|
protected |
Sets the hardware pin status internally.
DigitalIn
is set inverted, the state has to be inverted here, tool state | Pin status. |
Definition at line 50 of file digitalinpolling.cpp.
|
overridevirtual |
Returns the level status of the hardware pin.
DigitalIn
is set inverted, state is inverted. High
for high level and Low
for low level. Reimplemented from semf::DigitalIn.
Definition at line 45 of file digitalinpolling.cpp.
|
overridevirtual |
Checks the level status of the digital input and considers the inverted setting done in DigitalIn
.
Implements semf::TickReceiver.
Definition at line 28 of file digitalinpolling.cpp.