ButtonToSwitch Library for ESP32 (Arduino) v4.3.1
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 GPIO_NUM_NC //Not Connected pin number (in this hardware platform -1), so a signed numeric type must be used! Value to give as "yet to be defined pin"
43#define _maxValidPinNum GPIO_NUM_MAX-1
44
45/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking BEGIN -------*/
46const uint8_t IsOnBitPos {0};
47const uint8_t IsEnabledBitPos{1};
48const uint8_t PilotOnBitPos{2};
49const uint8_t WrnngOnBitPos{3};
50const uint8_t IsVoidedBitPos{4};
51const uint8_t IsOnScndryBitPos{5};
52const uint8_t OtptCurValBitPos{16};
53
54#ifndef MPBOTPTS_T
55 #define MPBOTPTS_T
62 struct MpbOtpts_t{
63 bool isOn;
64 bool isEnabled;
65 bool pilotOn;
66 bool wrnngOn;
67 bool isVoided;
68 bool isOnScndry;
69 uint16_t otptCurVal;
70 };
71#endif
72/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking END -------*/
73
74// Definition workaround to let a function/method return value to be a function pointer
75typedef void (*fncPtrType)();
76typedef fncPtrType (*ptrToTrnFnc)();
77
78//===========================>> BEGIN General use function prototypes
79MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts);
80//===========================>> END General use function prototypes
81
82//===========================>> BEGIN General use Global variables
83//===========================>> END General use Global variables
84
85//==========================================================>> Classes declarations BEGIN
86
97protected:
98 enum fdaDmpbStts {
99 stOffNotVPP,
100 stOffVPP,
101 stOn,
102 stOnVRP,
103 stDisabled
104 };
105 const unsigned long int _stdMinDbncTime {_HwMinDbncTime};
106
107 int8_t _mpbttnPin{};
108 bool _pulledUp{};
109 bool _typeNO{};
110 unsigned long int _dbncTimeOrigSett{};
111
112 unsigned long int _dbncRlsTimerStrt{0};
113 unsigned long int _dbncRlsTimeTempSett{0};
114 unsigned long int _dbncTimerStrt{0};
115 unsigned long int _dbncTimeTempSett{0};
116 fncPtrType _fnWhnTrnOff{nullptr};
117 fncPtrType _fnWhnTrnOn{nullptr};
118 bool _isEnabled{true};
119 volatile bool _isOn{false};
120 bool _isOnDisabled{false};
121 volatile bool _isPressed{false};
122 fdaDmpbStts _mpbFdaState {stOffNotVPP};
123 TimerHandle_t _mpbPollTmrHndl {NULL}; //FreeRTOS returns NULL if creation fails (not nullptr)
124 String _mpbPollTmrName {""};
125 bool _outputsChange {false};
126 uint32_t _outputsChangeCnt{0};
127 bool _outputsChngTskTrggr{false};
128 bool _prssRlsCcl{false};
129 unsigned long int _strtDelay {0};
130 bool _sttChng {true};
131 TaskHandle_t _taskToNotifyHndl {NULL};
132 TaskHandle_t _taskWhileOnHndl{NULL};
133 volatile bool _validDisablePend{false};
134 volatile bool _validEnablePend{false};
135 volatile bool _validPressPend{false};
136 volatile bool _validReleasePend{false};
137
138 void clrSttChng();
139 const bool getIsPressed() const;
140 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
141 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
142 void _setIsEnabled(const bool &newEnabledValue);
143 void setSttChng();
144 void _turnOff();
145 void _turnOn();
146 virtual void updFdaState();
147 bool updIsPressed();
148 virtual bool updValidPressesStatus();
149 const bool getOutputsChngTskTrggr() const;
150 void resetOutputsChngTskTrggr();
151
152public:
157 DbncdMPBttn();
167 DbncdMPBttn(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
172 virtual ~DbncdMPBttn();
184 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
195 void clrStatus(bool clrIsOn = true);
206 void disable();
215 void enable();
225 bool end();
233 const unsigned long int getCurDbncTime() const;
244 fncPtrType getFnWhnTrnOff();
255 fncPtrType getFnWhnTrnOn();
264 const bool getIsEnabled() const;
273 const bool getIsOn () const;
285 const bool getIsOnDisabled() const;
293 const uint32_t getOtptsSttsPkgd();
304 const bool getOutputsChange() const;
313 // const bool getOutputsChngTskTrggr() const;
323 unsigned long int getStrtDelay();
334 const TaskHandle_t getTaskToNotify() const;
345 const TaskHandle_t getTaskWhileOn();
351 bool init(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
360 bool pause();
366 void resetDbncTime();
372 void resetFda();
378 // void resetOutputsChngTskTrggr();
389 bool resume();
401 bool setDbncTime(const unsigned long int &newDbncTime);
409// void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)());
410 void setFnWhnTrnOffPtr(fncPtrType newFnWhnTrnOff);
411
419 // void setFnWhnTrnOnPtr(void (*newFnWhnTrnOn)());
420 void setFnWhnTrnOnPtr(fncPtrType newFnWhnTrnOn);
431 void setIsOnDisabled(const bool &newIsOnDisabled);
439 void setOutputsChange(bool newOutputsChange);
449 void setTaskToNotify(const TaskHandle_t &newTaskHandle);
465 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
466};
467
468//==========================================================>>
469
480public:
495 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);
504 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);
514 void setStrtDelay(const unsigned long int &newStrtDelay);
515};
516
517//==========================================================>>
518
536protected:
537 enum fdaLmpbStts {
538 stOffNotVPP,
539 stOffVPP,
540 stOnNVRP,
541 stOnVRP,
542 stLtchNVUP,
543 stLtchdVUP,
544 stOffVUP,
545 stOffNVURP,
546 stOffVURP,
547 stDisabled
548 };
549 bool _isLatched{false};
550 fdaLmpbStts _mpbFdaState {stOffNotVPP};
551 bool _trnOffASAP{true};
552 volatile bool _validUnlatchPend{false};
553 volatile bool _validUnlatchRlsPend{false};
554
555 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
556
557 virtual void stDisabled_In(){};
558 virtual void stDisabled_Out(){};
559 virtual void stLtchNVUP_Do(){};
560 virtual void stOffNotVPP_In(){};
561 virtual void stOffNotVPP_Out(){};
562 virtual void stOffNVURP_Do(){};
563 virtual void stOffVPP_Out(){};
564 virtual void stOffVURP_Out(){};
565 virtual void stOnNVRP_Do(){};
566 virtual void updFdaState();
567 virtual void updValidUnlatchStatus() = 0;
568public:
572 LtchMPBttn();
578 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);
582 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
586 void clrStatus(bool clrIsOn = true);
595 const bool getIsLatched() const;
605 bool getTrnOffASAP();
613 const bool getUnlatchPend() const;
621 const bool getUnlatchRlsPend() const;
633 void setTrnOffASAP(const bool &newVal);
641 void setUnlatchPend(const bool &newVal);
649 void setUnlatchRlsPend(const bool &newVal);
660 bool unlatch();
661};
662
663//==========================================================>>
664
673protected:
674 virtual void stOffNVURP_Do();
675 virtual void updValidUnlatchStatus();
676public:
687 TgglLtchMPBttn(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
688};
689
690//==========================================================>>
691
702protected:
703 bool _tmRstbl {true};
704 unsigned long int _srvcTime {};
705 unsigned long int _srvcTimerStrt{0};
706
707 virtual void stOffNotVPP_Out();
708 virtual void stOffVPP_Out();
709 virtual void updValidUnlatchStatus();
710public:
715 TmLtchMPBttn();
723 TmLtchMPBttn(const int8_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);
727 void clrStatus(bool clrIsOn = true);
733 const unsigned long int getSrvcTime() const;
744 bool setSrvcTime(const unsigned long int &newSrvcTime);
752 void setTmerRstbl(const bool &newIsRstbl);
753};
754
755//==========================================================>>
756
768protected:
769 void (*_fnWhnTrnOffPilot)() {nullptr};
770 void (*_fnWhnTrnOffWrnng)() {nullptr};
771 void (*_fnWhnTrnOnPilot)() {nullptr};
772 void (*_fnWhnTrnOnWrnng)() {nullptr};
773 bool _keepPilot{false};
774 volatile bool _pilotOn{false};
775 unsigned long int _wrnngMs{0};
776 volatile bool _wrnngOn {false};
777 unsigned int _wrnngPrctg {0};
778
779 bool _validWrnngSetPend{false};
780 bool _validWrnngResetPend{false};
781 bool _validPilotSetPend{false};
782 bool _validPilotResetPend{false};
783
784 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
785 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
786 virtual void stDisabled_In();
787 virtual void stLtchNVUP_Do();
788 virtual void stOffNotVPP_In();
789 virtual void stOffVPP_Out();
790 virtual void stOnNVRP_Do();
791 void _turnOffPilot();
792 void _turnOffWrnng();
793 void _turnOnPilot();
794 void _turnOnWrnng();
795 bool updPilotOn();
796 bool updWrnngOn();
797public:
810 HntdTmLtchMPBttn(const int8_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);
814 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
818 void clrStatus(bool clrIsOn = true);
829 fncPtrType getFnWhnTrnOffPilot();
840 fncPtrType getFnWhnTrnOffWrnng();
851 fncPtrType getFnWhnTrnOnPilot();
862 fncPtrType getFnWhnTrnOnWrnng();
872 const bool getPilotOn() const;
884 const bool getWrnngOn() const;
892 void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)());
900 void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)());
908 void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)());
916 void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)());
922 void setKeepPilot(const bool &newKeepPilot);
928 bool setSrvcTime(const unsigned long int &newSvcTime);
940 bool setWrnngPrctg (const unsigned int &newWrnngPrctg);
941};
942
943//==========================================================>>
944
954protected:
955 DbncdDlydMPBttn* _unLtchBttn {nullptr};
956 bool _xtrnUnltchPRlsCcl {false};
957
958 virtual void stOffNVURP_Do();
959 virtual void updValidUnlatchStatus();
960public:
979 XtrnUnltchMPBttn(const int8_t &mpbttnPin, DbncdDlydMPBttn* unLtchBttn,
980 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
988 XtrnUnltchMPBttn(const int8_t &mpbttnPin,
989 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
990
994 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
998 void clrStatus(bool clrIsOn = true);
999};
1000
1001//==========================================================>>
1002
1028protected:
1029 enum fdaDALmpbStts{
1030 stOffNotVPP,
1031 stOffVPP,
1032 stOnMPBRlsd,
1033 //--------
1034 stOnStrtScndMod,
1035 stOnScndMod,
1036 stOnEndScndMod,
1037 //--------
1038 stOnTurnOff,
1039 //--------
1040 stDisabled
1041 };
1042 volatile bool _isOnScndry{false};
1043 fdaDALmpbStts _mpbFdaState {stOffNotVPP};
1044 unsigned long _scndModActvDly {2000};
1045 unsigned long _scndModTmrStrt {0};
1046 bool _validScndModPend{false};
1047
1048 void (*_fnWhnTrnOffScndry)() {nullptr};
1049 void (*_fnWhnTrnOnScndry)() {nullptr};
1050 TaskHandle_t _taskWhileOnScndryHndl{NULL};
1051
1052 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
1053 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1054 virtual void stDisabled_In(){};
1055 virtual void stOnEndScndMod_Out(){};
1056 virtual void stOnScndMod_Do() = 0;
1057 virtual void stOnStrtScndMod_In(){};
1058 virtual void _turnOffScndry();
1059 virtual void _turnOnScndry();
1060 virtual void updFdaState();
1061 virtual bool updValidPressesStatus();
1062 virtual void updValidUnlatchStatus();
1063
1064public:
1075 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);
1084 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1088 void clrStatus(bool clrIsOn = true);
1097 fncPtrType getFnWhnTrnOffScndry();
1106 fncPtrType getFnWhnTrnOnScndry();
1114 bool getIsOnScndry();
1122 unsigned long getScndModActvDly();
1133 const TaskHandle_t getTaskWhileOnScndry();
1141 void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)());
1149 void setFnWhnTrnOnScndryPtr(void (*newFnWhnTrnOn)());
1160 bool setScndModActvDly(const unsigned long &newVal);
1178 void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle);
1179
1180};
1181
1182//==========================================================>>
1183
1197protected:
1198 virtual void stOnEndScndMod_Out();
1199 virtual void stOnScndMod_Do();
1200 virtual void stOnStrtScndMod_In();
1201public:
1212 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);
1220 void clrStatus(bool clrIsOn = true);
1221};
1222
1223//==========================================================>>
1224
1243
1244protected:
1245 bool _autoSwpDirOnEnd{true}; // Changes slider direction automatically when reaches _otptValMax or _otptValMin
1246 bool _autoSwpDirOnPrss{false};// Changes slider direction each time it enters slider mode
1247 bool _curSldrDirUp{true};
1248 uint16_t _initOtptCurVal{};
1249 uint16_t _otptCurVal{};
1250 unsigned long _otptSldrSpd{1};
1251 uint16_t _otptSldrStpSize{0x01};
1252 uint16_t _otptValMax{0xFFFF};
1253 uint16_t _otptValMin{0x0000};
1254
1255 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1256 bool _setSldrDir(const bool &newVal);
1257 void stOnEndScndMod_Out();
1258 virtual void stOnScndMod_Do();
1259 virtual void stOnStrtScndMod_In();
1260public:
1273 SldrDALtchMPBttn(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 uint16_t initVal = 0xFFFF);
1282 void clrStatus(bool clrIsOn = true);
1288 uint16_t getOtptCurVal();
1298 bool getOtptCurValIsMax();
1308 bool getOtptCurValIsMin();
1318 unsigned long getOtptSldrSpd();
1328 uint16_t getOtptSldrStpSize();
1334 uint16_t getOtptValMax();
1340 uint16_t getOtptValMin();
1350 bool getSldrDirUp();
1362 bool setOtptCurVal(const uint16_t &newVal);
1377 bool setOtptSldrSpd(const uint16_t &newVal);
1394 bool setOtptSldrStpSize(const uint16_t &newVal);
1410 bool setOtptValMax(const uint16_t &newVal);
1426 bool setOtptValMin(const uint16_t &newVal);
1439 bool setSldrDirDn();
1452 bool setSldrDirUp();
1462 void setSwpDirOnEnd(const bool &newVal);
1471 void setSwpDirOnPrss(const bool &newVal);
1479 bool swapSldrDir();
1480};
1481
1482//==========================================================>>
1483
1503private:
1504 void setFrcdOtptWhnVdd(const bool &newVal);
1505 void setStOnWhnOtpFrcd(const bool &newVal);
1506protected:
1507 enum fdaVmpbStts{
1508 stOffNotVPP,
1509 stOffVPP,
1510 stOnNVRP,
1511 //--------
1512 stOnVVP,
1513 stOnVddNVUP,
1514 stOffVddNVUP,
1515 stOffVddVUP,
1516 stOffUnVdd,
1517 //--------
1518 stOnVRP,
1519 stOnTurnOff,
1520 stOff,
1521 //--------
1522 stDisabled
1523 };
1524 fdaVmpbStts _mpbFdaState {stOffNotVPP};
1525
1526 void (*_fnWhnTrnOffVdd)() {nullptr};
1527 void (*_fnWhnTrnOnVdd)() {nullptr};
1528 bool _frcOtptLvlWhnVdd {true};
1529 bool _isVoided{false};
1530 bool _stOnWhnOtptFrcd{false};
1531 bool _validVoidPend{false};
1532 bool _validUnvoidPend{false};
1533
1534 static void mpbPollCallback(TimerHandle_t mpbTmrCb);
1535 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1536 bool setVoided(const bool &newVoidValue);
1537 virtual void stDisabled_In();
1538 virtual void stDisabled_Out();
1539 virtual void stOffNotVPP_In(){};
1540 virtual void stOffVddNVUP_Do(){}; // This provides a setting point for calculating the _validUnvoidPend
1541 virtual void stOffVPP_Do(){}; // This provides a setting point for the voiding mechanism to be started
1542 void _turnOffVdd();
1543 void _turnOnVdd();
1544 virtual void updFdaState();
1545 virtual bool updVoidStatus() = 0;
1546public:
1550 VdblMPBttn();
1558 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);
1562 virtual ~VdblMPBttn();
1566 void clrStatus(bool clrIsOn = true);
1575 fncPtrType getFnWhnTrnOffVdd();
1584 fncPtrType getFnWhnTrnOnVdd();
1594 bool getFrcOtptLvlWhnVdd();
1602 const bool getIsVoided() const;
1614 bool getStOnWhnOtpFrcd();
1622 void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)());
1630 void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)());
1641 bool setIsNotVoided();
1649 bool setIsVoided();
1650};
1651
1652//==========================================================>>
1653
1663protected:
1664 unsigned long int _voidTime;
1665 unsigned long int _voidTmrStrt{0};
1666
1667 virtual void stOffNotVPP_In();
1668 virtual void stOffVddNVUP_Do(); // This provides a setting point for calculating the _validUnvoidPend
1669 virtual void stOffVPP_Do(); // This provides a setting point for the voiding mechanism to be started
1670 bool updIsPressed();
1671 virtual bool updVoidStatus();
1672public:
1676 TmVdblMPBttn();
1684 TmVdblMPBttn(const int8_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);
1688 virtual ~TmVdblMPBttn();
1692 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1696 void clrStatus();
1704 const unsigned long int getVoidTime() const;
1715 bool setVoidTime(const unsigned long int &newVoidTime);
1716};
1717
1718//==========================================================>>
1719
1736protected:
1737 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
1738 virtual void stOffVddNVUP_Do(); // This provides the calculation for the _validUnvoidPend
1739 virtual bool updVoidStatus();
1740public:
1751 SnglSrvcVdblMPBttn(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1755 virtual ~SnglSrvcVdblMPBttn();
1759 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1760};
1761
1762//==========================================================>>
1763
1764#endif /*_BUTTONTOSWITCH_ESP32_H_*/
MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts)
Unpackages a 32-bit value into a DbncdMPBttn object status.
Definition ButtonToSwitch_ESP32.cpp:3120
Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-D...
Definition ButtonToSwitch_ESP32.h:1196
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2209
~DDlydDALtchMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2205
DDlydDALtchMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:2196
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs).
Definition ButtonToSwitch_ESP32.h:1027
bool setScndModActvDly(const unsigned long &newVal)
Sets a new value for the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1889
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:1878
const TaskHandle_t getTaskWhileOnScndry()
Returns the task to be run while the object is in the Secondary On state.
Definition ButtonToSwitch_ESP32.cpp:1823
fncPtrType getFnWhnTrnOnScndry()
Returns the function that is set to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch_ESP32.cpp:1808
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1789
bool getIsOnScndry()
Returns the current value of the isOnScndry attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1813
DblActnLtchMPBttn()
Abstract Class default constructor.
Definition ButtonToSwitch_ESP32.cpp:1752
void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:1905
unsigned long getScndModActvDly()
Returns the current value of the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1818
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1765
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:1868
fncPtrType getFnWhnTrnOffScndry()
returns the function that is set to execute every time the object enters the Secondary Off State.
Definition ButtonToSwitch_ESP32.cpp:1803
~DblActnLtchMPBttn()
Virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:1761
Models a Debounced Delayed MPB (DD-MPB).
Definition ButtonToSwitch_ESP32.h:479
DbncdDlydMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:752
void setStrtDelay(const unsigned long int &newStrtDelay)
Sets a new value to the "Start Delay" strtDelay attribute.
Definition ButtonToSwitch_ESP32.cpp:773
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)
Definition ButtonToSwitch_ESP32.cpp:763
Base class, models a Debounced Momentary Push Button (D-MPB).
Definition ButtonToSwitch_ESP32.h:96
void setFnWhnTrnOffPtr(fncPtrType newFnWhnTrnOff)
Sets the function that will be called to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:375
fncPtrType getFnWhnTrnOn()
Returns the function that is set to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:159
void resetFda()
Resets the MPB behavior automaton to it's Initial or Start State
Definition ButtonToSwitch_ESP32.cpp:325
void clrStatus(bool clrIsOn=true)
Clears and resets flags, timers and counters modified through the object's signals processing.
Definition ButtonToSwitch_ESP32.cpp:93
const unsigned long int getCurDbncTime() const
Returns the current debounce period time set for the object.
Definition ButtonToSwitch_ESP32.cpp:149
const TaskHandle_t getTaskWhileOn()
Returns the task to be run (resumed) while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:210
void enable()
Enables the input signal processing.
Definition ButtonToSwitch_ESP32.cpp:126
bool pause()
Pauses the software timer updating the computation of the object's internal flags value.
Definition ButtonToSwitch_ESP32.cpp:301
const TaskHandle_t getTaskToNotify() const
Returns the task to be notified by the object when its output flags changes.
Definition ButtonToSwitch_ESP32.cpp:204
virtual ~DbncdMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:64
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:495
void setIsOnDisabled(const bool &newIsOnDisabled)
Sets the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:420
bool end()
Detaches the object from the timer that monitors the input pins, compute and updates the object's sta...
Definition ButtonToSwitch_ESP32.cpp:131
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:69
void resetDbncTime()
Resets the debounce process time of the object to the value used at instantiation.
Definition ButtonToSwitch_ESP32.cpp:319
DbncdMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:38
void disable()
Disables the input signal processing, ignoring the changes of its values.
Definition ButtonToSwitch_ESP32.cpp:121
bool resume()
Resets the outputs change task unblocking trigger (outputsChngTskTrggr) attribute flag.
Definition ButtonToSwitch_ESP32.cpp:343
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:164
const bool getIsOnDisabled() const
Returns the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:174
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.
Definition ButtonToSwitch_ESP32.cpp:215
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:472
const bool getOutputsChange() const
Returns the value of the outputsChange attribute flag.
Definition ButtonToSwitch_ESP32.cpp:189
const bool getIsOn() const
Returns the value of the isOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:169
unsigned long int getStrtDelay()
Returns the current value of the outputs change task unblocking trigger (outputsChngTskTrggr) attribu...
Definition ButtonToSwitch_ESP32.cpp:194
const uint32_t getOtptsSttsPkgd()
Returns the relevant attribute flags values for the object state encoded as a 32 bits value,...
Definition ButtonToSwitch_ESP32.cpp:184
void setFnWhnTrnOnPtr(fncPtrType newFnWhnTrnOn)
Sets the function that will be called to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:387
fncPtrType getFnWhnTrnOff()
Returns the function that is set to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:154
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:440
bool setDbncTime(const unsigned long int &newDbncTime)
Sets the debounce process time.
Definition ButtonToSwitch_ESP32.cpp:359
Models a Hinted Timer Latch DD-MPB, a.k.a. Staircase Switch (HTiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:767
bool setSrvcTime(const unsigned long int &newSvcTime)
See TmLtchMPBttn::setSrvcTime(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1441
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:1319
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:1397
fncPtrType getFnWhnTrnOffWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1314
const bool getWrnngOn() const
Returns the current value of the warningOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1334
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:1408
const bool getPilotOn() const
Returns the current value of the pilotOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1329
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1289
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:1309
HntdTmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1255
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:1419
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:1456
fncPtrType getFnWhnTrnOnWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1324
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1265
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:1386
void setKeepPilot(const bool &newKeepPilot)
Sets the configuration of the keepPilot service attribute.
Definition ButtonToSwitch_ESP32.cpp:1430
Abstract class, base to model Latched Debounced Delayed MPBs (LDD-MPB).
Definition ButtonToSwitch_ESP32.h:535
const bool getIsLatched() const
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of t...
Definition ButtonToSwitch_ESP32.cpp:832
bool unlatch()
Sets the values of the flags needed to unlatch a latched MPB.
Definition ButtonToSwitch_ESP32.cpp:919
const bool getUnlatchRlsPend() const
Returns the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:847
const bool getUnlatchPend() const
Returns the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:842
void setUnlatchPend(const bool &newVal)
Sets the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:897
void setTrnOffASAP(const bool &newVal)
Sets the value of the trnOffASAP attribute.
Definition ButtonToSwitch_ESP32.cpp:886
bool getTrnOffASAP()
Returns the value of the trnOffASAP attribute flag.
Definition ButtonToSwitch_ESP32.cpp:837
void setUnlatchRlsPend(const bool &newVal)
Sets the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:908
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:795
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:819
LtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:786
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:1242
void clrStatus(bool clrIsOn=true)
Definition ButtonToSwitch_ESP32.cpp:2257
bool setOtptSldrSpd(const uint16_t &newVal)
Sets the output slider speed (otptSldrSpd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2333
uint16_t getOtptValMax()
Returns the top output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2295
bool getOtptCurValIsMin()
Returns the result of comparing the Output Current Value to the Minimum value setting
Definition ButtonToSwitch_ESP32.cpp:2280
bool setSldrDirDn()
Sets the value of the curSldrDirUp attribute to false.
Definition ButtonToSwitch_ESP32.cpp:2431
bool setOtptValMax(const uint16_t &newVal)
Sets the output current value register maximum value attribute (otptValMax attribute).
Definition ButtonToSwitch_ESP32.cpp:2365
bool swapSldrDir()
Inverts the current curSldrDirUp attribute value.
Definition ButtonToSwitch_ESP32.cpp:2528
~SldrDALtchMPBttn()
Virtual class destructor.
Definition ButtonToSwitch_ESP32.cpp:2253
bool setOtptCurVal(const uint16_t &newVal)
Sets the output current value register.
Definition ButtonToSwitch_ESP32.cpp:2317
uint16_t getOtptCurVal()
Returns the Output Current Value (otpCurVal) attribute.
Definition ButtonToSwitch_ESP32.cpp:2270
bool setSldrDirUp()
Sets the value of the curSldrDirUp attribute to true.
Definition ButtonToSwitch_ESP32.cpp:2436
SldrDALtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2243
bool getSldrDirUp()
Returns the value of the curSldrDirUp attribute.
Definition ButtonToSwitch_ESP32.cpp:2305
bool setOtptSldrStpSize(const uint16_t &newVal)
Sets the output slider step size (otptSldrStpSize) attribute value.
Definition ButtonToSwitch_ESP32.cpp:2349
bool getOtptCurValIsMax()
Returns a boolean value indicating if the "Output Current Value" equals the maximum limit.
Definition ButtonToSwitch_ESP32.cpp:2275
void setSwpDirOnPrss(const bool &newVal)
Sets the value of the "Auto-Swap Direction On Press" (autoSwpDirOnPrss) attribute.
Definition ButtonToSwitch_ESP32.cpp:2448
bool setOtptValMin(const uint16_t &newVal)
Sets the output current value register minimum value attribute (otptValMin attribute).
Definition ButtonToSwitch_ESP32.cpp:2387
uint16_t getOtptValMin()
Returns the bottom output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2300
unsigned long getOtptSldrSpd()
Returns the current setting for the Output Slider Speed value.
Definition ButtonToSwitch_ESP32.cpp:2285
uint16_t getOtptSldrStpSize()
Returns the current setting for the Output Slider Step Size value.
Definition ButtonToSwitch_ESP32.cpp:2290
void setSwpDirOnEnd(const bool &newVal)
Sets the value of the "Auto-Swap Direction on Ends" (autoSwpDirOnEnd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2441
Models a Single Service Voidable DD-MPB a.k.a. Trigger switch (SSVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1735
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:3085
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3063
virtual ~SnglSrvcVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:3059
SnglSrvcVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:3047
Models a Toggle Latch DD-MPB, a.k.a. a Toggle Switch (ToLDD-MPB).
Definition ButtonToSwitch_ESP32.h:672
TgglLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1127
Models a Timer Latch DD-MPB, a.k.a. Timer Switch (TiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:701
TmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1169
const unsigned long int getSrvcTime() const
Returns the configured Service Time.
Definition ButtonToSwitch_ESP32.cpp:1192
void setTmerRstbl(const bool &newIsRstbl)
Configures the timer for the Service Time to be reseted before it reaches unlatching time.
Definition ButtonToSwitch_ESP32.cpp:1213
bool setSrvcTime(const unsigned long int &newSrvcTime)
Sets a new value to the Service Time attribute.
Definition ButtonToSwitch_ESP32.cpp:1197
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1181
Models a Time Voidable DD-MPB, a.k.a. Anti-tampering switch (TVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1662
TmVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2939
virtual ~TmVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2948
void clrStatus()
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2974
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:2952
const unsigned long int getVoidTime() const
Returns the voidTime attribute current value.
Definition ButtonToSwitch_ESP32.cpp:2985
bool setVoidTime(const unsigned long int &newVoidTime)
Sets a new value to the Void Time attribute.
Definition ButtonToSwitch_ESP32.cpp:2990
Abstract class, base to model Voidable DD-MPBs (VDD-MPB).
Definition ButtonToSwitch_ESP32.h:1502
bool setIsVoided()
Sets the value of the isVoided attribute flag to true.
Definition ButtonToSwitch_ESP32.cpp:2667
const bool getIsVoided() const
Returns the current value of the isVoided attribute flag.
Definition ButtonToSwitch_ESP32.cpp:2576
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:2566
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2549
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:2640
virtual ~VdblMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2545
VdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2535
fncPtrType getFnWhnTrnOffVdd()
Returns the function that is set to execute every time the object exits the Voided State.
Definition ButtonToSwitch_ESP32.cpp:2561
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:2628
bool getFrcOtptLvlWhnVdd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2571
bool getStOnWhnOtpFrcd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2581
bool setIsNotVoided()
Sets the value of the isVoided attribute flag to false.
Definition ButtonToSwitch_ESP32.cpp:2662
Models an External Unlatch LDD-MPB, a.k.a. Emergency Latched Switch (XULDD-MPB)
Definition ButtonToSwitch_ESP32.h:953
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1705
XtrnUnltchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1661
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1677
Type to hold the complete set of output attribute flags from any DbncdMPBttn class and subclasses obj...
Definition ButtonToSwitch_ESP32.h:62