RADLib
RADical C++ application framework
RADDevice::GpioPin Class Reference

GPIO sysfs helper. More...

#include <RADDevice.h>

Public Member Functions

 GpioPin (int number, DevicePaths paths={})
 Creates a GPIO pin wrapper. More...
 
bool exportPin (std::string *error=nullptr) const
 Exports the pin through sysfs. More...
 
bool unexportPin (std::string *error=nullptr) const
 Unexports the pin through sysfs. More...
 
bool setDirection (GpioDirection direction, std::string *error=nullptr) const
 Sets pin direction. More...
 
bool setEdge (GpioEdge edge, std::string *error=nullptr) const
 Sets pin edge mode. More...
 
bool writeValue (bool high, std::string *error=nullptr) const
 Writes 0 or 1. More...
 
RADCore::RADResult< bool > readValue () const
 Reads current value. More...
 
std::string pinPath () const
 Returns sysfs pin directory. More...
 

Detailed Description

GPIO sysfs helper.

Constructor & Destructor Documentation

◆ GpioPin()

RADDevice::GpioPin::GpioPin ( int  number,
DevicePaths  paths = {} 
)

Creates a GPIO pin wrapper.

Member Function Documentation

◆ exportPin()

bool RADDevice::GpioPin::exportPin ( std::string *  error = nullptr) const

Exports the pin through sysfs.

◆ pinPath()

std::string RADDevice::GpioPin::pinPath ( ) const

Returns sysfs pin directory.

◆ readValue()

RADCore::RADResult<bool> RADDevice::GpioPin::readValue ( ) const

Reads current value.

◆ setDirection()

bool RADDevice::GpioPin::setDirection ( GpioDirection  direction,
std::string *  error = nullptr 
) const

Sets pin direction.

◆ setEdge()

bool RADDevice::GpioPin::setEdge ( GpioEdge  edge,
std::string *  error = nullptr 
) const

Sets pin edge mode.

◆ unexportPin()

bool RADDevice::GpioPin::unexportPin ( std::string *  error = nullptr) const

Unexports the pin through sysfs.

◆ writeValue()

bool RADDevice::GpioPin::writeValue ( bool  high,
std::string *  error = nullptr 
) const

Writes 0 or 1.


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