semf
semf::DigitalIn Class Reference

Base class for having access to the level state of a digital input. More...

#include <digitalin.h>

Inheritance diagram for semf::DigitalIn:
Inheritance graph
Collaboration diagram for semf::DigitalIn:
Collaboration graph

Public Member Functions

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

Protected Member Functions

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

Base class for having access to the level state of a digital input.

See also
app::DigitalIn

Definition at line 22 of file digitalin.h.

Constructor & Destructor Documentation

◆ DigitalIn() [1/2]

semf::DigitalIn::DigitalIn ( 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 digitalin.cpp.

◆ DigitalIn() [2/2]

semf::DigitalIn::DigitalIn ( const DigitalIn other)
explicitdelete

Member Function Documentation

◆ gpio()

Gpio & semf::DigitalIn::gpio ( ) const
protected

Returns the pointer to the GPIO to check the status from.

Returns
Pointer to the GPIO.

Definition at line 40 of file digitalin.cpp.

◆ isInverted()

bool semf::DigitalIn::isInverted ( ) const
overridevirtual

Returns of the pin level logic is inverted.

Returns
true for inverse, otherwise false.

Implements semf::app::DigitalIn.

Definition at line 21 of file digitalin.cpp.

◆ setInverted()

void semf::DigitalIn::setInverted ( bool  inverted)
overridevirtual

Configures the inversion of the input reading.

Parameters
invertedtrue interprets high level of a pin as low and a low level of a pin as high.

Implements semf::app::DigitalIn.

Definition at line 26 of file digitalin.cpp.

◆ state()

app::DigitalIn::State semf::DigitalIn::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.

Implements semf::app::DigitalIn.

Reimplemented in semf::DigitalInPolling.

Definition at line 32 of file digitalin.cpp.

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