![]() |
ButtonToSwitch Library for Arduino v4.0.1
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
|
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs). More...
#include <ButtonToSwitch.h>
Public Member Functions | |
DblActnLtchMPBttn (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0) | |
Abstract Class constructor. | |
~DblActnLtchMPBttn () | |
Virtual destructor. | |
virtual bool | begin (const unsigned long int &pollDelayMs=_StdPollDelay) |
See DbncdMPBttn::begin(const unsigned long int) | |
void | clrStatus (bool clrIsOn=true) |
See DbncddMPBttn::clrStatus(bool) | |
fncPtrType | getFnWhnTrnOffScndry () |
returns the function that is set to execute every time the object enters the Secondary Off State. | |
fncPtrType | getFnWhnTrnOnScndry () |
Returns the function that is set to execute every time the object enters the Secondary On State. | |
bool | getIsOnScndry () |
Returns the current value of the isOnScndry attribute flag. | |
unsigned long | getScndModActvDly () |
Returns the current value of the scndModActvDly class attribute. | |
void | setFnWhnTrnOffScndryPtr (void(*newFnWhnTrnOff)()) |
Sets the function that will be called to execute every time the object enters the Secondary Off State. | |
void | setFnWhnTrnOnScndryPtr (void(*newFnWhnTrnOn)()) |
Sets the function that will be called to execute every time the object enters the Secondary On State. | |
bool | setScndModActvDly (const unsigned long &newVal) |
Sets a new value for the scndModActvDly class attribute. | |
![]() | |
LtchMPBttn (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0) | |
Class constructor. | |
void | clrStatus (bool clrIsOn=true) |
See DbncdMPBttn::clrStatus(bool) | |
const bool | getIsLatched () const |
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of the object. | |
bool | getTrnOffASAP () |
Returns the value of the trnOffASAP attribute flag. | |
const bool | getUnlatchPend () const |
Returns the value of the "Valid Unlatch Pending" attribute. | |
const bool | getUnlatchRlsPend () const |
Returns the value of the "Valid Unlatch Release Pending" attribute. | |
void | setTrnOffASAP (const bool &newVal) |
Sets the value of the trnOffASAP attribute. | |
void | setUnlatchPend (const bool &newVal) |
Sets the value of the "Valid Unlatch Pending" attribute. | |
void | setUnlatchRlsPend (const bool &newVal) |
Sets the value of the "Valid Unlatch Release Pending" attribute. | |
bool | unlatch () |
Sets the values of the flags needed to unlatch a latched MPB. | |
![]() | |
DbncdDlydMPBttn () | |
Default constructor. | |
DbncdDlydMPBttn (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0) | |
Class constructor. | |
bool | init (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0) |
see DbncdMPBttn::init(const uint8_t, const bool, const bool, const unsigned long int) | |
void | setStrtDelay (const unsigned long int &newStrtDelay) |
Sets a new value to the "Start Delay" strtDelay attribute. | |
![]() | |
DbncdMPBttn () | |
Default class constructor. | |
DbncdMPBttn (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0) | |
Class constructor. | |
virtual | ~DbncdMPBttn () |
Default virtual destructor. | |
void | clrStatus (bool clrIsOn=true) |
Clears and resets flags, timers and counters modified through the object's signals processing. | |
void | disable () |
Disables the input signal processing, ignoring the changes of its values. | |
void | enable () |
Enables the input signal processing. | |
bool | end () |
Detaches the object from the timer that monitors the input pins, compute and updates the object's status. | |
const unsigned long int | getCurDbncTime () const |
Returns the current debounce period time set for the object. | |
fncPtrType | getFnWhnTrnOff () |
Returns the function that is set to execute every time the object enters the Off State. | |
fncPtrType | getFnWhnTrnOn () |
Returns the function that is set to execute every time the object enters the On State. | |
const bool | getIsEnabled () const |
Returns the value of the isEnabled attribute flag, indicating the Enabled or Disabled status of the object. | |
const bool | getIsOn () const |
Returns the value of the isOn attribute flag. | |
const bool | getIsOnDisabled () const |
Returns the value of the isOnDisabled attribute. | |
const unsigned long int | getLstPollTime () |
Returns the time stamp of the last state update for the object. | |
const uint32_t | getOtptsSttsPkgd () |
Returns the relevant attribute flags values for the object state encoded as a 32 bits value. | |
const bool | getOutputsChange () const |
Returns the value of the outputsChange attribute flag. | |
const unsigned long int | getPollPeriodMs () |
Returns the poll period time setting attribute's value. | |
unsigned long int | getStrtDelay () |
Returns the current value of strtDelay attribute. | |
bool | getUpdTmrAttchd () |
Returns the value of the Attached to the update timer attribute. | |
bool | init (const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0) |
Initializes an object instantiated by the default constructor. | |
bool | pause () |
Pauses the software timer updating the computation of the object's internal flags value (object's state). | |
void | resetDbncTime () |
Resets the debounce process time of the object to the value used at instantiation. | |
void | resetFda () |
Resets the MPB behavior automaton to it's Initial or Start State | |
bool | resume () |
Restarts the software timer updating the calculation of the object internal flags. | |
bool | setDbncTime (const unsigned long int &newDbncTime) |
Sets the debounce process time. | |
void | setFnWhnTrnOffPtr (void(*newFnWhnTrnOff)()) |
Sets the function that will be called to execute every time the object enters the Off State. | |
void | setFnWhnTrnOnPtr (void(*newFnWhnTrnOn)()) |
Sets the function that will be called to execute every time the object enters the On State. | |
void | setIsOnDisabled (const bool &newIsOnDisabled) |
Sets the value of the isOnDisabled attribute. | |
void | setOutputsChange (bool newOutputsChange) |
Sets the value of the attribute flag indicating if a change took place in any of the output attribute flags (IsOn included). | |
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs).
Double Action Latched DD-MPB are MPBs whose distinctive characteristic is that implement switches that present different behaviors based on the time length of the presses detected and the sequence of the presses. The pattern selected for this class is the following:
The presses patterns are:
DblActnLtchMPBttn::DblActnLtchMPBttn | ( | const uint8_t & | mpbttnPin, |
const bool & | pulledUp = true, | ||
const bool & | typeNO = true, | ||
const unsigned long int & | dbncTimeOrigSett = 0, | ||
const unsigned long int & | strtDelay = 0 ) |
Abstract Class constructor.
fncPtrType DblActnLtchMPBttn::getFnWhnTrnOffScndry | ( | ) |
returns the function that is set to execute every time the object enters the Secondary Off State.
The function to be executed is an attribute that might be modified by the setFnWhnTrnOffScndryPtr() method.
nullptr | if there is no function set to execute when the object enters the Secondary Off State. |
fncPtrType DblActnLtchMPBttn::getFnWhnTrnOnScndry | ( | ) |
Returns the function that is set to execute every time the object enters the Secondary On State.
The function to be executed is an attribute that might be modified by the setFnWhnTrnOnScndryPtr() method.
nullptr | if there is no function set to execute when the object enters the Secondary On State. |
bool DblActnLtchMPBttn::getIsOnScndry | ( | ) |
Returns the current value of the isOnScndry attribute flag.
The isOnScndry attribute flag holds the secondary On state, when the MPB is pressed for the seted long press time from the Off-Off or the On-Off state as described in the DblActnLtchMPBttn class.
unsigned long DblActnLtchMPBttn::getScndModActvDly | ( | ) |
Returns the current value of the scndModActvDly class attribute.
The scndModActvDly attribute defines the time length a MPB must remain pressed to consider it a long press, needed to activate the secondary mode.
void DblActnLtchMPBttn::setFnWhnTrnOffScndryPtr | ( | void(* | newFnWhnTrnOff )() | ) |
Sets the function that will be called to execute every time the object enters the Secondary Off State.
The function to be executed must be of the form void (*newFnWhnTrnOff)(), meaning it must take no arguments and must return no value, it will be executed only once by the object (recursion must be handled with the usual precautions). When instantiated the attribute value is set to nullptr.
newFnWhnTrnOff | Function pointer to the function intended to be called when the object enters the Secondary Off State. Passing nullptr as parameter deactivates the function execution mechanism. |
void DblActnLtchMPBttn::setFnWhnTrnOnScndryPtr | ( | void(* | newFnWhnTrnOn )() | ) |
Sets the function that will be called to execute every time the object enters the Secondary On State.
The function to be executed must be of the form void (*newFnWhnTrnOff)(), meaning it must take no arguments and must return no value, it will be executed only once by the object (recursion must be handled with the usual precautions). When instantiated the attribute value is set to nullptr.
newFnWhnTrnOn | function pointer to the function intended to be called when the object enters the Secondary On State. Passing nullptr as parameter deactivates the function execution mechanism. |
bool DblActnLtchMPBttn::setScndModActvDly | ( | const unsigned long & | newVal | ) |
Sets a new value for the scndModActvDly class attribute.
The scndModActvDly attribute defines the time length a MPB must remain pressed after the end of the debounce&delay period to consider it a long press, needed to activate the secondary mode. The value setting must be newVal >= _MinSrvcTime to ensure correct signal processing. See TmLtchMPBttn::setSrvcTime(const unsigned long int) for details.
newVal | The new value for the scndModActvDly attribute. |
true | The new value is in the valid range, the value was updated. |
false | The new value is not in the valid range, the value was not updated. |