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

Defines a GPIO output pin. More...

#include <LinuxGpio.hxx>

Static Public Member Functions

static void export_pin ()
 Export pin.
 
static void set_output ()
 Sets pin to output.
 
static void set_input ()
 Sets pin to input.
 
static void set_on ()
 Sets output to HIGH.
 
static void set_off ()
 Sets output to LOW.
 
static bool get ()
 
static void set (bool value)
 Set output pin level.
 
static void toggle ()
 Toggles output pin value.
 
static bool is_output ()
 

Static Public Attributes

static constexpr const uint32_t PIN = PIN_NUM
 Number of the pin.
 

Detailed Description

template<int PIN_NUM>
class LinuxGpio< PIN_NUM >

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. Uses Linux sysfs ABI

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 87 of file LinuxGpio.hxx.

Member Function Documentation

◆ export_pin()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::export_pin ( )
inlinestatic

Export pin.

Definition at line 94 of file LinuxGpio.hxx.

◆ get()

template<int PIN_NUM>
static bool LinuxGpio< PIN_NUM >::get ( )
inlinestatic
Returns
input pin level.

Definition at line 146 of file LinuxGpio.hxx.

◆ is_output()

template<int PIN_NUM>
static bool LinuxGpio< PIN_NUM >::is_output ( )
inlinestatic
Returns
true if pin is configured as an output pin.

Definition at line 175 of file LinuxGpio.hxx.

◆ set()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::set ( bool  value)
inlinestatic

Set output pin level.

Parameters
valueis the level to set to.

Definition at line 156 of file LinuxGpio.hxx.

◆ set_input()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::set_input ( )
inlinestatic

Sets pin to input.

Definition at line 116 of file LinuxGpio.hxx.

◆ set_off()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::set_off ( )
inlinestatic

Sets output to LOW.

Definition at line 137 of file LinuxGpio.hxx.

◆ set_on()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::set_on ( )
inlinestatic

Sets output to HIGH.

Definition at line 128 of file LinuxGpio.hxx.

◆ set_output()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::set_output ( )
inlinestatic

Sets pin to output.

Definition at line 104 of file LinuxGpio.hxx.

◆ toggle()

template<int PIN_NUM>
static void LinuxGpio< PIN_NUM >::toggle ( )
inlinestatic

Toggles output pin value.

Definition at line 169 of file LinuxGpio.hxx.

Member Data Documentation

◆ PIN

template<int PIN_NUM>
constexpr const uint32_t LinuxGpio< PIN_NUM >::PIN = PIN_NUM
staticconstexpr

Number of the pin.

Definition at line 91 of file LinuxGpio.hxx.


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