SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
satnogs::comms::lib::bsp::gpio Class Referenceabstract

GPIO device abstraction. More...

#include <gpio.hpp>

Inheritance diagram for satnogs::comms::lib::bsp::gpio:
satnogs::comms::gpio_bsp satnogs::comms::lib::bsp::dummy_gpio

Public Types

enum class  direction : uint8_t { INPUT = 0 , OUTPUT = 1 }

Public Member Functions

 gpio (direction dir=direction::INPUT)
 Construct a new GPIO object.
virtual void toggle ()=0
 Toggles the GPIO pin if it is configured as output. Has no effect if it is conigured as input.
virtual bool get ()=0
 Gets the logical level of the GPIO pin. For example, if the pin has been configured as active low, and the input level is 0V, this method will return true.
virtual bool get_raw ()=0
 Gets the physical level of the GPIO pin. For example, if the input level is 0V, this method will return false.
virtual void set (bool s)=0
 Sets the logical output of the pin. For example, if the pin has been configured as active low, setting s to true will set the output pin to 0V.
virtual void set_raw (bool s)=0
 Sets the physical output of the pin.
virtual void set_direction (direction dir)=0
 Set the direction of the GPIO.

Detailed Description

GPIO device abstraction.

This class provides a generic GPIO (General-Purpose Input/Output) abstraction.

Warning
Depending on the target platform/RTOS users are expected to define a class that inherits this one and implement at least the pure virtual methods

Definition at line 37 of file gpio.hpp.

Member Enumeration Documentation

◆ direction

enum class satnogs::comms::lib::bsp::gpio::direction : uint8_t
strong
Enumerator
INPUT 

GPIO pin is configured as input.

OUTPUT 

GPIO pin is configured as output.

Definition at line 40 of file gpio.hpp.

Constructor & Destructor Documentation

◆ gpio()

satnogs::comms::lib::bsp::gpio::gpio ( direction dir = direction::INPUT)
inline

Construct a new GPIO object.

Parameters
dirThe direction of the pin (INPUT or OUTPUT). Default is direction::INPUT.

Definition at line 52 of file gpio.hpp.

Member Function Documentation

◆ get()

virtual bool satnogs::comms::lib::bsp::gpio::get ( )
pure virtual

Gets the logical level of the GPIO pin. For example, if the pin has been configured as active low, and the input level is 0V, this method will return true.

Returns
true if the logical level is 1
false if the logical level is 0

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.

◆ get_raw()

virtual bool satnogs::comms::lib::bsp::gpio::get_raw ( )
pure virtual

Gets the physical level of the GPIO pin. For example, if the input level is 0V, this method will return false.

Returns
true if the physical level is > 0V
false if the physical level is 0V

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.

◆ set()

virtual void satnogs::comms::lib::bsp::gpio::set ( bool s)
pure virtual

Sets the logical output of the pin. For example, if the pin has been configured as active low, setting s to true will set the output pin to 0V.

Has no effect if the pin is not configured as output.

Parameters
sthe logical level of the output pin

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.

◆ set_direction()

virtual void satnogs::comms::lib::bsp::gpio::set_direction ( direction dir)
pure virtual

Set the direction of the GPIO.

Parameters
dirthe desired direction

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.

◆ set_raw()

virtual void satnogs::comms::lib::bsp::gpio::set_raw ( bool s)
pure virtual

Sets the physical output of the pin.

Has no effect if the pin is not configured as output.

Parameters
sthe physical level of the output pin

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.

◆ toggle()

virtual void satnogs::comms::lib::bsp::gpio::toggle ( )
pure virtual

Toggles the GPIO pin if it is configured as output. Has no effect if it is conigured as input.

Implemented in satnogs::comms::gpio_bsp, and satnogs::comms::lib::bsp::dummy_gpio.


The documentation for this class was generated from the following file:
  • libsatnogs-comms/include/satnogs-comms-lib/bsp/gpio.hpp