semf
semf::app::DigitalIn Class Referenceabstract

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

#include <digitalin.h>

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

Public Types

enum  State : bool { Low = false , High = true }
 

Public Member Functions

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 Attributes

Signal changedToHigh
 
Signal changedToLow
 

Detailed Description

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

By setting the inverted flag, the pin level will be forwarded inverse. The two signals changedToHigh and changedToLow will be emitted after the pin level changed. The function state returns the actual status of the pin.

This class is designed for application layers. Both, polling (DigitalInPolling) and interrupt (DigitalInInt) driven inputs, inherit from this class. Also DebouncedDigitalInPolling inherits from this class.

See also
DebouncedDigitalInPolling
DigitalInPolling
DigitalInInt

Definition at line 34 of file digitalin.h.

Member Enumeration Documentation

◆ State

Enum for the state of the pin.

Enumerator
Low 

Pin is at low state

High 

Pin is at high state

Definition at line 38 of file digitalin.h.

Constructor & Destructor Documentation

◆ ~DigitalIn()

virtual semf::app::DigitalIn::~DigitalIn ( )
virtualdefault

Member Function Documentation

◆ isInverted()

virtual bool semf::app::DigitalIn::isInverted ( ) const
pure virtual

Returns of the pin level logic is inverted.

Returns
true for inverse, otherwise false.

Implemented in semf::DigitalIn.

◆ setInverted()

virtual void semf::app::DigitalIn::setInverted ( bool  inverted)
pure virtual

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.

Implemented in semf::DigitalIn.

◆ state()

virtual State semf::app::DigitalIn::state ( ) const
pure virtual

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.

Implemented in semf::DigitalIn, and semf::DigitalInPolling.

Member Data Documentation

◆ changedToHigh

Signal semf::app::DigitalIn::changedToHigh

Is emitted after input changed to high.

Definition at line 64 of file digitalin.h.

◆ changedToLow

Signal semf::app::DigitalIn::changedToLow

Is emitted after input change to low.

Definition at line 66 of file digitalin.h.