|
Open Model Railroad Network (OpenMRN)
|
OS-independent abstraction for GPIO. More...
#include <Gpio.hxx>
Public Types | |
| 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... | |
Public Member Functions | |
| constexpr | Gpio () |
| Constructor. | |
| virtual void | write (Value new_state) const =0 |
| Writes a GPIO output pin (set or clear to a specific state). | |
| void | write (bool new_state) const |
| Writes a GPIO output pin (set or clear to a specific state). | |
| virtual Value | read () const =0 |
| Retrieves the current Value of a GPIO input pin. | |
| 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. | |
| virtual void | set () const =0 |
| Sets the GPIO output pin to high. | |
| virtual void | clr () const =0 |
| Clears the GPIO output pin to low. | |
| virtual void | set_direction (Direction dir) const =0 |
| Sets the GPIO direction. | |
| virtual Direction | direction () const =0 |
| Gets the GPIO direction. | |
|
strong |
| enum Gpio::Value : bool |
|
inlineconstexpr |
|
pure virtual |
Clears the GPIO output pin to low.
Implemented in GpioWrapper< PIN >, MCP23017Gpio, MCP2515GPO, PersistentGpio, PWMGPO, SN74HC595GPO< N >, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, and MmapGpioTemplate< STORAGE >.
|
pure virtual |
Gets the GPIO direction.
Implemented in GpioWrapper< PIN >, MCP23017Gpio, MCP2515GPO, MCP2515GPI, PersistentGpio, PWMGPO, SN74HC595GPO< N >, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, and MmapGpioTemplate< STORAGE >.
|
inline |
|
inline |
|
pure virtual |
Retrieves the current Value of a GPIO input pin.
Implemented in GpioWrapper< PIN >, MCP23017Gpio, MCP2515GPO, MCP2515GPI, PersistentGpio, PWMGPO, SN74HC595GPO< N >, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, and MmapGpioTemplate< STORAGE >.
|
pure virtual |
Sets the GPIO output pin to high.
Implemented in GpioWrapper< PIN >, MCP23017Gpio, MCP2515GPO, PersistentGpio, PWMGPO, SN74HC595GPO< N >, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, and MmapGpioTemplate< STORAGE >.
|
pure virtual |
Sets the GPIO direction.
| dir | INPUT or OUTPUT |
Implemented in GpioWrapper< PIN >, MCP23017Gpio, PersistentGpio, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, MmapGpioTemplate< STORAGE >, MCP2515GPO, MCP2515GPI, PWMGPO, and SN74HC595GPO< N >.
|
inline |
Writes a GPIO output pin (set or clear to a specific state).
This is an inline function because this class encapsulates that HIGH==true and LOW==false, thus a direct typecast belongs here and not to customer code.
| new_state | bool representing the desired output state. true == high, false == low. |
|
pure virtual |
Writes a GPIO output pin (set or clear to a specific state).
| new_state | the desired output state. See Value. |
Implemented in GpioWrapper< PIN >, MCP23017Gpio, MCP2515GPO, PersistentGpio, PWMGPO, SN74HC595GPO< N >, Esp32Gpio< PIN_NUM, INVERTED >, CC3200Gpio< GPIO_BASE, GPIO_PIN >, TivaGpio< GPIO_BASE, GPIO_PIN >, and MmapGpioTemplate< STORAGE >.