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

Laelaps top deck auxilliary regulated 5V power out enable class. More...

#include <laeGpio.h>

Inheritance diagram for laelaps::LaeAux5VOutEnable:
laelaps::LaeGpio

Public Member Functions

 LaeAux5VOutEnable ()
 Default constructor.
 
virtual ~LaeAux5VOutEnable ()
 Destructor.
 
virtual void sync ()
 Synchronized this with GPIO hardware state.
 
bool enable ()
 Enable regulated 5V power to top deck. More...
 
bool disable ()
 Disable regulated 5V power to top deck. More...
 
bool isEnabled ()
 Test if regulated 5V power to top deck is enabled. 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...
 

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 top deck auxilliary regulated 5V power out enable class.

Definition at line 402 of file laeGpio.h.

Member Function Documentation

bool LaeAux5VOutEnable::disable ( )

Disable regulated 5V power to top deck.

Returns
Returns true if power is enabled, false otherwise.

Definition at line 456 of file laeGpio.cxx.

References laelaps::LaeGpio::isConfigured(), laelaps::LaeGpio::m_gpioNum, laelaps::LaeGpio::m_gpioTag, laelaps::LaeGpio::m_gpioVal, laelaps::LaeGpio::sync(), laelaps::LaeGpio::UNKNOWN, and laelaps::LaeGpio::writeValue().

457 {
458  bool bEnabled;
459 
460  // lazy one-time synchronization
461  if( m_gpioVal == LaeGpio::UNKNOWN )
462  {
463  sync();
464  }
465 
466  // versions 2.1+ have regulated 5V power enable to top deck
467  if( isConfigured() )
468  {
469  writeValue(0);
470  }
471 
472  bEnabled = isEnabled();
473 
474  if( !bEnabled )
475  {
476  LOGDIAG2("%s (GPIO %d) disabled.", m_gpioTag.c_str(), m_gpioNum);
477  }
478 
479  return bEnabled;
480 }
virtual void sync()
Synchronized this with GPIO hardware state.
Definition: laeGpio.cxx:419
int m_gpioNum
exported GPIO number
Definition: laeGpio.h:178
bool isEnabled()
Test if regulated 5V power to top deck is enabled.
Definition: laeGpio.cxx:482
bool isConfigured() const
Is the exported GPIO number configured to match this ojbect?
Definition: laeGpio.h:171
unknown state value
Definition: laeGpio.h:83
virtual int writeValue(const LaeGpio::TriState value)
Write value to gpio.
Definition: laeGpio.h:129
int m_gpioVal
shadowed value
Definition: laeGpio.h:180
std::string m_gpioTag
identifying tag
Definition: laeGpio.h:177
bool LaeAux5VOutEnable::enable ( )

Enable regulated 5V power to top deck.

Returns
Returns true if power is enabled, false otherwise.

Definition at line 430 of file laeGpio.cxx.

References laelaps::LaeGpio::isConfigured(), laelaps::LaeGpio::m_gpioNum, laelaps::LaeGpio::m_gpioTag, laelaps::LaeGpio::m_gpioVal, laelaps::LaeGpio::sync(), laelaps::LaeGpio::UNKNOWN, and laelaps::LaeGpio::writeValue().

431 {
432  bool bEnabled;
433 
434  // lazy one-time synchronization
435  if( m_gpioVal == LaeGpio::UNKNOWN )
436  {
437  sync();
438  }
439 
440  // versions 2.1+ have regulated 5V power enable to top deck
441  if( isConfigured() )
442  {
443  writeValue(1);
444  }
445 
446  bEnabled = isEnabled();
447 
448  if( bEnabled )
449  {
450  LOGDIAG2("%s (GPIO %d) enabled.", m_gpioTag.c_str(), m_gpioNum);
451  }
452 
453  return bEnabled;
454 }
virtual void sync()
Synchronized this with GPIO hardware state.
Definition: laeGpio.cxx:419
int m_gpioNum
exported GPIO number
Definition: laeGpio.h:178
bool isEnabled()
Test if regulated 5V power to top deck is enabled.
Definition: laeGpio.cxx:482
bool isConfigured() const
Is the exported GPIO number configured to match this ojbect?
Definition: laeGpio.h:171
unknown state value
Definition: laeGpio.h:83
virtual int writeValue(const LaeGpio::TriState value)
Write value to gpio.
Definition: laeGpio.h:129
int m_gpioVal
shadowed value
Definition: laeGpio.h:180
std::string m_gpioTag
identifying tag
Definition: laeGpio.h:177
bool LaeAux5VOutEnable::isEnabled ( )

Test if regulated 5V power to top deck is enabled.

Returns
Returns true if power is enabled, false otherwise.

Definition at line 482 of file laeGpio.cxx.

References laelaps::LaeGpio::hasValue(), laelaps::LaeGpio::HIGH, laelaps::LaeGpio::m_gpioVal, laelaps::LaeGpio::sync(), and laelaps::LaeGpio::UNKNOWN.

483 {
484  // lazy one-time synchronization
485  if( m_gpioVal == LaeGpio::UNKNOWN )
486  {
487  sync();
488  }
489 
490  return hasValue() == LaeGpio::HIGH;
491 }
virtual void sync()
Synchronized this with GPIO hardware state.
Definition: laeGpio.cxx:419
int hasValue() const
Get the current shadowed gpio value.
Definition: laeGpio.h:157
unknown state value
Definition: laeGpio.h:83
high value
Definition: laeGpio.h:85
int m_gpioVal
shadowed value
Definition: laeGpio.h:180

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