Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Esp32Gpio< PIN_NUM, INVERTED > Class Template Reference

Defines a GPIO output pin. More...

#include <Esp32Gpio.hxx>

Inheritance diagram for Esp32Gpio< PIN_NUM, INVERTED >:
Gpio

Public Member Functions

void write (Value new_state) const override
 Sets the output state of the connected GPIO pin.
 
Value read () const override
 Reads the current state of the connected GPIO pin.
 
void set () const override
 Sets output to HIGH.
 
void clr () const override
 Sets output to LOW.
 
void set_direction (Direction dir) const override
 Sets the direction of the connected GPIO pin.
 
Direction direction () const override
 Gets the GPIO direction.
 
- Public Member Functions inherited from Gpio
constexpr Gpio ()
 Constructor.
 
void write (bool new_state) const
 Writes a GPIO output pin (set or clear to a specific state).
 
bool is_set () const
 Tests the GPIO input pin to see if it is set.
 
bool is_clr () const
 Tests the GPIO input pin to see if it is clear.
 

Static Private Attributes

static const Esp32Gpio instance_
 Static instance variable that can be used for libraries expecting a generic Gpio pointer.
 

Friends

template<class Defs , bool SAFE_VALUE, bool INVERT>
struct GpioOutputPin
 
template<class Defs , bool PUEN, bool PDEN>
struct GpioInputPin
 

Additional Inherited Members

- Public Types inherited from Gpio
enum  Value : bool { CLR = false , SET = true , VLOW = CLR , VHIGH = SET }
 Defines the options for GPIO level. More...
 
enum class  Direction { DINPUT , DOUTPUT }
 Defines the options for GPIO direction. More...
 

Detailed Description

template<gpio_num_t PIN_NUM, bool INVERTED = false>
class Esp32Gpio< PIN_NUM, INVERTED >

Defines a GPIO output pin.

Writes to this structure will change the output level of the pin. Reads will return the pin's current level.

The pin is set to output at initialization time, with the level defined by ‘SAFE_VALUE’.

Do not use this class directly. Use GPIO_PIN instead.

Definition at line 75 of file Esp32Gpio.hxx.

Member Function Documentation

◆ clr()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
void Esp32Gpio< PIN_NUM, INVERTED >::clr ( ) const
inlineoverridevirtual

Sets output to LOW.

Implements Gpio.

Definition at line 157 of file Esp32Gpio.hxx.

◆ direction()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
Direction Esp32Gpio< PIN_NUM, INVERTED >::direction ( ) const
inlineoverridevirtual

Gets the GPIO direction.

Returns
DINPUT or DOUTPUT

Implements Gpio.

Definition at line 183 of file Esp32Gpio.hxx.

◆ read()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
Value Esp32Gpio< PIN_NUM, INVERTED >::read ( ) const
inlineoverridevirtual

Reads the current state of the connected GPIO pin.

Returns
SET if currently high, CLR if currently low.

Implements Gpio.

Definition at line 145 of file Esp32Gpio.hxx.

◆ set()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
void Esp32Gpio< PIN_NUM, INVERTED >::set ( ) const
inlineoverridevirtual

Sets output to HIGH.

Implements Gpio.

Definition at line 151 of file Esp32Gpio.hxx.

◆ set_direction()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
void Esp32Gpio< PIN_NUM, INVERTED >::set_direction ( Direction  dir) const
inlineoverridevirtual

Sets the direction of the connected GPIO pin.

Implements Gpio.

Definition at line 163 of file Esp32Gpio.hxx.

◆ write()

template<gpio_num_t PIN_NUM, bool INVERTED = false>
void Esp32Gpio< PIN_NUM, INVERTED >::write ( Value  new_state) const
inlineoverridevirtual

Sets the output state of the connected GPIO pin.

Parameters
new_stateState to set the GPIO pin to.

Implements Gpio.

Definition at line 127 of file Esp32Gpio.hxx.

Friends And Related Symbol Documentation

◆ GpioInputPin

template<gpio_num_t PIN_NUM, bool INVERTED = false>
template<class Defs , bool PUEN, bool PDEN>
friend struct GpioInputPin
friend

Definition at line 193 of file Esp32Gpio.hxx.

◆ GpioOutputPin

template<gpio_num_t PIN_NUM, bool INVERTED = false>
template<class Defs , bool SAFE_VALUE, bool INVERT>
friend struct GpioOutputPin
friend

Definition at line 192 of file Esp32Gpio.hxx.

Member Data Documentation

◆ instance_

template<gpio_num_t PIN_NUM, bool INVERTED>
const Esp32Gpio< PIN_NUM, INVERTED > Esp32Gpio< PIN_NUM, INVERTED >::instance_
staticprivate

Static instance variable that can be used for libraries expecting a generic Gpio pointer.

Defines the linker symbol for the wrapped Gpio instance.

This instance variable will be initialized by the linker and (assuming the application developer initialized the hardware pins in hw_preinit) is accessible, including virtual methods at static constructor time.

Definition at line 199 of file Esp32Gpio.hxx.


The documentation for this class was generated from the following file: