![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
Laelaps Odroid GPIO base class. More...
#include <laeGpio.h>
Public Types | |
enum | TriState { UNKNOWN = -1, LOW = 0, HIGH = 1 } |
GPIO tri-state value. More... | |
enum | Direction { INPUT = GPIO_DIR_IN, OUTPUT = GPIO_DIR_OUT } |
GPIO direction. More... | |
Public Member Functions | |
LaeGpio (const std::string &strTag, const int gpio, const LaeGpio::Direction dir) | |
Default intialization constructor. More... | |
virtual | ~LaeGpio () |
Destructor. | |
virtual void | sync () |
Synchronized this with GPIO hardware state. | |
virtual int | writeValue (const LaeGpio::TriState value) |
Write value to gpio. More... | |
virtual int | writeValue (const int value) |
Write value to gpio. More... | |
virtual int | readValue (int &value) |
Read current value of gpio. More... | |
int | hasValue () const |
Get the current shadowed gpio value. More... | |
bool | isConfigured () const |
Is the exported GPIO number configured to match this ojbect? More... | |
Protected Member Functions | |
bool | checkConfig () |
Check if the exported GPIO exists in /sys/class and that it has been configured to match this objects configuration. More... | |
Protected Attributes | |
std::string | m_gpioTag |
identifying tag | |
int | m_gpioNum |
exported GPIO number | |
LaeGpio::Direction | m_gpioDir |
GPIO direction. | |
int | m_gpioVal |
shadowed value | |
bool | m_gpioCfg |
GPIO is [not] configured (correctly) | |
Laelaps Odroid GPIO base class.
enum laelaps::LaeGpio::Direction |
enum laelaps::LaeGpio::TriState |
LaeGpio::LaeGpio | ( | const std::string & | strTag, |
const int | gpio, | ||
const LaeGpio::Direction | dir | ||
) |
Default intialization constructor.
No file I/O operations are perform.
strTag | Tag identifier associated with GPIO pin. |
gpio | Exported GPIO number. |
dir | GPIO direction. |
Definition at line 72 of file laeGpio.cxx.
References m_gpioCfg, m_gpioVal, and UNKNOWN.
|
protected |
|
inline |
Get the current shadowed gpio value.
Definition at line 157 of file laeGpio.h.
References m_gpioVal.
Referenced by laelaps::LaeMotorCtlrEnable::isEnabled(), laelaps::LaeAuxBattOutEnable::isEnabled(), laelaps::LaeAux5VOutEnable::isEnabled(), laelaps::LaeWatchDogReset::reset(), and laelaps::LaeI2CMuxReset::reset().
|
inline |
Is the exported GPIO number configured to match this ojbect?
Ass Laelaps evolves, the test can distinguish between different platform versions. For example, Laelaps 2.0 does not have a gpio pin dedicated to enabling power to the motor controllers, while subsequent version do.
Definition at line 171 of file laeGpio.h.
References m_gpioCfg.
Referenced by laelaps::LaeMotorCtlrEnable::disable(), laelaps::LaeAuxBattOutEnable::disable(), laelaps::LaeAux5VOutEnable::disable(), laelaps::LaeMotorCtlrEnable::enable(), laelaps::LaeAuxBattOutEnable::enable(), laelaps::LaeAux5VOutEnable::enable(), laelaps::LaeWatchDogReset::reset(), laelaps::LaeI2CMuxReset::reset(), sync(), laelaps::LaeMotorCtlrEnable::sync(), laelaps::LaeWatchDogReset::sync(), laelaps::LaeI2CMuxReset::sync(), laelaps::LaeAuxBattOutEnable::sync(), and laelaps::LaeAux5VOutEnable::sync().
|
virtual |
Read current value of gpio.
[out] | value | LOW/HIGH integer value. |
Definition at line 115 of file laeGpio.cxx.
References laelaps::LAE_ECODE_IO, laelaps::LAE_OK, m_gpioNum, m_gpioTag, and m_gpioVal.
Referenced by sync(), and writeValue().
|
inlinevirtual |
Write value to gpio.
value | LOW/HIGH tri-state value. |
Definition at line 129 of file laeGpio.h.
References readValue().
Referenced by laelaps::LaeMotorCtlrEnable::disable(), laelaps::LaeAuxBattOutEnable::disable(), laelaps::LaeAux5VOutEnable::disable(), laelaps::LaeMotorCtlrEnable::enable(), laelaps::LaeAuxBattOutEnable::enable(), laelaps::LaeAux5VOutEnable::enable(), laelaps::LaeWatchDogReset::reset(), and laelaps::LaeI2CMuxReset::reset().
|
virtual |
Write value to gpio.
value | LOW/HIGH integer value. |
Definition at line 92 of file laeGpio.cxx.
References laelaps::LAE_ECODE_IO, laelaps::LAE_OK, m_gpioNum, m_gpioTag, and m_gpioVal.