50 #include <sys/types.h> 55 #include "rnr/rnrconfig.h" 72 LaeGpio::LaeGpio(
const std::string &strTag,
75 m_gpioTag(strTag), m_gpioNum(gpio), m_gpioDir(dir)
95 int val = value? 1: 0;
102 LOGDIAG3(
"%s GPIO %d: new value is %d.",
107 LOGERROR(
"%s GPIO %d: Failed to write %d to pin.",
120 if( (val = gpioRead(
m_gpioNum)) != RC_ERROR )
126 LOGDIAG3(
"%s GPIO %d: current value is %d.",
143 gpioMakeDirname(
m_gpioNum, buf,
sizeof(buf));
145 string strValFileName(buf);
146 string strDirFileName(buf);
148 strValFileName +=
"/value";
149 strDirFileName +=
"/direction";
160 return access(strValFileName.c_str(), mode) == 0;
193 wasEnabled = isEnabled();
198 if( !wasEnabled && isEnabled() )
204 bEnabled = isEnabled();
230 bEnabled = isEnabled();
367 bEnabled = isEnabled();
393 bEnabled = isEnabled();
446 bEnabled = isEnabled();
472 bEnabled = isEnabled();
bool disable()
Disable regulated 5V power to top deck.
LaeGpio::Direction m_gpioDir
GPIO direction.
bool enable()
Enable battery power to top deck.
bool isEnabled()
Test if power to motor controllers is enabled.
static const int LAE_ECODE_IO
I/O error.
virtual void sync()
Synchronized this with GPIO hardware state.
virtual void sync()
Synchronized this with GPIO hardware state.
bool disable()
Disable power to motor controllers.
bool enable()
Enable power to motor controllers.
bool isEnabled()
Test if battery power to top deck is enabled.
bool enable()
Enable regulated 5V power to top deck.
int m_gpioNum
exported GPIO number
bool isEnabled()
Test if regulated 5V power to top deck is enabled.
Laelaps Odroid General Purpose I/O class interfaces.
virtual void sync()
Synchronized this with GPIO hardware state.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
virtual void sync()
Synchronized this with GPIO hardware state.
void reset()
Reset the watchdog sub-processor.
int hasValue() const
Get the current shadowed gpio value.
bool isConfigured() const
Is the exported GPIO number configured to match this ojbect?
virtual int readValue(int &value)
Read current value of gpio.
bool checkConfig()
Check if the exported GPIO exists in /sys/class and that it has been configured to match this objects...
bool m_gpioCfg
GPIO is [not] configured (correctly)
bool disable()
Disable battery power to top deck.
virtual int writeValue(const LaeGpio::TriState value)
Write value to gpio.
void reset()
Reset the I2C mulitplex chip.
int m_gpioVal
shadowed value
std::string m_gpioTag
identifying tag
virtual void sync()
Synchronized this with GPIO hardware state.
Top-level package include file.
virtual void sync()
Synchronized this with GPIO hardware state.
static const int LAE_OK
not an error, success