BlackLib::BlackCoreGPIO Class Referenceabstract

Preparation phase of Beaglebone Black, to use GPIO. More...

#include <BlackGPIO.h>

Inheritance diagram for BlackLib::BlackCoreGPIO:

Public Member Functions

 BlackCoreGPIO (gpioName pin, direction dir)
 Constructor of BlackCoreGPIO class. More...
 
virtual ~BlackCoreGPIO ()
 Destructor of BlackCoreGPIO class. More...
 
virtual std::string getValue ()=0
 First declaration of this function. More...
 

Protected Member Functions

std::string getDirectionFilePath ()
 Exports direction file path to derived class. More...
 
std::string getValueFilePath ()
 Exports value file path to derived class. More...
 
errorCoreGPIOgetErrorsFromCoreGPIO ()
 Exports errorCoreGPIO struct to derived class. More...
 

Private Member Functions

bool loadDeviceTree ()
 Device tree loading is not necessary for using GPIO feature. More...
 
bool doExport ()
 Exports pin. More...
 
bool setDirection ()
 Sets pin direction. More...
 
bool doUnexport ()
 Unexports pin to release it. More...
 
- Private Member Functions inherited from BlackLib::BlackCore
 BlackCore ()
 Constructor of BlackCore class. More...
 
virtual ~BlackCore ()
 Destructor of BlackCore class. More...
 
std::string searchDirectoryOcp (BlackCore::ocpSearch searchThis)
 Searches ocp directory to find specified file/directory. More...
 
errorCoregetErrorsFromCore ()
 Exports errorCore struct to derived class. More...
 
std::string getCapeMgrName ()
 Exports capemgr name to derived class. More...
 
std::string getOcpName ()
 Exports ocp name to derived class. More...
 
std::string getSlotsFilePath ()
 Exports slots file path to derived class. More...
 

Private Attributes

errorCoreGPIOgpioCoreError
 is used to hold the errors of BlackCoreGPIO class More...
 
int pinNumericName
 is used to hold the selected pin number More...
 
int pinNumericType
 is used to hold the selected pin direction More...
 
std::string expPath
 is used to hold the export file path More...
 
std::string directionPath
 is used to hold the direction file path More...
 
std::string unExpPath
 is used to hold the unexport file path More...
 

Additional Inherited Members

- Private Types inherited from BlackLib::BlackCore
enum  ocpSearch {
  ADC_helper = 0,
  PWM_P8_13 = 1,
  PWM_P8_19 = 2,
  PWM_P9_14 = 3,
  PWM_P9_16 = 4,
  PWM_P9_21 = 5,
  PWM_P9_22 = 6,
  PWM_P9_42 = 7,
  SPI0 = 8,
  SPI1 = 9
}
 

Detailed Description

Preparation phase of Beaglebone Black, to use GPIO.

This class is core of the BlackGPIO class. It includes private functions which are doing base processes for using gpio pins, and protected functions which are using for exporting private variables to derived class(es).

Constructor & Destructor Documentation

BlackLib::BlackCoreGPIO::BlackCoreGPIO ( gpioName  pin,
direction  dir 
)

Constructor of BlackCoreGPIO class.

This function initializes errorCoreGPIO struct, sets file path variables and calls exporting and setting direction functions.

See also
BlackCoreGPIO::doExport()
BlackCoreGPIO::setDirection()
gpioName
direction
BlackLib::BlackCoreGPIO::~BlackCoreGPIO ( )
virtual

Destructor of BlackCoreGPIO class.

This function unexports pin and deletes errorCoreGPIO struct pointer.

Member Function Documentation

bool BlackLib::BlackCoreGPIO::doExport ( )
private

Exports pin.

This function exports pin. This step is necessary.

Returns
True if exporting is successful, else false.
bool BlackLib::BlackCoreGPIO::doUnexport ( )
private

Unexports pin to release it.

This function is reverse of pin exporting. But this step is not necessary.

Returns
True if unexporting is successful, else false.
std::string BlackLib::BlackCoreGPIO::getDirectionFilePath ( )
protected

Exports direction file path to derived class.

Returns
BlackCoreGPIO::directionPath variable.
errorCoreGPIO * BlackLib::BlackCoreGPIO::getErrorsFromCoreGPIO ( )
protected

Exports errorCoreGPIO struct to derived class.

Returns
errorCoreGPIO struct pointer.
virtual std::string BlackLib::BlackCoreGPIO::getValue ( )
pure virtual

First declaration of this function.

Implemented in BlackLib::BlackGPIO.

std::string BlackLib::BlackCoreGPIO::getValueFilePath ( )
protected

Exports value file path to derived class.

Returns
BlackCoreGPIO::valuePath variable.
bool BlackLib::BlackCoreGPIO::loadDeviceTree ( )
privatevirtual

Device tree loading is not necessary for using GPIO feature.

But this function have to declare in this class again. Because it is a pure virtual function. It does nothing.

Returns
false all time.

Implements BlackLib::BlackCore.

bool BlackLib::BlackCoreGPIO::setDirection ( )
private

Sets pin direction.

This function sets pin direction to input or output. Pin directions are input at default.

Returns
True if setting direction is successful, else false.

Member Data Documentation

std::string BlackLib::BlackCoreGPIO::directionPath
private

is used to hold the direction file path

std::string BlackLib::BlackCoreGPIO::expPath
private

is used to hold the export file path

errorCoreGPIO* BlackLib::BlackCoreGPIO::gpioCoreError
private

is used to hold the errors of BlackCoreGPIO class

int BlackLib::BlackCoreGPIO::pinNumericName
private

is used to hold the selected pin number

int BlackLib::BlackCoreGPIO::pinNumericType
private

is used to hold the selected pin direction

std::string BlackLib::BlackCoreGPIO::unExpPath
private

is used to hold the unexport file path


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