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

Laelaps watchdog sub-processor reset class. More...

#include <laeGpio.h>

Inheritance diagram for laelaps::LaeWatchDogReset:
laelaps::LaeGpio

Public Member Functions

 LaeWatchDogReset ()
 Default constructor.
 
virtual ~LaeWatchDogReset ()
 Destructor.
 
virtual void sync ()
 Synchronized this with GPIO hardware state.
 
void reset ()
 Reset the watchdog sub-processor. 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 = 500000
 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 watchdog sub-processor reset class.

Definition at line 257 of file laeGpio.h.

Member Function Documentation

void LaeWatchDogReset::reset ( )

Reset the watchdog sub-processor.

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

Definition at line 267 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().

268 {
269  // lazy one-time synchronization
270  if( m_gpioVal == LaeGpio::UNKNOWN )
271  {
272  sync();
273  }
274 
275  // versions 2.1+ have reset line to watchdog sub-processor
276  if( isConfigured() )
277  {
278  // transition high to low
279  if( writeValue(1) == LAE_OK )
280  {
281  usleep(TTrans);
282  writeValue(0);
283  usleep(TTrans);
284 
285  if( hasValue() == LaeGpio::LOW )
286  {
287  usleep(TReboot);
288  }
289  }
290  }
291 }
low value
Definition: laeGpio.h:84
static const int TReboot
reboot time (usec)
Definition: laeGpio.h:261
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
unknown state value
Definition: laeGpio.h:83
static const int TTrans
signal transition time (usec)
Definition: laeGpio.h:260
virtual int writeValue(const LaeGpio::TriState value)
Write value to gpio.
Definition: laeGpio.h:129
int m_gpioVal
shadowed value
Definition: laeGpio.h:180
virtual void sync()
Synchronized this with GPIO hardware state.
Definition: laeGpio.cxx:256
static const int LAE_OK
not an error, success
Definition: laelaps.h:71

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