![]() |
ButtonToSwitch Library for ESP32 (Arduino) v4.4.0
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
|
Abstract class, base to model Voidable DD-MPBs (VDD-MPB). More...
#include <ButtonToSwitch_ESP32.h>
Public Member Functions | |
VdblMPBttn () | |
Default constructor. | |
VdblMPBttn (const int8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0, const bool &isOnDisabled=false) | |
Class constructor. | |
virtual | ~VdblMPBttn () |
Default virtual destructor. | |
void | clrStatus (bool clrIsOn=true) |
See DbncdMPBttn::clrStatus(bool) | |
fncPtrType | getFnWhnTrnOffVdd () |
Returns the function that is set to execute every time the object exits the Voided State. | |
fncPtrType | getFnWhnTrnOnVdd () |
Returns the function that is set to execute every time the object enters the Voided or "Voided On" State. | |
bool | getFrcOtptLvlWhnVdd () |
Returns the value of the frcOtptLvlWhnVdd attribute. | |
const bool | getIsVoided () const |
Returns the current value of the isVoided attribute flag. | |
bool | getStOnWhnOtpFrcd () |
Returns the value of the frcOtptLvlWhnVdd attribute. | |
void | setFnWhnTrnOffVddPtr (void(*newFnWhnTrnOff)()) |
Sets the function that will be called to execute every time the object's isVoided attribute flag is reset. | |
void | setFnWhnTrnOnVddPtr (void(*newFnWhnTrnOn)()) |
Sets the function that will be called to execute every time the object's isVoided attribute flag is set. | |
bool | setIsNotVoided () |
Sets the value of the isVoided attribute flag to false. | |
bool | setIsVoided () |
Sets the value of the isVoided attribute flag to true. | |
![]() | |
DbncdDlydMPBttn () | |
Default constructor. | |
DbncdDlydMPBttn (const int8_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 int8_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 int8_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 int8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0) | |
Class constructor. | |
virtual | ~DbncdMPBttn () |
Default virtual destructor. | |
virtual bool | begin (const unsigned long int &pollDelayMs=_StdPollDelay) |
Attaches the instantiated object to a timer that monitors the input pins and updates the object status. | |
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. The timer daemon entry is deleted for the object. | |
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 flag. | |
const uint32_t | getOtptsSttsPkgd () |
Returns the relevant attribute flags values for the object state encoded as a 32 bits value, required to pass current state of the object to another thread/task managing the outputs. | |
const bool | getOutputsChange () const |
Returns the value of the outputsChange attribute flag. | |
unsigned long int | getStrtDelay () |
Returns the current value of the outputs change task unblocking trigger (outputsChngTskTrggr) attribute flag. | |
const TaskHandle_t | getTaskToNotify () const |
Returns the task to be notified by the object when its output flags changes. | |
const TaskHandle_t | getTaskWhileOn () |
Returns the task to be run (resumed) while the object is in the On state. | |
bool | init (const int8_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. | |
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 () |
Resets the outputs change task unblocking trigger (outputsChngTskTrggr) attribute flag. | |
void | setBeginDisabled (const bool &newBeginDisabled=false) |
Sets the starting isDisabled state. | |
bool | setDbncTime (const unsigned long int &newDbncTime) |
Sets the debounce process time. | |
void | setFnWhnTrnOffPtr (fncPtrType newFnWhnTrnOff) |
Sets the function that will be called to execute every time the object enters the Off State. | |
void | setFnWhnTrnOnPtr (fncPtrType 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 flag. | |
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). | |
void | setTaskToNotify (const TaskHandle_t &newTaskHandle) |
Sets the handle to the task to be notified by the object when its output attribute flags changes. | |
virtual void | setTaskWhileOn (const TaskHandle_t &newTaskHandle) |
Sets the task to be run while the object is in the On state. | |
Abstract class, base to model Voidable DD-MPBs (VDD-MPB).
Voidable DD-MPBs are MPBs whose distinctive characteristic is that implement non-latching switches that while being pressed their state might change from On State to a Voided state due to different voiding conditions. Depending on the classes the voided state might be Voided & Off state, Voided & On state or Voided & Not enforced states. Those conditions to change to a voided state include -but are not limited to- the following conditions:
The mechanisms to "un-void" the MPB and return it to an operational state include -but are not limited to- the following actions:
The voiding conditions and the un-voiding mechanisms define the VDD-MPB subclasses.
VdblMPBttn::VdblMPBttn | ( | const int8_t & | mpbttnPin, |
const bool & | pulledUp = true, | ||
const bool & | typeNO = true, | ||
const unsigned long int & | dbncTimeOrigSett = 0, | ||
const unsigned long int & | strtDelay = 0, | ||
const bool & | isOnDisabled = false ) |
Class constructor.
isOnDisabled | (Optional) Sets the instantiation value for the isOnDisabled flag attribute. |
fncPtrType VdblMPBttn::getFnWhnTrnOffVdd | ( | ) |
Returns the function that is set to execute every time the object exits the Voided State.
The function to be executed is an attribute that might be modified by the setFnWhnTrnOffVddPtr() method.
nullptr | if there is no function set to execute when the object enters the Unvoided (or "Voided Off") State. |
fncPtrType VdblMPBttn::getFnWhnTrnOnVdd | ( | ) |
Returns the function that is set to execute every time the object enters the Voided or "Voided On" State.
The function to be executed is an attribute that might be modified by the setFnWhnTrnOnVddPtr() method.
nullptr | if there is no function set to execute when the object enters the Voided State. |
bool VdblMPBttn::getFrcOtptLvlWhnVdd | ( | ) |
Returns the value of the frcOtptLvlWhnVdd attribute.
The frcOtptLvlWhnVdd (Force Output Level When Voided) attribute configures the object to either keep it's isOn attribute flag current value when entering the voided state (false) or to force it to a specific isOn value (true).
const bool VdblMPBttn::getIsVoided | ( | ) | const |
Returns the current value of the isVoided attribute flag.
true | The object is in voided state |
false | The object is in not voided state |
bool VdblMPBttn::getStOnWhnOtpFrcd | ( | ) |
Returns the value of the frcOtptLvlWhnVdd attribute.
The frcOtptLvlWhnVdd (Force Output Level When Voided) attribute configures the object to either keep it's isOn attribute flag current value when entering the voided state (false) or to force it to a specific isOn value (true).
If the object is set to force to a specific isOn value (true), the forced value to be set will be determined by the stOnWhnOtptFrcd attribute.
void VdblMPBttn::setFnWhnTrnOffVddPtr | ( | void(* | newFnWhnTrnOff )() | ) |
Sets the function that will be called to execute every time the object's isVoided attribute flag is reset.
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's isVoided attribute flag is reset. Passing nullptr as parameter deactivates the function execution mechanism. |
void VdblMPBttn::setFnWhnTrnOnVddPtr | ( | void(* | newFnWhnTrnOn )() | ) |
Sets the function that will be called to execute every time the object's isVoided attribute flag is set.
The function to be executed must be of the form void (*newFnWhnTrnOn)(), 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's isVoided is set. Passing nullptr as parameter deactivates the function execution mechanism. |
bool VdblMPBttn::setIsNotVoided | ( | ) |
Sets the value of the isVoided attribute flag to false.
true |
bool VdblMPBttn::setIsVoided | ( | ) |
Sets the value of the isVoided attribute flag to true.
true |