semf
semf::Gpio Class Referenceabstract

Interface class for using a GPIO pin of the microcontroller. More...

#include <gpio.h>

Inheritance diagram for semf::Gpio:
Inheritance graph
Collaboration diagram for semf::Gpio:
Collaboration graph

Public Types

enum  Direction { Input = 0 , OutputPushpull , OutputOpendrain }
 
enum  PullUpPullDown { NoPullupPulldown = 0 , Pullup , Pulldown }
 

Public Member Functions

virtual ~Gpio ()=default
 
virtual void set ()=0
 
virtual void reset ()=0
 
virtual bool state () const =0
 Returns the current state of the pin. More...
 
virtual Direction direction () const =0
 Returns the direction setting of a GPIO. More...
 
virtual void setDirection (Direction direction)=0
 Sets the direction of a GPIO. More...
 
virtual PullUpPullDown pullUpPullDown () const =0
 Returns the pullup or pulldown setting of a GPIO. More...
 
virtual void setPullUpPullDown (PullUpPullDown pullUpPullDown)=0
 Sets the pullup or pulldown setting of a GPIO. More...
 

Public Attributes

Signal< Errorerror
 

Detailed Description

Interface class for using a GPIO pin of the microcontroller.

Definition at line 22 of file gpio.h.

Member Enumeration Documentation

◆ Direction

Direction of a GPIO. It can be INPUT or OUTPUT.

Enumerator
Input 
OutputPushpull 
OutputOpendrain 

Definition at line 26 of file gpio.h.

◆ PullUpPullDown

Pullup or pulldown setting of a GPIO.

Enumerator
NoPullupPulldown 
Pullup 
Pulldown 

Definition at line 34 of file gpio.h.

Constructor & Destructor Documentation

◆ ~Gpio()

virtual semf::Gpio::~Gpio ( )
virtualdefault

Member Function Documentation

◆ direction()

virtual Direction semf::Gpio::direction ( ) const
pure virtual

Returns the direction setting of a GPIO.

Returns
INPUT or OUTPUT.

Implemented in semf::Stm32Gpio.

◆ pullUpPullDown()

virtual PullUpPullDown semf::Gpio::pullUpPullDown ( ) const
pure virtual

Returns the pullup or pulldown setting of a GPIO.

Returns
NoPullupPulldown, Pullup or Pulldown.

Implemented in semf::Stm32Gpio.

◆ reset()

virtual void semf::Gpio::reset ( )
pure virtual

Sets the output to a low level.

Implemented in semf::Stm32Gpio.

Here is the caller graph for this function:

◆ set()

virtual void semf::Gpio::set ( )
pure virtual

Sets the output to a high level.

Implemented in semf::Stm32Gpio.

Here is the caller graph for this function:

◆ setDirection()

virtual void semf::Gpio::setDirection ( Direction  direction)
pure virtual

Sets the direction of a GPIO.

Parameters
directiondirection to set.

Implemented in semf::Stm32Gpio.

Here is the caller graph for this function:

◆ setPullUpPullDown()

virtual void semf::Gpio::setPullUpPullDown ( PullUpPullDown  pullUpPullDown)
pure virtual

Sets the pullup or pulldown setting of a GPIO.

Parameters
pullUpPullDownpullup/pulldown for setting up.

Implemented in semf::Stm32Gpio.

◆ state()

virtual bool semf::Gpio::state ( ) const
pure virtual

Returns the current state of the pin.

Returns
true for high level, false for low level.

Implemented in semf::Stm32Gpio.

Here is the caller graph for this function:

Member Data Documentation

◆ error

Signal<Error> semf::Gpio::error

Signal gets emitted when any error occurred.

Definition at line 74 of file gpio.h.