VLCB
Loading...
Searching...
No Matches
VLCB::Switch Class Reference

#include <Switch.h>

Public Member Functions

 Switch (byte pin, byte pressedState=LOW)
 Switch ()
 a class to encapsulate a physical pushbutton switch, with non-blocking processing
void setPin (byte pin, byte mode)
void run ()
void reset ()
bool stateChanged ()
bool getState ()
bool isPressed ()
unsigned long getCurrentStateDuration ()
unsigned long getLastStateDuration ()
unsigned long getLastStateChangeTime ()
void resetCurrentDuration ()

Protected Member Functions

byte readPin ()

Protected Attributes

byte _pin
byte _pressedState
byte _currentState
byte _lastState
byte _stateChanged
unsigned long _lastStateChangeTime
unsigned long _lastStateDuration
unsigned long _prevReleaseTime
unsigned long _prevStateDuration

Constructor & Destructor Documentation

◆ Switch() [1/2]

VLCB::Switch::Switch ( byte pin,
byte pressedState = LOW )
explicit

◆ Switch() [2/2]

VLCB::Switch::Switch ( )

a class to encapsulate a physical pushbutton switch, with non-blocking processing

Member Function Documentation

◆ setPin()

void VLCB::Switch::setPin ( byte pin,
byte mode )

◆ run()

void VLCB::Switch::run ( )

◆ reset()

void VLCB::Switch::reset ( )

◆ stateChanged()

bool VLCB::Switch::stateChanged ( )

◆ getState()

bool VLCB::Switch::getState ( )

◆ isPressed()

bool VLCB::Switch::isPressed ( )

◆ getCurrentStateDuration()

unsigned long VLCB::Switch::getCurrentStateDuration ( )

◆ getLastStateDuration()

unsigned long VLCB::Switch::getLastStateDuration ( )

◆ getLastStateChangeTime()

unsigned long VLCB::Switch::getLastStateChangeTime ( )

◆ resetCurrentDuration()

void VLCB::Switch::resetCurrentDuration ( )

◆ readPin()

byte VLCB::Switch::readPin ( )
protected

Member Data Documentation

◆ _pin

byte VLCB::Switch::_pin
protected

◆ _pressedState

byte VLCB::Switch::_pressedState
protected

◆ _currentState

byte VLCB::Switch::_currentState
protected

◆ _lastState

byte VLCB::Switch::_lastState
protected

◆ _stateChanged

byte VLCB::Switch::_stateChanged
protected

◆ _lastStateChangeTime

unsigned long VLCB::Switch::_lastStateChangeTime
protected

◆ _lastStateDuration

unsigned long VLCB::Switch::_lastStateDuration
protected

◆ _prevReleaseTime

unsigned long VLCB::Switch::_prevReleaseTime
protected

◆ _prevStateDuration

unsigned long VLCB::Switch::_prevStateDuration
protected

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