ButtonToSwitch Library for ESP32 (Arduino) v4.0.0
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
Loading...
Searching...
No Matches
ButtonToSwitch_ESP32.h
Go to the documentation of this file.
1
33#ifndef _BUTTONTOSWITCH_ESP32_H_
34#define _BUTTONTOSWITCH_ESP32_H_
35
36#include <Arduino.h>
37#include <stdint.h>
38
39#define _HwMinDbncTime 20 //Documented minimum wait time for a MPB signal to stabilize
40#define _StdPollDelay 10
41#define _MinSrvcTime 100
42#define _InvalidPinNum 0xFF // Value to give as "yet to be defined", the "Valid pin number" range and characteristics are development platform and environment related
43
44/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking BEGIN -------*/
45const uint8_t IsOnBitPos {0};
46const uint8_t IsEnabledBitPos{1};
47const uint8_t PilotOnBitPos{2};
48const uint8_t WrnngOnBitPos{3};
49const uint8_t IsVoidedBitPos{4};
50const uint8_t IsOnScndryBitPos{5};
51const uint8_t OtptCurValBitPos{16};
52
53#ifndef MPBOTPTS_T
54 #define MPBOTPTS_T
61 struct MpbOtpts_t{
62 bool isOn;
63 bool isEnabled;
64 bool pilotOn;
65 bool wrnngOn;
66 bool isVoided;
67 bool isOnScndry;
68 uint16_t otptCurVal;
69 };
70#endif
71/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking END -------*/
72
73// Definition workaround to let a function/method return value to be a function pointer
74typedef void (*fncPtrType)();
75typedef fncPtrType (*ptrToTrnFnc)();
76
77//===========================>> BEGIN General use function prototypes
78MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts);
79//===========================>> END General use function prototypes
80
81//===========================>> BEGIN General use Global variables
82//===========================>> END General use Global variables
83
84//==========================================================>> Classes declarations BEGIN
85
96protected:
97 enum fdaDmpbStts {
98 stOffNotVPP,
99 stOffVPP,
100 stOn,
101 stOnVRP,
102 stDisabled
103 };
104 const unsigned long int _stdMinDbncTime {_HwMinDbncTime};
105
106 uint8_t _mpbttnPin{};
107 bool _pulledUp{};
108 bool _typeNO{};
109 unsigned long int _dbncTimeOrigSett{};
110
111 unsigned long int _dbncRlsTimerStrt{0};
112 unsigned long int _dbncRlsTimeTempSett{0};
113 unsigned long int _dbncTimerStrt{0};
114 unsigned long int _dbncTimeTempSett{0};
115 void (*_fnWhnTrnOff)() {nullptr};
116 void (*_fnWhnTrnOn)() {nullptr};
117 bool _isEnabled{true};
118 volatile bool _isOn{false};
119 bool _isOnDisabled{false};
120 volatile bool _isPressed{false};
121 fdaDmpbStts _mpbFdaState {stOffNotVPP};
122 TimerHandle_t _mpbPollTmrHndl {NULL}; //FreeRTOS returns NULL if creation fails (not nullptr)
123 String _mpbPollTmrName {""};
124 volatile bool _outputsChange {false};
125 bool _prssRlsCcl{false};
126 unsigned long int _strtDelay {0};
127 bool _sttChng {true};
128 TaskHandle_t _taskToNotifyHndl {NULL};
129 TaskHandle_t _taskWhileOnHndl{NULL};
130 volatile bool _validDisablePend{false};
131 volatile bool _validEnablePend{false};
132 volatile bool _validPressPend{false};
133 volatile bool _validReleasePend{false};
134
135 void clrSttChng();
136 const bool getIsPressed() const;
137 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
138 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
139 void _setIsEnabled(const bool &newEnabledValue);
140 void setSttChng();
141 void _turnOff();
142 void _turnOn();
143 virtual void updFdaState();
144 bool updIsPressed();
145 virtual bool updValidPressesStatus();
146public:
151 DbncdMPBttn();
161 DbncdMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
166 virtual ~DbncdMPBttn();
178 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
189 void clrStatus(bool clrIsOn = true);
200 void disable();
209 void enable();
219 bool end();
227 const unsigned long int getCurDbncTime() const;
238 fncPtrType getFnWhnTrnOff();
249 fncPtrType getFnWhnTrnOn();
258 const bool getIsEnabled() const;
267 const bool getIsOn () const;
279 const bool getIsOnDisabled() const;
287 const uint32_t getOtptsSttsPkgd();
298 const bool getOutputsChange() const;
308 unsigned long int getStrtDelay();
319 const TaskHandle_t getTaskToNotify() const;
330 const TaskHandle_t getTaskWhileOn();
336 bool init(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
345 bool pause();
351 void resetDbncTime();
357 void resetFda();
368 bool resume();
380 bool setDbncTime(const unsigned long int &newDbncTime);
388 void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)());
396 void setFnWhnTrnOnPtr(void (*newFnWhnTrnOn)());
407 void setIsOnDisabled(const bool &newIsOnDisabled);
415 void setOutputsChange(bool newOutputsChange);
425 void setTaskToNotify(const TaskHandle_t &newTaskHandle);
441 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
442};
443
444//==========================================================>>
445
456public:
471 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);
480 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);
490 void setStrtDelay(const unsigned long int &newStrtDelay);
491};
492
493//==========================================================>>
494
512protected:
513 enum fdaLmpbStts {
514 stOffNotVPP,
515 stOffVPP,
516 stOnNVRP,
517 stOnVRP,
518 stLtchNVUP,
519 stLtchdVUP,
520 stOffVUP,
521 stOffNVURP,
522 stOffVURP,
523 stDisabled
524 };
525 bool _isLatched{false};
526 fdaLmpbStts _mpbFdaState {stOffNotVPP};
527 bool _trnOffASAP{true};
528 volatile bool _validUnlatchPend{false};
529 volatile bool _validUnlatchRlsPend{false};
530
531 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
532
533 virtual void stDisabled_In(){};
534 virtual void stDisabled_Out(){};
535 virtual void stLtchNVUP_Do(){};
536 virtual void stOffNotVPP_In(){};
537 virtual void stOffNotVPP_Out(){};
538 virtual void stOffNVURP_Do(){};
539 virtual void stOffVPP_Out(){};
540 virtual void stOffVURP_Out(){};
541 virtual void stOnNVRP_Do(){};
542 virtual void updFdaState();
543 virtual void updValidUnlatchStatus() = 0;
544public:
550 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);
554 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
558 void clrStatus(bool clrIsOn = true);
567 const bool getIsLatched() const;
577 bool getTrnOffASAP();
585 const bool getUnlatchPend() const;
593 const bool getUnlatchRlsPend() const;
605 void setTrnOffASAP(const bool &newVal);
613 void setUnlatchPend(const bool &newVal);
621 void setUnlatchRlsPend(const bool &newVal);
632 bool unlatch();
633};
634
635//==========================================================>>
636
645protected:
646 virtual void stOffNVURP_Do();
647 virtual void updValidUnlatchStatus();
648public:
654 TgglLtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
655};
656
657//==========================================================>>
658
669protected:
670 bool _tmRstbl {true};
671 unsigned long int _srvcTime {};
672 unsigned long int _srvcTimerStrt{0};
673
674 virtual void stOffNotVPP_Out();
675 virtual void stOffVPP_Out();
676 virtual void updValidUnlatchStatus();
677public:
685 TmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
689 void clrStatus(bool clrIsOn = true);
695 const unsigned long int getSrvcTime() const;
706 bool setSrvcTime(const unsigned long int &newSrvcTime);
714 void setTmerRstbl(const bool &newIsRstbl);
715};
716
717//==========================================================>>
718
730protected:
731 void (*_fnWhnTrnOffPilot)() {nullptr};
732 void (*_fnWhnTrnOffWrnng)() {nullptr};
733 void (*_fnWhnTrnOnPilot)() {nullptr};
734 void (*_fnWhnTrnOnWrnng)() {nullptr};
735 bool _keepPilot{false};
736 volatile bool _pilotOn{false};
737 unsigned long int _wrnngMs{0};
738 volatile bool _wrnngOn {false};
739 unsigned int _wrnngPrctg {0};
740
741 bool _validWrnngSetPend{false};
742 bool _validWrnngResetPend{false};
743 bool _validPilotSetPend{false};
744 bool _validPilotResetPend{false};
745
746 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
747 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
748 virtual void stDisabled_In();
749 virtual void stLtchNVUP_Do();
750 virtual void stOffNotVPP_In();
751 virtual void stOffVPP_Out();
752 virtual void stOnNVRP_Do();
753 void _turnOffPilot();
754 void _turnOffWrnng();
755 void _turnOnPilot();
756 void _turnOnWrnng();
757 bool updPilotOn();
758 bool updWrnngOn();
759public:
767 HntdTmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const unsigned int &wrnngPrctg = 0, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
771 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
775 void clrStatus(bool clrIsOn = true);
786 fncPtrType getFnWhnTrnOffPilot();
797 fncPtrType getFnWhnTrnOffWrnng();
808 fncPtrType getFnWhnTrnOnPilot();
819 fncPtrType getFnWhnTrnOnWrnng();
829 const bool getPilotOn() const;
841 const bool getWrnngOn() const;
849 void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)());
857 void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)());
865 void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)());
873 void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)());
879 void setKeepPilot(const bool &newKeepPilot);
885 bool setSrvcTime(const unsigned long int &newSvcTime);
897 bool setWrnngPrctg (const unsigned int &newWrnngPrctg);
898};
899
900//==========================================================>>
901
911protected:
912 DbncdDlydMPBttn* _unLtchBttn {nullptr};
913 bool _xtrnUnltchPRlsCcl {false};
914
915 virtual void stOffNVURP_Do();
916 virtual void updValidUnlatchStatus();
917public:
931 XtrnUnltchMPBttn(const uint8_t &mpbttnPin, DbncdDlydMPBttn* unLtchBttn,
932 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
940 XtrnUnltchMPBttn(const uint8_t &mpbttnPin,
941 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
942
946 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
950 void clrStatus(bool clrIsOn = true);
951};
952
953//==========================================================>>
954
980protected:
981 enum fdaDALmpbStts{
982 stOffNotVPP,
983 stOffVPP,
984 stOnMPBRlsd,
985 //--------
986 stOnStrtScndMod,
987 stOnScndMod,
988 stOnEndScndMod,
989 //--------
990 stOnTurnOff,
991 //--------
992 stDisabled
993 };
994 volatile bool _isOnScndry{false};
995 fdaDALmpbStts _mpbFdaState {stOffNotVPP};
996 unsigned long _scndModActvDly {2000};
997 unsigned long _scndModTmrStrt {0};
998 bool _validScndModPend{false};
999
1000 void (*_fnWhnTrnOffScndry)() {nullptr};
1001 void (*_fnWhnTrnOnScndry)() {nullptr};
1002 TaskHandle_t _taskWhileOnScndryHndl{NULL};
1003
1004 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
1005 virtual void stDisabled_In(){};
1006 virtual void stOnEndScndMod_Out(){};
1007 virtual void stOnScndMod_Do() = 0;
1008 virtual void stOnStrtScndMod_In(){};
1009 virtual void _turnOffScndry();
1010 virtual void _turnOnScndry();
1011 virtual void updFdaState();
1012 virtual bool updValidPressesStatus();
1013 virtual void updValidUnlatchStatus();
1014
1015public:
1021 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);
1030 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1034 void clrStatus(bool clrIsOn = true);
1043 fncPtrType getFnWhnTrnOffScndry();
1052 fncPtrType getFnWhnTrnOnScndry();
1060 bool getIsOnScndry();
1068 unsigned long getScndModActvDly();
1079 const TaskHandle_t getTaskWhileOnScndry();
1087 void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)());
1095 void setFnWhnTrnOnScndryPtr(void (*newFnWhnTrnOn)());
1106 bool setScndModActvDly(const unsigned long &newVal);
1124 void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle);
1125
1126};
1127
1128//==========================================================>>
1129
1143protected:
1144 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1145 virtual void stDisabled_In();
1146 virtual void stOnEndScndMod_Out();
1147 virtual void stOnScndMod_Do();
1148 virtual void stOnStrtScndMod_In();
1149public:
1155 DDlydDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1163 void clrStatus(bool clrIsOn = true);
1164};
1165
1166//==========================================================>>
1167
1186
1187protected:
1188 bool _autoSwpDirOnEnd{true}; // Changes slider direction automatically when reaches _otptValMax or _otptValMin
1189 bool _autoSwpDirOnPrss{false};// Changes slider direction each time it enters slider mode
1190 bool _curSldrDirUp{true};
1191 uint16_t _initOtptCurVal{};
1192 uint16_t _otptCurVal{};
1193 unsigned long _otptSldrSpd{1};
1194 uint16_t _otptSldrStpSize{0x01};
1195 uint16_t _otptValMax{0xFFFF};
1196 uint16_t _otptValMin{0x0000};
1197
1198 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1199 bool _setSldrDir(const bool &newVal);
1200 virtual void stDisabled_In();
1201 void stOnEndScndMod_Out();
1202 virtual void stOnScndMod_Do();
1203 virtual void stOnStrtScndMod_In();
1204public:
1212 SldrDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0, const uint16_t initVal = 0xFFFF);
1221 void clrStatus(bool clrIsOn = true);
1227 uint16_t getOtptCurVal();
1237 bool getOtptCurValIsMax();
1247 bool getOtptCurValIsMin();
1257 unsigned long getOtptSldrSpd();
1267 uint16_t getOtptSldrStpSize();
1273 uint16_t getOtptValMax();
1279 uint16_t getOtptValMin();
1289 bool getSldrDirUp();
1301 bool setOtptCurVal(const uint16_t &newVal);
1316 bool setOtptSldrSpd(const uint16_t &newVal);
1333 bool setOtptSldrStpSize(const uint16_t &newVal);
1349 bool setOtptValMax(const uint16_t &newVal);
1365 bool setOtptValMin(const uint16_t &newVal);
1378 bool setSldrDirDn();
1391 bool setSldrDirUp();
1401 void setSwpDirOnEnd(const bool &newVal);
1410 void setSwpDirOnPrss(const bool &newVal);
1418 bool swapSldrDir();
1419};
1420
1421//==========================================================>>
1422
1442private:
1443 void setFrcdOtptWhnVdd(const bool &newVal);
1444 void setStOnWhnOtpFrcd(const bool &newVal);
1445protected:
1446 enum fdaVmpbStts{
1447 stOffNotVPP,
1448 stOffVPP,
1449 stOnNVRP,
1450 //--------
1451 stOnVVP,
1452 stOnVddNVUP,
1453 stOffVddNVUP,
1454 stOffVddVUP,
1455 stOffUnVdd,
1456 //--------
1457 stOnVRP,
1458 stOnTurnOff,
1459 stOff,
1460 //--------
1461 stDisabled
1462 };
1463 fdaVmpbStts _mpbFdaState {stOffNotVPP};
1464
1465 void (*_fnWhnTrnOffVdd)() {nullptr};
1466 void (*_fnWhnTrnOnVdd)() {nullptr};
1467 bool _frcOtptLvlWhnVdd {true};
1468 bool _isVoided{false};
1469 bool _stOnWhnOtptFrcd{false};
1470 bool _validVoidPend{false};
1471 bool _validUnvoidPend{false};
1472
1473 static void mpbPollCallback(TimerHandle_t mpbTmrCb);
1474 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1475 bool setVoided(const bool &newVoidValue);
1476 virtual void stDisabled_In();
1477 virtual void stDisabled_Out();
1478 virtual void stOffNotVPP_In(){};
1479 virtual void stOffVddNVUP_Do(){}; //This provides a setting point for calculating the _validUnvoidPend
1480 virtual void stOffVPP_Do(){}; // This provides a setting point for the voiding mechanism to be started
1481 void _turnOffVdd();
1482 void _turnOnVdd();
1483 virtual void updFdaState();
1484 virtual bool updVoidStatus() = 0;
1485public:
1493 VdblMPBttn(const uint8_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);
1497 virtual ~VdblMPBttn();
1501 void clrStatus(bool clrIsOn = true);
1510 fncPtrType getFnWhnTrnOffVdd();
1519 fncPtrType getFnWhnTrnOnVdd();
1529 bool getFrcOtptLvlWhnVdd();
1537 const bool getIsVoided() const;
1549 bool getStOnWhnOtpFrcd();
1557 void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)());
1565 void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)());
1576 bool setIsNotVoided();
1584 bool setIsVoided();
1585};
1586
1587//==========================================================>>
1588
1598protected:
1599 unsigned long int _voidTime;
1600 unsigned long int _voidTmrStrt{0};
1601
1602 virtual void stOffNotVPP_In();
1603 virtual void stOffVddNVUP_Do(); //This provides a setting point for calculating the _validUnvoidPend
1604 virtual void stOffVPP_Do(); // This provides a setting point for the voiding mechanism to be started
1605 bool updIsPressed();
1606 virtual bool updVoidStatus();
1607public:
1615 TmVdblMPBttn(const uint8_t &mpbttnPin, unsigned long int voidTime, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0, const bool &isOnDisabled = false);
1619 virtual ~TmVdblMPBttn();
1623 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1627 void clrStatus();
1635 const unsigned long int getVoidTime() const;
1646 bool setVoidTime(const unsigned long int &newVoidTime);
1647};
1648
1649//==========================================================>>
1650
1667protected:
1668 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
1669 virtual void stOffVddNVUP_Do(); //This provides the calculation for the _validUnvoidPend
1670 virtual bool updVoidStatus();
1671public:
1677 SnglSrvcVdblMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1681 virtual ~SnglSrvcVdblMPBttn();
1685 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1686};
1687
1688//==========================================================>>
1689
1690#endif /*_BUTTONTOSWITCH_ESP32_H_*/
MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts)
Unpackages a 32-bit value into a DbncdMPBttn object status.
Definition ButtonToSwitch_ESP32.cpp:3194
Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-D...
Definition ButtonToSwitch_ESP32.h:1142
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2222
~DDlydDALtchMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2218
DDlydDALtchMPBttn(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.
Definition ButtonToSwitch_ESP32.cpp:2213
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs).
Definition ButtonToSwitch_ESP32.h:979
bool setScndModActvDly(const unsigned long &newVal)
Sets a new value for the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1900
void setFnWhnTrnOnScndryPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch_ESP32.cpp:1888
const TaskHandle_t getTaskWhileOnScndry()
Returns the task to be run while the object is in the Secondary On state.
Definition ButtonToSwitch_ESP32.cpp:1843
fncPtrType getFnWhnTrnOnScndry()
Returns the function that is set to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch_ESP32.cpp:1828
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1808
bool getIsOnScndry()
Returns the current value of the isOnScndry attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1833
void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:1918
unsigned long getScndModActvDly()
Returns the current value of the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1838
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1784
void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object enters the Secondary Off State...
Definition ButtonToSwitch_ESP32.cpp:1877
fncPtrType getFnWhnTrnOffScndry()
returns the function that is set to execute every time the object enters the Secondary Off State.
Definition ButtonToSwitch_ESP32.cpp:1823
~DblActnLtchMPBttn()
Virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:1780
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.
Definition ButtonToSwitch_ESP32.cpp:1775
Models a Debounced Delayed MPB (DD-MPB).
Definition ButtonToSwitch_ESP32.h:455
DbncdDlydMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:746
void setStrtDelay(const unsigned long int &newStrtDelay)
Sets a new value to the "Start Delay" strtDelay attribute.
Definition ButtonToSwitch_ESP32.cpp:767
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)
Definition ButtonToSwitch_ESP32.cpp:757
Base class, models a Debounced Momentary Push Button (D-MPB).
Definition ButtonToSwitch_ESP32.h:95
fncPtrType getFnWhnTrnOn()
Returns the function that is set to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:163
void resetFda()
Resets the MPB behavior automaton to it's Initial or Start State
Definition ButtonToSwitch_ESP32.cpp:317
void clrStatus(bool clrIsOn=true)
Clears and resets flags, timers and counters modified through the object's signals processing.
Definition ButtonToSwitch_ESP32.cpp:95
const unsigned long int getCurDbncTime() const
Returns the current debounce period time set for the object.
Definition ButtonToSwitch_ESP32.cpp:153
const TaskHandle_t getTaskWhileOn()
Returns the task to be run (resumed) while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:208
void enable()
Enables the input signal processing.
Definition ButtonToSwitch_ESP32.cpp:128
bool pause()
Pauses the software timer updating the computation of the object's internal flags value.
Definition ButtonToSwitch_ESP32.cpp:293
const TaskHandle_t getTaskToNotify() const
Returns the task to be notified by the object when its output flags changes.
Definition ButtonToSwitch_ESP32.cpp:203
virtual ~DbncdMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:65
virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:471
void setIsOnDisabled(const bool &newIsOnDisabled)
Sets the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:408
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.
Definition ButtonToSwitch_ESP32.cpp:213
bool end()
Detaches the object from the timer that monitors the input pins, compute and updates the object's sta...
Definition ButtonToSwitch_ESP32.cpp:133
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 statu...
Definition ButtonToSwitch_ESP32.cpp:70
void resetDbncTime()
Resets the debounce process time of the object to the value used at instantiation.
Definition ButtonToSwitch_ESP32.cpp:311
DbncdMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:39
void disable()
Disables the input signal processing, ignoring the changes of its values.
Definition ButtonToSwitch_ESP32.cpp:123
bool resume()
Restarts the software timer updating the calculation of the object internal flags.
Definition ButtonToSwitch_ESP32.cpp:329
const bool getIsEnabled() const
Returns the value of the isEnabled attribute flag, indicating the Enabled or Disabled status of the o...
Definition ButtonToSwitch_ESP32.cpp:168
const bool getIsOnDisabled() const
Returns the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:178
void setTaskToNotify(const TaskHandle_t &newTaskHandle)
Sets the handle to the task to be notified by the object when its output attribute flags changes.
Definition ButtonToSwitch_ESP32.cpp:447
void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:363
const bool getOutputsChange() const
Returns the value of the outputsChange attribute flag.
Definition ButtonToSwitch_ESP32.cpp:193
const bool getIsOn() const
Returns the value of the isOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:173
void setFnWhnTrnOnPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:375
unsigned long int getStrtDelay()
Returns the current value of strtDelay attribute.
Definition ButtonToSwitch_ESP32.cpp:198
const uint32_t getOtptsSttsPkgd()
Returns the relevant attribute flags values for the object state encoded as a 32 bits value,...
Definition ButtonToSwitch_ESP32.cpp:188
fncPtrType getFnWhnTrnOff()
Returns the function that is set to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:158
void setOutputsChange(bool newOutputsChange)
Sets the value of the attribute flag indicating if a change took place in any of the output attribute...
Definition ButtonToSwitch_ESP32.cpp:430
bool setDbncTime(const unsigned long int &newDbncTime)
Sets the debounce process time.
Definition ButtonToSwitch_ESP32.cpp:345
Models a Hinted Timer Latch DD-MPB, a.k.a. Staircase Switch (HTiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:729
bool setSrvcTime(const unsigned long int &newSvcTime)
See TmLtchMPBttn::setSrvcTime(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1429
fncPtrType getFnWhnTrnOnPilot()
Returns the function that is set to execute every time the object's Pilot attribute flag enters the O...
Definition ButtonToSwitch_ESP32.cpp:1300
void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object's Warning is reset.
Definition ButtonToSwitch_ESP32.cpp:1382
fncPtrType getFnWhnTrnOffWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1295
const bool getWrnngOn() const
Returns the current value of the warningOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1315
void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object's Pilot is set.
Definition ButtonToSwitch_ESP32.cpp:1394
HntdTmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const unsigned int &wrnngPrctg=0, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch_ESP32.cpp:1245
const bool getPilotOn() const
Returns the current value of the pilotOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1310
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1275
fncPtrType getFnWhnTrnOffPilot()
Returns the function that is set to execute every time the object's Pilot attribute flag enters the O...
Definition ButtonToSwitch_ESP32.cpp:1290
void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object's Wrnng is set.
Definition ButtonToSwitch_ESP32.cpp:1406
bool setWrnngPrctg(const unsigned int &newWrnngPrctg)
Sets the value for the percentage of service time for calculating the warningOn flag value.
Definition ButtonToSwitch_ESP32.cpp:1444
fncPtrType getFnWhnTrnOnWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1305
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1251
void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object's Pilot is reset.
Definition ButtonToSwitch_ESP32.cpp:1370
void setKeepPilot(const bool &newKeepPilot)
Sets the configuration of the keepPilot service attribute.
Definition ButtonToSwitch_ESP32.cpp:1418
Abstract class, base to model Latched Debounced Delayed MPBs (LDD-MPB).
Definition ButtonToSwitch_ESP32.h:511
const bool getIsLatched() const
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of t...
Definition ButtonToSwitch_ESP32.cpp:822
bool unlatch()
Sets the values of the flags needed to unlatch a latched MPB.
Definition ButtonToSwitch_ESP32.cpp:907
const bool getUnlatchRlsPend() const
Returns the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:837
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.
Definition ButtonToSwitch_ESP32.cpp:780
const bool getUnlatchPend() const
Returns the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:832
void setUnlatchPend(const bool &newVal)
Sets the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:885
void setTrnOffASAP(const bool &newVal)
Sets the value of the trnOffASAP attribute.
Definition ButtonToSwitch_ESP32.cpp:873
bool getTrnOffASAP()
Returns the value of the trnOffASAP attribute flag.
Definition ButtonToSwitch_ESP32.cpp:827
void setUnlatchRlsPend(const bool &newVal)
Sets the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:896
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:785
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:809
Models a Slider Double Action LDD-MPB combo switch, a.k.a. off/on/dimmer, a.k.a. off/on/volume radio ...
Definition ButtonToSwitch_ESP32.h:1185
void clrStatus(bool clrIsOn=true)
Definition ButtonToSwitch_ESP32.cpp:2293
bool setOtptSldrSpd(const uint16_t &newVal)
Sets the output slider speed (otptSldrSpd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2378
uint16_t getOtptValMax()
Returns the top output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2334
bool getOtptCurValIsMin()
Returns the result of comparing the Output Current Value to the Minimum value setting
Definition ButtonToSwitch_ESP32.cpp:2319
bool setSldrDirDn()
Sets the value of the curSldrDirUp attribute to false.
Definition ButtonToSwitch_ESP32.cpp:2482
bool setOtptValMax(const uint16_t &newVal)
Sets the output current value register maximum value attribute (otptValMax attribute).
Definition ButtonToSwitch_ESP32.cpp:2414
bool swapSldrDir()
Inverts the current curSldrDirUp attribute value.
Definition ButtonToSwitch_ESP32.cpp:2597
~SldrDALtchMPBttn()
Virtual class destructor.
Definition ButtonToSwitch_ESP32.cpp:2289
bool setOtptCurVal(const uint16_t &newVal)
Sets the output current value register.
Definition ButtonToSwitch_ESP32.cpp:2360
uint16_t getOtptCurVal()
Returns the Output Current Value (otpCurVal) attribute.
Definition ButtonToSwitch_ESP32.cpp:2309
bool setSldrDirUp()
Sets the value of the curSldrDirUp attribute to true.
Definition ButtonToSwitch_ESP32.cpp:2487
bool getSldrDirUp()
Returns the value of the curSldrDirUp attribute.
Definition ButtonToSwitch_ESP32.cpp:2344
bool setOtptSldrStpSize(const uint16_t &newVal)
Sets the output slider step size (otptSldrStpSize) attribute value.
Definition ButtonToSwitch_ESP32.cpp:2396
bool getOtptCurValIsMax()
Returns a boolean value indicating if the "Output Current Value" equals the maximum limit.
Definition ButtonToSwitch_ESP32.cpp:2314
SldrDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0, const uint16_t initVal=0xFFFF)
Class constructor.
Definition ButtonToSwitch_ESP32.cpp:2283
void setSwpDirOnPrss(const bool &newVal)
Sets the value of the "Auto-Swap Direction On Press" (autoSwpDirOnPrss) attribute.
Definition ButtonToSwitch_ESP32.cpp:2499
bool setOtptValMin(const uint16_t &newVal)
Sets the output current value register minimum value attribute (otptValMin attribute).
Definition ButtonToSwitch_ESP32.cpp:2436
uint16_t getOtptValMin()
Returns the bottom output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2339
unsigned long getOtptSldrSpd()
Returns the current setting for the Output Slider Speed value.
Definition ButtonToSwitch_ESP32.cpp:2324
uint16_t getOtptSldrStpSize()
Returns the current setting for the Output Slider Step Size value.
Definition ButtonToSwitch_ESP32.cpp:2329
void setSwpDirOnEnd(const bool &newVal)
Sets the value of the "Auto-Swap Direction on Ends" (autoSwpDirOnEnd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2492
Models a Single Service Voidable DD-MPB a.k.a. Trigger switch (SSVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1666
virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:3159
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3137
SnglSrvcVdblMPBttn(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.
Definition ButtonToSwitch_ESP32.cpp:3125
virtual ~SnglSrvcVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:3133
Models a Toggle Latch DD-MPB, a.k.a. a Toggle Switch (ToLDD-MPB).
Definition ButtonToSwitch_ESP32.h:644
TgglLtchMPBttn(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.
Definition ButtonToSwitch_ESP32.cpp:1123
Models a Timer Latch DD-MPB, a.k.a. Timer Switch (TiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:668
const unsigned long int getSrvcTime() const
Returns the configured Service Time.
Definition ButtonToSwitch_ESP32.cpp:1180
void setTmerRstbl(const bool &newIsRstbl)
Configures the timer for the Service Time to be reseted before it reaches unlatching time.
Definition ButtonToSwitch_ESP32.cpp:1203
bool setSrvcTime(const unsigned long int &newSrvcTime)
Sets a new value to the Service Time attribute.
Definition ButtonToSwitch_ESP32.cpp:1185
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1169
TmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch_ESP32.cpp:1161
Models a Time Voidable DD-MPB, a.k.a. Anti-tampering switch (TVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1597
virtual ~TmVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:3027
void clrStatus()
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:3053
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3031
TmVdblMPBttn(const uint8_t &mpbttnPin, unsigned long int voidTime, 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.
Definition ButtonToSwitch_ESP32.cpp:3022
const unsigned long int getVoidTime() const
Returns the voidTime attribute current value.
Definition ButtonToSwitch_ESP32.cpp:3064
bool setVoidTime(const unsigned long int &newVoidTime)
Sets a new value to the Void Time attribute.
Definition ButtonToSwitch_ESP32.cpp:3069
Abstract class, base to model Voidable DD-MPBs (VDD-MPB).
Definition ButtonToSwitch_ESP32.h:1441
bool setIsVoided()
Sets the value of the isVoided attribute flag to true.
Definition ButtonToSwitch_ESP32.cpp:2736
const bool getIsVoided() const
Returns the current value of the isVoided attribute flag.
Definition ButtonToSwitch_ESP32.cpp:2643
fncPtrType getFnWhnTrnOnVdd()
Returns the function that is set to execute every time the object enters the Voided or "Voided On" St...
Definition ButtonToSwitch_ESP32.cpp:2633
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2614
void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object's isVoided attribute flag is s...
Definition ButtonToSwitch_ESP32.cpp:2707
virtual ~VdblMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2610
fncPtrType getFnWhnTrnOffVdd()
Returns the function that is set to execute every time the object exits the Voided State.
Definition ButtonToSwitch_ESP32.cpp:2628
void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object's isVoided attribute flag is r...
Definition ButtonToSwitch_ESP32.cpp:2694
bool getFrcOtptLvlWhnVdd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2638
bool getStOnWhnOtpFrcd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2648
bool setIsNotVoided()
Sets the value of the isVoided attribute flag to false.
Definition ButtonToSwitch_ESP32.cpp:2731
VdblMPBttn(const uint8_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.
Definition ButtonToSwitch_ESP32.cpp:2604
Models an External Unlatch LDD-MPB, a.k.a. Emergency Latched Switch (XULDD-MPB)
Definition ButtonToSwitch_ESP32.h:910
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1728
XtrnUnltchMPBttn(const uint8_t &mpbttnPin, DbncdDlydMPBttn *unLtchBttn, const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay)
Class constructor.
Definition ButtonToSwitch_ESP32.cpp:1688
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1700
Type to hold the complete set of output attribute flags from any DbncdMPBttn class and subclasses obj...
Definition ButtonToSwitch_ESP32.h:61