semf
semf::DigitalInPolling Class Reference

Class for reading a digital input in polling mode. More...

#include <digitalinpolling.h>

Inheritance diagram for semf::DigitalInPolling:
Inheritance graph
Collaboration diagram for semf::DigitalInPolling:
Collaboration graph

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
Gpiogpio () 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
 

Detailed Description

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().

See also
app::DigitalIn
TickReceiver

Definition at line 29 of file digitalinpolling.h.

Constructor & Destructor Documentation

◆ DigitalInPolling() [1/3]

semf::DigitalInPolling::DigitalInPolling ( Gpio gpio,
bool  inverted = false 
)
explicit

Constructor.

Parameters
gpioGPIO interface object for hardware access.
invertedtrue sets high level of a pin as low and low level of a pin as high.

Definition at line 15 of file digitalinpolling.cpp.

Here is the call graph for this function:

◆ DigitalInPolling() [2/3]

semf::DigitalInPolling::DigitalInPolling ( Gpio gpio,
app::TimeBase timeBase,
bool  inverted = false 
)

Constructor.

Parameters
gpioGPIO interface object for hardware access.
timeBaseThe timebase, registering in this object to update pin level.
invertedtrue sets high level of a pin as low and low level of a pin as high.

Definition at line 21 of file digitalinpolling.cpp.

Here is the call graph for this function:

◆ DigitalInPolling() [3/3]

semf::DigitalInPolling::DigitalInPolling ( const DigitalInPolling other)
explicitdelete

◆ ~DigitalInPolling()

virtual semf::DigitalInPolling::~DigitalInPolling ( )
virtualdefault

Member Function Documentation

◆ setState()

void semf::DigitalInPolling::setState ( State  state)
protected

Sets the hardware pin status internally.

Note
If DigitalIn is set inverted, the state has to be inverted here, tool
Parameters
statePin status.

Definition at line 50 of file digitalinpolling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ state()

app::DigitalIn::State semf::DigitalInPolling::state ( ) const
overridevirtual

Returns the level status of the hardware pin.

Note
If DigitalIn is set inverted, state is inverted.
Returns
High for high level and Low for low level.

Reimplemented from semf::DigitalIn.

Definition at line 45 of file digitalinpolling.cpp.

Here is the caller graph for this function:

◆ tick()

void semf::DigitalInPolling::tick ( )
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.

Here is the call graph for this function: