LTPS C++ API
Public Member Functions | List of all members
Gpio Class Reference

Class for GPIO manipulations. More...

#include <gpio.h>

Public Member Functions

int setDirection (const char *pin, int direction)
 Set direction. More...
 
void setDirections (int lsbPins, int msbPins, int lsbDirs, int msbDirs)
 Set directions for all pins simultaneously (see bit arithmetic) More...
 
int getDirection (const char *pin)
 Get direction. More...
 
void getDirections (int &lsbDirs, int &msbDirs)
 Get directions for all pins simultaneously (see bit arithmetic) More...
 
GpioReturn getDirections ()
 Get directions for all pins simultaneously. More...
 
int setValue (const char *pin, unsigned int value)
 Set value. More...
 
void setValues (int lsbPins, int msbPins, int lsbValues, int msbValues)
 Set values for all pins simultaneously (see bit arithmetic) More...
 
unsigned int getValue (const char *pin)
 Get value. More...
 
void getValues (int &lsbValues, int &msbValues)
 Get values for all pins simultaneously (see bit arithmetic) More...
 
GpioReturn getValues ()
 Get directions for all pins simultaneously. More...
 
unsigned int getPinNumber (const char *pin)
 Get CPU pin number. More...
 

Detailed Description

Class for GPIO manipulations.

Examples:
gpio.cpp.

Member Function Documentation

int Gpio::getDirection ( const char *  pin)

Get direction.

Parameters
pinString name of pin (eg: S1A, S9D)
Returns
Pin direction (0 for input, 1 for output)
Examples:
gpio.cpp.
void Gpio::getDirections ( int &  lsbDirs,
int &  msbDirs 
)

Get directions for all pins simultaneously (see bit arithmetic)

Parameters
lsbDirsDirections for first group: pins S1A...S15D (0 for input, 1 for output)
msbDirsDirections for second group: pins S17A...S25D (0 for input, 1 for output)
GpioReturn Gpio::getDirections ( )

Get directions for all pins simultaneously.

Returns
GpioReturn structure
unsigned int Gpio::getPinNumber ( const char *  pin)

Get CPU pin number.

Parameters
pinString name of pin (eg: S1A, S9D)
Returns
CPU pin number
unsigned int Gpio::getValue ( const char *  pin)

Get value.

Parameters
pinString name of pin (eg: S1A, S9D)
Returns
Pin value (0 or 1)
Examples:
gpio.cpp.
void Gpio::getValues ( int &  lsbValues,
int &  msbValues 
)

Get values for all pins simultaneously (see bit arithmetic)

Parameters
lsbValuesValues for first group: pins S1A...S15D (0 for input, 1 for output)
msbValuesValues for second group: pins S17A...S25D (0 for input, 1 for output)
GpioReturn Gpio::getValues ( )

Get directions for all pins simultaneously.

Returns
GpioReturn structure
int Gpio::setDirection ( const char *  pin,
int  direction 
)

Set direction.

Parameters
pinString name of pin (eg: S1A, S9D)
directionPin direction (0 for input, 1 for output)
Returns
Result (0 on success)
Examples:
gpio.cpp.
void Gpio::setDirections ( int  lsbPins,
int  msbPins,
int  lsbDirs,
int  msbDirs 
)

Set directions for all pins simultaneously (see bit arithmetic)

Parameters
lsbPinsApplicable bits: pins S1A...S15D (LSB bit 0 - pin S1A, bit 1 - pin S1B,.., MSB bit 31 - pin S15D)
msbPinsApplicable bits: pins S17A..S25C (LSB bit 0 - pin S17A, bit 1 - pin S17B,..., MSB bit 18 - pin S25D)
lsbDirsDirections for first group: pins S1A...S15D (0 for input, 1 for output)
msbDirsDirections for second group: pins S17A...S25D (0 for input, 1 for output)
int Gpio::setValue ( const char *  pin,
unsigned int  value 
)

Set value.

Parameters
pinString name of pin (eg: S1A, S9D)
valuePin value (0 or 1)
Returns
Result (< 0 on error)
Examples:
gpio.cpp.
void Gpio::setValues ( int  lsbPins,
int  msbPins,
int  lsbValues,
int  msbValues 
)

Set values for all pins simultaneously (see bit arithmetic)

Parameters
lsbPinsApplicable bits: pins S1A...S15D (LSB bit 0 - pin S1A, bit 1 - pin S1B,.., MSB bit 31 - pin S15D)
msbPinsApplicable bits: pins S17A..S25C (LSB bit 0 - pin S17A, bit 1 - pin S17B,..., MSB bit 18 - pin S25D)
lsbValuesValues for first group: pins S1A...S15D (0 or 1)
msbValuesValues for second group: pins S17A...S25D (0 or 1)

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