| ButtonToSwitch Library for Arduino v4.5.0 A library that provides elaborated switch mechanism behavior simulation for digital signals inputs

Loading...
Searching...
No Matches
DbncdDlydMPBttn Class Reference

Models a Debounced Delayed MPB (DD-MPB). More...

`#include <ButtonToSwitch.h>`

Inheritance diagram for DbncdDlydMPBttn:
[legend]
Collaboration diagram for DbncdDlydMPBttn:
[legend]

## Public Member Functions
| 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.
| DbncdDlydMPBttn (const DbncdDlydMPBttn &other)
| Copy constructor.
virtual | ~DbncdDlydMPBttn ()
| Class destructor.
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.
Public Member Functions inherited from DbncdMPBttn
| 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.
| DbncdMPBttn (const DbncdMPBttn &other)
| Copy 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.
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.
fncVdPtrPrmPtrType | getFVPPWhnTrnOff ()
| Returns a pointer to a function that is set to execute every time the object enters the Off State.
void * | getFVPPWhnTrnOffArgPtr ()
| Returns a pointer to the argument to be passed to the function set to execute every time the object enters the Off State.
fncVdPtrPrmPtrType | getFVPPWhnTrnOn ()
| Returns a pointer to a function that is set to execute every time the object enters the On State.
void * | getFVPPWhnTrnOnArgPtr ()
| Returns a pointer to the argument to be passed to the function 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.
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 (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 | setFVPPWhnTrnOff (fncVdPtrPrmPtrType newFVPPWhnTrnOff, void *argPtr=nullptr)
| Sets a function to be executed every time the object enters the Off State.
void | setFVPPWhnTrnOffArgPtr (void *newFVPPWhnTrnOffArgPtr)
| Sets a pointer to an argument to be passed to the function set to execute every time the object enters the Off State.
void | setFVPPWhnTrnOn (fncVdPtrPrmPtrType newFVPPWhnTrnOn, void *argPtr=nullptr)
| Sets a function to be executed every time the object enters the On State.
void | setFVPPWhnTrnOnArgPtr (void *newFVPPWhnTrnOnArgPtr)
| Sets a pointer to an argument to be passed to the function set 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).

## Detailed Description

Models a Debounced Delayed MPB (DD-MPB).

The Debounced Delayed Momentary Button, keeps the ON state since the moment the signal is stable (debouncing process), plus a delay added, and until the moment the push button is released. The reasons to add the delay are design related and are usually used to avoid registering unintentional presses, or to give some equipment (load) that needs time between repeated activations the benefit of the pause. If the push button is released before the debounce and delay times configured are reached, no press is registered at all. The delay time in this class as in the other that implement it, might be zero (0), defined by the developer and/or modified in runtime.

Note
  If the delay attribute is set to 0, the resulting object of this class is equivalent in functionality to a DbncdMPBttn class object. The main difference is that the "Start Delay" attribute (strtDelay) will be available for changing at runtime.

## Constructor & Destructor Documentation

## ◆ DbncdDlydMPBttn() [1/2]

DbncdDlydMPBttn::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.

Parameters

  strtDelay | Sets the initial value for the strtDelay attribute.

Note
  For the rest of the parameters see DbncdMPBttn(const uint8_t, const bool, const bool, const unsigned long int)
  If the delay attribute is set to 0, the resulting object is equivalent in functionality to a DbncdMPBttn class object.

Here is the call graph for this function:

## ◆ DbncdDlydMPBttn() [2/2]

DbncdDlydMPBttn::DbncdDlydMPBttn | ( | const DbncdDlydMPBttn & | other | ) |

Copy constructor.

Parameters

  other | Reference to an existing DbncdDlydMPBttn object to be copied.

Here is the call graph for this function:

## Member Function Documentation

## ◆ init()

bool DbncdDlydMPBttn::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)

Parameters

  strtDelay | Sets the initial value for the strtDelay attribute.

Note
  For the rest of the parameters see DbncdMPBttn::init(const uint8_t, const bool, const bool, const unsigned long int)

Here is the call graph for this function:

## ◆ setStrtDelay()

void DbncdDlydMPBttn::setStrtDelay | ( | const unsigned long int & | newStrtDelay | ) |

Sets a new value to the "Start Delay" strtDelay attribute.

Parameters

  newStrtDelay | New value for the "Start Delay" attribute in milliseconds.

Note
  Setting the delay attribute to 0 makes the instantiated object act exactly as a Debounced MPB (D-MPB)

Warning
  : Using very high strtDelay values is valid but might make the system behavior less responsive, be aware of how it will affect the user experience.

Here is the caller graph for this function: