ButtonToSwitch Library for ESP32 (Arduino) v4.4.0
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
Loading...
Searching...
No Matches
DDlydDALtchMPBttn Class Reference

Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-DALDD-MPB) More...

#include <ButtonToSwitch_ESP32.h>

Inheritance diagram for DDlydDALtchMPBttn:
Collaboration diagram for DDlydDALtchMPBttn:

Public Member Functions

 DDlydDALtchMPBttn ()
 Default class constructor.
 
 DDlydDALtchMPBttn (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.
 
 ~DDlydDALtchMPBttn ()
 Class virtual destructor.
 
void clrStatus (bool clrIsOn=true)
 See DbncddMPBttn::clrStatus(bool)
 
- Public Member Functions inherited from DblActnLtchMPBttn
 DblActnLtchMPBttn ()
 Abstract Class default constructor.
 
 DblActnLtchMPBttn (const int8_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.
 
const TaskHandle_t getTaskWhileOnScndry ()
 Returns the task to be run while the object is in the Secondary On state.
 
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.
 
void setTaskWhileOnScndry (const TaskHandle_t &newTaskHandle)
 Sets the task to be run while the object is in the On state.
 
- Public Member Functions inherited from LtchMPBttn
 LtchMPBttn ()
 Default constructor.
 
 LtchMPBttn (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.
 
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.
 
- Public Member Functions inherited from DbncdDlydMPBttn
 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.
 
- Public Member Functions inherited from DbncdMPBttn
 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.
 
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.
 

Detailed Description

Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-DALDD-MPB)

This is a subclass of the DALDD-MPB whose secondary behavior is that of a DbncdDlydMPBttn (DD-MPB), that implies that:

  • While on the 1.state (Off-Off), a short press will activate only the regular main On state 2. (On-Off).
  • While on the 1.state (Off-Off), a long press will activate both the regular main On state and the secondary On state simultaneously 3. (On-On). When releasing the MPB the switch will stay in the main On state 2. (On-Off). While in the 2. state (On-Off), a short press will set the switch to the 1. state (Off-Off) While in the 2. state (On-Off), a long press will set the switch to the 3. state (On-On), until the releasing of the MPB, returning the switch to the main On state 2. (On-Off).

class DDlydDALtchMPBttn

Constructor & Destructor Documentation

◆ DDlydDALtchMPBttn()

DDlydDALtchMPBttn::DDlydDALtchMPBttn ( const int8_t & mpbttnPin,
const bool & pulledUp = true,
const bool & typeNO = true,
const unsigned long int & dbncTimeOrigSett = 0,
const unsigned long int & strtDelay = 0 )