Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps::LaeI2CMuxReset Class Reference

Laelaps I2C multiplexer reset class. More...

#include <laeGpio.h>

Inheritance diagram for laelaps::LaeI2CMuxReset:
laelaps::LaeGpio

Public Member Functions

 LaeI2CMuxReset ()
 Default constructor.
 
virtual ~LaeI2CMuxReset ()
 Destructor.
 
virtual void sync ()
 Synchronized this with GPIO hardware state.
 
void reset ()
 Reset the I2C mulitplex chip. More...
 
- Public Member Functions inherited from laelaps::LaeGpio
 LaeGpio (const std::string &strTag, const int gpio, const LaeGpio::Direction dir)
 Default intialization constructor. More...
 
virtual ~LaeGpio ()
 Destructor.
 
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...
 

Static Public Attributes

static const int TTrans = 10000
 signal transition time (usec)
 
static const int TReboot = 10000
 reboot time (usec)
 

Additional Inherited Members

- Public Types inherited from laelaps::LaeGpio
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...
 
- Protected Member Functions inherited from laelaps::LaeGpio
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 inherited from laelaps::LaeGpio
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)
 

Detailed Description

Laelaps I2C multiplexer reset class.

Definition at line 303 of file laeGpio.h.

Member Function Documentation

void LaeI2CMuxReset::reset ( )

Reset the I2C mulitplex chip.

The reset is caused by a high to low edge trigger.

Definition at line 309 of file laeGpio.cxx.

References laelaps::LaeGpio::hasValue(), laelaps::LaeGpio::isConfigured(), laelaps::LAE_OK, laelaps::LaeGpio::LOW, laelaps::LaeGpio::m_gpioVal, laelaps::LaeGpio::sync(), laelaps::LaeGpio::UNKNOWN, and laelaps::LaeGpio::writeValue().

310 {
311  // lazy one-time synchronization
312  if( m_gpioVal == LaeGpio::UNKNOWN )
313  {
314  sync();
315  }
316 
317  // versions 2.1+ have reset line to watchdog sub-processor
318  if( isConfigured() )
319  {
320  // transition high to low
321  if( writeValue(1) == LAE_OK )
322  {
323  usleep(TTrans);
324  writeValue(0);
325  usleep(TTrans);
326 
327  if( hasValue() == LaeGpio::LOW )
328  {
329  usleep(TReboot);
330  }
331  }
332  }
333 }
low value
Definition: laeGpio.h:84
virtual void sync()
Synchronized this with GPIO hardware state.
Definition: laeGpio.cxx:298
int hasValue() const
Get the current shadowed gpio value.
Definition: laeGpio.h:157
bool isConfigured() const
Is the exported GPIO number configured to match this ojbect?
Definition: laeGpio.h:171
static const int TTrans
signal transition time (usec)
Definition: laeGpio.h:306
unknown state value
Definition: laeGpio.h:83
virtual int writeValue(const LaeGpio::TriState value)
Write value to gpio.
Definition: laeGpio.h:129
static const int TReboot
reboot time (usec)
Definition: laeGpio.h:307
int m_gpioVal
shadowed value
Definition: laeGpio.h:180
static const int LAE_OK
not an error, success
Definition: laelaps.h:71

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