Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
BlackCoreGPIO Class Referenceabstract

Preparation phase of Beaglebone Black, for using gpio pins. More...

#include <BlackLib.h>

Inheritance diagram for BlackCoreGPIO:
BlackCore BlackGPIO

Public Member Functions

 BlackCoreGPIO ()
 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 triggerInitialization (gpio_name pin, gpio_type type)
 Executes initialization. More...
 
std::string getDirectionFilePath ()
 Exports direction 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...
 
std::string initialize (gpio_name pin, gpio_type type)
 Performs initialization for using Beaglebone Black's gpio pins. More...
 
bool doExport ()
 Exports pin. More...
 
bool setDirection ()
 Sets the pin direction. More...
 
bool doUnexport ()
 Unexports pin to release it. More...
 
- Private Member Functions inherited from 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 type 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...
 
bool isInitializeBefore
 is used to hold initialization status More...
 

Additional Inherited Members

- Private Types inherited from 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
}
 

Detailed Description

Preparation phase of Beaglebone Black, for using gpio pins.

This class is core of the BlackGPIO class. It includes private functions which set Beaglebone Black for using gpio pins, and protected functions which are using for triggering initialization from derived class and pass variables to derived class.

Constructor & Destructor Documentation

BlackCoreGPIO::BlackCoreGPIO ( )

Constructor of BlackCoreGPIO class.

Initializes errorCoreGPIO struct and isInitializeBefore variable.

BlackCoreGPIO::~BlackCoreGPIO ( )
virtual

Destructor of BlackCoreGPIO class.

This function unexports pin.

Member Function Documentation

bool BlackCoreGPIO::doExport ( )
private

Exports pin.

This function exports pin to use it. This step is necessary.

Returns
True if exporting is successful, else false.
bool 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 BlackCoreGPIO::getDirectionFilePath ( )
protected

Exports direction file path to derived class.

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

Exports errorCoreGPIO struct to derived class.

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

First declaration of this function.

Implemented in BlackGPIO.

std::string BlackCoreGPIO::initialize ( gpio_name  pin,
gpio_type  type 
)
private

Performs initialization for using Beaglebone Black's gpio pins.

This function sets filename variables, by value of input pin name variable. Then calls doExport() function and if it returns true, calls setDirection() function. This function only can be called from triggerInitialization() function.

Parameters
[in]pingpio pin name (enum),(GPIO_x)
[in]typegpio pin type (enum),(input/output)
Returns
string type fail or successful message.
See Also
doExport()
setDirection()
triggerInitialization()
bool 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 BlackCore.

bool BlackCoreGPIO::setDirection ( )
private

Sets the 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.
std::string BlackCoreGPIO::triggerInitialization ( gpio_name  pin,
gpio_type  type 
)
protected

Executes initialization.

This function checks pin file, to ensure about pin is exported or not, and then checks isInitializeBefore variable. Then it performs initialization or does nothing, by value of this variable.

Parameters
[in]pingpio pin name (enum),(GPIO_x)
[in]typegpio pin type (enum),(input/output)
Returns
initialize() function's return value or fail message.
See Also
initialize()
isInitializeBefore

Member Data Documentation

std::string BlackCoreGPIO::directionPath
private

is used to hold the direction file path

std::string BlackCoreGPIO::expPath
private

is used to hold the export file path

errorCoreGPIO* BlackCoreGPIO::gpioCoreError
private

is used to hold the errors of BlackCoreGPIO class

bool BlackCoreGPIO::isInitializeBefore
private

is used to hold initialization status

int BlackCoreGPIO::pinNumericName
private

is used to hold the selected pin number

int BlackCoreGPIO::pinNumericType
private

is used to hold the selected pin type

std::string BlackCoreGPIO::unExpPath
private

is used to hold the unexport file path


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