ButtonToSwitch Library for ESP32 (Arduino) v4.4.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
48//FFDR For Future Development Reminder!!
49//FTPO For Testing Purposes Only code!!
50
51#ifndef _BUTTONTOSWITCH_ESP32_H_
52#define _BUTTONTOSWITCH_ESP32_H_
53
54#include <Arduino.h>
55#include <stdint.h>
56
57#define _HwMinDbncTime 20 //Documented minimum wait time for a MPB signal to stabilize
58#define _StdPollDelay 10
59#define _MinSrvcTime 100
60#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"
61#define _maxValidPinNum GPIO_NUM_MAX-1
62
63/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking BEGIN -------*/
64const uint8_t IsOnBitPos {0};
65const uint8_t IsEnabledBitPos{1};
66const uint8_t PilotOnBitPos{2};
67const uint8_t WrnngOnBitPos{3};
68const uint8_t IsVoidedBitPos{4};
69const uint8_t IsOnScndryBitPos{5};
70const uint8_t OtptCurValBitPos{16};
71
72#ifndef MPBOTPTS_T
73 #define MPBOTPTS_T
80 struct MpbOtpts_t{
81 bool isOn;
82 bool isEnabled;
83 bool pilotOn;
84 bool wrnngOn;
85 bool isVoided;
86 bool isOnScndry;
87 uint16_t otptCurVal;
88 };
89#endif
90/*---------------- xTaskNotify() mechanism related constants, argument structs, information packing and unpacking END -------*/
91
92// Definition workaround to let a function/method return value to be a function pointer
93typedef void (*fncPtrType)();
94typedef fncPtrType (*ptrToTrnFnc)();
95
96//===========================>> BEGIN General use function prototypes
97MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts);
98//===========================>> END General use function prototypes
99
100//===========================>> BEGIN General use Global variables
101//===========================>> END General use Global variables
102
103//==========================================================>> Classes declarations BEGIN
104
115protected:
116 enum fdaDmpbStts {
117 stOffNotVPP,
118 stOffVPP,
119 stOn,
120 stOnVRP,
121 stDisabled
122 };
123 const unsigned long int _stdMinDbncTime {_HwMinDbncTime};
124
125 int8_t _mpbttnPin{};
126 bool _pulledUp{};
127 bool _typeNO{};
128 unsigned long int _dbncTimeOrigSett{};
129
130 bool _beginDisabled{false};
131 unsigned long int _dbncRlsTimerStrt{0};
132 unsigned long int _dbncRlsTimeTempSett{0};
133 unsigned long int _dbncTimerStrt{0};
134 unsigned long int _dbncTimeTempSett{0};
135 fncPtrType _fnWhnTrnOff{nullptr};
136 fncPtrType _fnWhnTrnOn{nullptr};
137 bool _isEnabled{true};
138 volatile bool _isOn{false};
139 bool _isOnDisabled{false};
140 volatile bool _isPressed{false};
141 fdaDmpbStts _mpbFdaState {stOffNotVPP};
142 TimerHandle_t _mpbPollTmrHndl {NULL}; //FreeRTOS returns NULL if creation fails (not nullptr)
143 String _mpbPollTmrName {""};
144 bool _outputsChange {false};
145 uint32_t _outputsChangeCnt{0};
146 bool _outputsChngTskTrggr{false};
147 bool _prssRlsCcl{false};
148 unsigned long int _strtDelay {0};
149 bool _sttChng {true};
150 TaskHandle_t _taskToNotifyHndl {NULL};
151 TaskHandle_t _taskWhileOnHndl{NULL};
152 volatile bool _validDisablePend{false};
153 volatile bool _validEnablePend{false};
154 volatile bool _validPressPend{false};
155 volatile bool _validReleasePend{false};
156
157 void clrSttChng();
158 const bool getIsPressed() const;
159 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
160 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
161 void _setIsEnabled(const bool &newEnabledValue);
162 void setSttChng();
163 void _turnOff();
164 void _turnOn();
165 virtual void updFdaState();
166 bool updIsPressed();
167 virtual bool updValidPressesStatus();
168 const bool getOutputsChngTskTrggr() const;
169 void resetOutputsChngTskTrggr();
170
171public:
176 DbncdMPBttn();
186 DbncdMPBttn(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
191 virtual ~DbncdMPBttn();
203 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
214 void clrStatus(bool clrIsOn = true);
225 void disable();
234 void enable();
244 bool end();
252 const unsigned long int getCurDbncTime() const;
263 fncPtrType getFnWhnTrnOff();
274 fncPtrType getFnWhnTrnOn();
283 const bool getIsEnabled() const;
292 const bool getIsOn () const;
304 const bool getIsOnDisabled() const;
312 const uint32_t getOtptsSttsPkgd();
323 const bool getOutputsChange() const;
332 // const bool getOutputsChngTskTrggr() const;
342 unsigned long int getStrtDelay();
353 const TaskHandle_t getTaskToNotify() const;
364 const TaskHandle_t getTaskWhileOn();
370 bool init(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
379 bool pause();
385 void resetDbncTime();
391 void resetFda();
397 // void resetOutputsChngTskTrggr();
408 bool resume();
416 void setBeginDisabled(const bool &newBeginDisabled = false);
428 bool setDbncTime(const unsigned long int &newDbncTime);
436// void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)());
437 void setFnWhnTrnOffPtr(fncPtrType newFnWhnTrnOff);
438
446 // void setFnWhnTrnOnPtr(void (*newFnWhnTrnOn)());
447 void setFnWhnTrnOnPtr(fncPtrType newFnWhnTrnOn);
458 void setIsOnDisabled(const bool &newIsOnDisabled);
466 void setOutputsChange(bool newOutputsChange);
476 void setTaskToNotify(const TaskHandle_t &newTaskHandle);
492 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
493};
494
495//==========================================================>>
496
507public:
522 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);
531 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);
541 void setStrtDelay(const unsigned long int &newStrtDelay);
542};
543
544//==========================================================>>
545
563protected:
564 enum fdaLmpbStts {
565 stOffNotVPP,
566 stOffVPP,
567 stOnNVRP,
568 stOnVRP,
569 stLtchNVUP,
570 stLtchdVUP,
571 stOffVUP,
572 stOffNVURP,
573 stOffVURP,
574 stDisabled
575 };
576 bool _isLatched{false};
577 fdaLmpbStts _mpbFdaState {stOffNotVPP};
578 bool _trnOffASAP{true};
579 volatile bool _validUnlatchPend{false};
580 volatile bool _validUnlatchRlsPend{false};
581
582 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
583
584 virtual void stDisabled_In(){};
585 virtual void stDisabled_Out(){};
586 virtual void stLtchNVUP_Do(){};
587 virtual void stOffNotVPP_In(){};
588 virtual void stOffNotVPP_Out(){};
589 virtual void stOffNVURP_Do(){};
590 virtual void stOffVPP_Out(){};
591 virtual void stOffVURP_Out(){};
592 virtual void stOnNVRP_Do(){};
593 virtual void updFdaState();
594 virtual void updValidUnlatchStatus() = 0;
595public:
599 LtchMPBttn();
605 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);
609 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
613 void clrStatus(bool clrIsOn = true);
622 const bool getIsLatched() const;
632 bool getTrnOffASAP();
640 const bool getUnlatchPend() const;
648 const bool getUnlatchRlsPend() const;
660 void setTrnOffASAP(const bool &newVal);
668 void setUnlatchPend(const bool &newVal);
676 void setUnlatchRlsPend(const bool &newVal);
687 bool unlatch();
688};
689
690//==========================================================>>
691
700protected:
701 virtual void stOffNVURP_Do();
702 virtual void updValidUnlatchStatus();
703public:
714 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);
715};
716
717//==========================================================>>
718
729protected:
730 bool _tmRstbl {true};
731 unsigned long int _srvcTime {};
732 unsigned long int _srvcTimerStrt{0};
733
734 virtual void stOffNotVPP_Out();
735 virtual void stOffVPP_Out();
736 virtual void updValidUnlatchStatus();
737public:
742 TmLtchMPBttn();
750 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);
754 void clrStatus(bool clrIsOn = true);
760 const unsigned long int getSrvcTime() const;
771 bool setSrvcTime(const unsigned long int &newSrvcTime);
779 void setTmerRstbl(const bool &newIsRstbl);
780};
781
782//==========================================================>>
783
795protected:
796 void (*_fnWhnTrnOffPilot)() {nullptr};
797 void (*_fnWhnTrnOffWrnng)() {nullptr};
798 void (*_fnWhnTrnOnPilot)() {nullptr};
799 void (*_fnWhnTrnOnWrnng)() {nullptr};
800 bool _keepPilot{false};
801 volatile bool _pilotOn{false};
802 unsigned long int _wrnngMs{0};
803 volatile bool _wrnngOn {false};
804 unsigned int _wrnngPrctg {0};
805
806 bool _validWrnngSetPend{false};
807 bool _validWrnngResetPend{false};
808 bool _validPilotSetPend{false};
809 bool _validPilotResetPend{false};
810
811 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
812 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
813 virtual void stDisabled_In();
814 virtual void stLtchNVUP_Do();
815 virtual void stOffNotVPP_In();
816 virtual void stOffVPP_Out();
817 virtual void stOnNVRP_Do();
818 void _turnOffPilot();
819 void _turnOffWrnng();
820 void _turnOnPilot();
821 void _turnOnWrnng();
822 bool updPilotOn();
823 bool updWrnngOn();
824public:
837 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);
841 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
845 void clrStatus(bool clrIsOn = true);
856 fncPtrType getFnWhnTrnOffPilot();
867 fncPtrType getFnWhnTrnOffWrnng();
878 fncPtrType getFnWhnTrnOnPilot();
889 fncPtrType getFnWhnTrnOnWrnng();
899 const bool getPilotOn() const;
911 const bool getWrnngOn() const;
919 void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)());
927 void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)());
935 void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)());
943 void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)());
949 void setKeepPilot(const bool &newKeepPilot);
955 bool setSrvcTime(const unsigned long int &newSvcTime);
967 bool setWrnngPrctg (const unsigned int &newWrnngPrctg);
968};
969
970//==========================================================>>
971
981protected:
982 DbncdDlydMPBttn* _unLtchBttn {nullptr};
983 bool _xtrnUnltchPRlsCcl {false};
984
985 virtual void stOffNVURP_Do();
986 virtual void updValidUnlatchStatus();
987public:
1006 XtrnUnltchMPBttn(const int8_t &mpbttnPin, DbncdDlydMPBttn* unLtchBttn,
1007 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
1015 XtrnUnltchMPBttn(const int8_t &mpbttnPin,
1016 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
1017
1021 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1025 void clrStatus(bool clrIsOn = true);
1026};
1027
1028//==========================================================>>
1029
1055protected:
1056 enum fdaDALmpbStts{
1057 stOffNotVPP,
1058 stOffVPP,
1059 stOnMPBRlsd,
1060 //--------
1061 stOnStrtScndMod,
1062 stOnScndMod,
1063 stOnEndScndMod,
1064 //--------
1065 stOnTurnOff,
1066 //--------
1067 stDisabled
1068 };
1069 volatile bool _isOnScndry{false};
1070 fdaDALmpbStts _mpbFdaState {stOffNotVPP};
1071 unsigned long _scndModActvDly {2000};
1072 unsigned long _scndModTmrStrt {0};
1073 bool _validScndModPend{false};
1074
1075 void (*_fnWhnTrnOffScndry)() {nullptr};
1076 void (*_fnWhnTrnOnScndry)() {nullptr};
1077 TaskHandle_t _taskWhileOnScndryHndl{NULL};
1078
1079 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
1080 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1081 virtual void stDisabled_In(){};
1082 virtual void stOnEndScndMod_Out(){};
1083 virtual void stOnScndMod_Do() = 0;
1084 virtual void stOnStrtScndMod_In(){};
1085 virtual void _turnOffScndry();
1086 virtual void _turnOnScndry();
1087 virtual void updFdaState();
1088 virtual bool updValidPressesStatus();
1089 virtual void updValidUnlatchStatus();
1090
1091public:
1102 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);
1111 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1115 void clrStatus(bool clrIsOn = true);
1124 fncPtrType getFnWhnTrnOffScndry();
1133 fncPtrType getFnWhnTrnOnScndry();
1141 bool getIsOnScndry();
1149 unsigned long getScndModActvDly();
1160 const TaskHandle_t getTaskWhileOnScndry();
1168 void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)());
1176 void setFnWhnTrnOnScndryPtr(void (*newFnWhnTrnOn)());
1187 bool setScndModActvDly(const unsigned long &newVal);
1205 void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle);
1206
1207};
1208
1209//==========================================================>>
1210
1224protected:
1225 virtual void stOnEndScndMod_Out();
1226 virtual void stOnScndMod_Do();
1227 virtual void stOnStrtScndMod_In();
1228public:
1239 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);
1247 void clrStatus(bool clrIsOn = true);
1248};
1249
1250//==========================================================>>
1251
1270
1271protected:
1272 bool _autoSwpDirOnEnd{true}; // Changes slider direction automatically when reaches _otptValMax or _otptValMin
1273 bool _autoSwpDirOnPrss{false};// Changes slider direction each time it enters slider mode
1274 bool _curSldrDirUp{true};
1275 uint16_t _initOtptCurVal{};
1276 uint16_t _otptCurVal{};
1277 unsigned long _otptSldrSpd{1};
1278 uint16_t _otptSldrStpSize{0x01};
1279 uint16_t _otptValMax{0xFFFF};
1280 uint16_t _otptValMin{0x0000};
1281
1282 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1283 bool _setSldrDir(const bool &newVal);
1284 void stOnEndScndMod_Out();
1285 virtual void stOnScndMod_Do();
1286 virtual void stOnStrtScndMod_In();
1287public:
1300 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);
1309 void clrStatus(bool clrIsOn = true);
1315 uint16_t getOtptCurVal();
1325 bool getOtptCurValIsMax();
1335 bool getOtptCurValIsMin();
1345 unsigned long getOtptSldrSpd();
1355 uint16_t getOtptSldrStpSize();
1361 uint16_t getOtptValMax();
1367 uint16_t getOtptValMin();
1377 bool getSldrDirUp();
1389 bool setOtptCurVal(const uint16_t &newVal);
1404 bool setOtptSldrSpd(const uint16_t &newVal);
1421 bool setOtptSldrStpSize(const uint16_t &newVal);
1437 bool setOtptValMax(const uint16_t &newVal);
1453 bool setOtptValMin(const uint16_t &newVal);
1466 bool setSldrDirDn();
1479 bool setSldrDirUp();
1489 void setSwpDirOnEnd(const bool &newVal);
1498 void setSwpDirOnPrss(const bool &newVal);
1506 bool swapSldrDir();
1507};
1508
1509//==========================================================>>
1510
1530private:
1531 void setFrcdOtptWhnVdd(const bool &newVal);
1532 void setStOnWhnOtpFrcd(const bool &newVal);
1533protected:
1534 enum fdaVmpbStts{
1535 stOffNotVPP,
1536 stOffVPP,
1537 stOnNVRP,
1538 //--------
1539 stOnVVP,
1540 stOnVddNVUP,
1541 stOffVddNVUP,
1542 stOffVddVUP,
1543 stOffUnVdd,
1544 //--------
1545 stOnVRP,
1546 stOnTurnOff,
1547 stOff,
1548 //--------
1549 stDisabled
1550 };
1551 fdaVmpbStts _mpbFdaState {stOffNotVPP};
1552
1553 void (*_fnWhnTrnOffVdd)() {nullptr};
1554 void (*_fnWhnTrnOnVdd)() {nullptr};
1555 bool _frcOtptLvlWhnVdd {true};
1556 bool _isVoided{false};
1557 bool _stOnWhnOtptFrcd{false};
1558 bool _validVoidPend{false};
1559 bool _validUnvoidPend{false};
1560
1561 static void mpbPollCallback(TimerHandle_t mpbTmrCb);
1562 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1563 bool setVoided(const bool &newVoidValue);
1564 virtual void stDisabled_In();
1565 virtual void stDisabled_Out();
1566 virtual void stOffNotVPP_In(){};
1567 virtual void stOffVddNVUP_Do(){}; // This provides a setting point for calculating the _validUnvoidPend
1568 virtual void stOffVPP_Do(){}; // This provides a setting point for the voiding mechanism to be started
1569 void _turnOffVdd();
1570 void _turnOnVdd();
1571 virtual void updFdaState();
1572 virtual bool updVoidStatus() = 0;
1573public:
1577 VdblMPBttn();
1585 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);
1589 virtual ~VdblMPBttn();
1593 void clrStatus(bool clrIsOn = true);
1602 fncPtrType getFnWhnTrnOffVdd();
1611 fncPtrType getFnWhnTrnOnVdd();
1621 bool getFrcOtptLvlWhnVdd();
1629 const bool getIsVoided() const;
1641 bool getStOnWhnOtpFrcd();
1649 void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)());
1657 void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)());
1668 bool setIsNotVoided();
1676 bool setIsVoided();
1677};
1678
1679//==========================================================>>
1680
1690protected:
1691 unsigned long int _voidTime;
1692 unsigned long int _voidTmrStrt{0};
1693
1694 virtual void stOffNotVPP_In();
1695 virtual void stOffVddNVUP_Do(); // This provides a setting point for calculating the _validUnvoidPend
1696 virtual void stOffVPP_Do(); // This provides a setting point for the voiding mechanism to be started
1697 bool updIsPressed();
1698 virtual bool updVoidStatus();
1699public:
1703 TmVdblMPBttn();
1711 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);
1715 virtual ~TmVdblMPBttn();
1719 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1723 void clrStatus();
1731 const unsigned long int getVoidTime() const;
1742 bool setVoidTime(const unsigned long int &newVoidTime);
1743};
1744
1745//==========================================================>>
1746
1763protected:
1764 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
1765 virtual void stOffVddNVUP_Do(); // This provides the calculation for the _validUnvoidPend
1766 virtual bool updVoidStatus();
1767public:
1778 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);
1782 virtual ~SnglSrvcVdblMPBttn();
1786 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1787};
1788
1789//==========================================================>>
1790
1791#endif /*_BUTTONTOSWITCH_ESP32_H_*/
MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts)
Unpackages a 32-bit value into a DbncdMPBttn object status.
Definition ButtonToSwitch_ESP32.cpp:3180
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2258
~DDlydDALtchMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2254
DDlydDALtchMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:2245
bool setScndModActvDly(const unsigned long &newVal)
Sets a new value for the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1938
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:1927
const TaskHandle_t getTaskWhileOnScndry()
Returns the task to be run while the object is in the Secondary On state.
Definition ButtonToSwitch_ESP32.cpp:1872
fncPtrType getFnWhnTrnOnScndry()
Returns the function that is set to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch_ESP32.cpp:1857
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1838
bool getIsOnScndry()
Returns the current value of the isOnScndry attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1862
DblActnLtchMPBttn()
Abstract Class default constructor.
Definition ButtonToSwitch_ESP32.cpp:1795
void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:1954
unsigned long getScndModActvDly()
Returns the current value of the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1867
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1808
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:1917
fncPtrType getFnWhnTrnOffScndry()
returns the function that is set to execute every time the object enters the Secondary Off State.
Definition ButtonToSwitch_ESP32.cpp:1852
~DblActnLtchMPBttn()
Virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:1804
Models a Debounced Delayed MPB (DD-MPB).
Definition ButtonToSwitch_ESP32.h:506
DbncdDlydMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:777
void setStrtDelay(const unsigned long int &newStrtDelay)
Sets a new value to the "Start Delay" strtDelay attribute.
Definition ButtonToSwitch_ESP32.cpp:798
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:788
void setBeginDisabled(const bool &newBeginDisabled=false)
Sets the starting isDisabled state.
Definition ButtonToSwitch_ESP32.cpp:379
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:402
fncPtrType getFnWhnTrnOn()
Returns the function that is set to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:180
void resetFda()
Resets the MPB behavior automaton to it's Initial or Start State
Definition ButtonToSwitch_ESP32.cpp:345
void clrStatus(bool clrIsOn=true)
Clears and resets flags, timers and counters modified through the object's signals processing.
Definition ButtonToSwitch_ESP32.cpp:114
const unsigned long int getCurDbncTime() const
Returns the current debounce period time set for the object.
Definition ButtonToSwitch_ESP32.cpp:170
const TaskHandle_t getTaskWhileOn()
Returns the task to be run (resumed) while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:230
void enable()
Enables the input signal processing.
Definition ButtonToSwitch_ESP32.cpp:147
bool pause()
Pauses the software timer updating the computation of the object's internal flags value.
Definition ButtonToSwitch_ESP32.cpp:321
const TaskHandle_t getTaskToNotify() const
Returns the task to be notified by the object when its output flags changes.
Definition ButtonToSwitch_ESP32.cpp:225
virtual ~DbncdMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:79
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:520
void setIsOnDisabled(const bool &newIsOnDisabled)
Sets the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:445
bool end()
Detaches the object from the timer that monitors the input pins, compute and updates the object's sta...
Definition ButtonToSwitch_ESP32.cpp:152
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:84
void resetDbncTime()
Resets the debounce process time of the object to the value used at instantiation.
Definition ButtonToSwitch_ESP32.cpp:339
DbncdMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:54
void disable()
Disables the input signal processing, ignoring the changes of its values.
Definition ButtonToSwitch_ESP32.cpp:142
bool resume()
Resets the outputs change task unblocking trigger (outputsChngTskTrggr) attribute flag.
Definition ButtonToSwitch_ESP32.cpp:363
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:185
const bool getIsOnDisabled() const
Returns the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:195
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:235
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:497
const bool getOutputsChange() const
Returns the value of the outputsChange attribute flag.
Definition ButtonToSwitch_ESP32.cpp:210
const bool getIsOn() const
Returns the value of the isOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:190
unsigned long int getStrtDelay()
Returns the current value of the outputs change task unblocking trigger (outputsChngTskTrggr) attribu...
Definition ButtonToSwitch_ESP32.cpp:215
const uint32_t getOtptsSttsPkgd()
Returns the relevant attribute flags values for the object state encoded as a 32 bits value,...
Definition ButtonToSwitch_ESP32.cpp:205
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:413
fncPtrType getFnWhnTrnOff()
Returns the function that is set to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:175
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:465
bool setDbncTime(const unsigned long int &newDbncTime)
Sets the debounce process time.
Definition ButtonToSwitch_ESP32.cpp:386
bool setSrvcTime(const unsigned long int &newSvcTime)
See TmLtchMPBttn::setSrvcTime(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1478
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:1356
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:1434
fncPtrType getFnWhnTrnOffWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1351
const bool getWrnngOn() const
Returns the current value of the warningOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1371
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:1445
const bool getPilotOn() const
Returns the current value of the pilotOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1366
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1326
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:1346
HntdTmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1286
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:1456
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:1493
fncPtrType getFnWhnTrnOnWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1361
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1296
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:1423
void setKeepPilot(const bool &newKeepPilot)
Sets the configuration of the keepPilot service attribute.
Definition ButtonToSwitch_ESP32.cpp:1467
const bool getIsLatched() const
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of t...
Definition ButtonToSwitch_ESP32.cpp:863
bool unlatch()
Sets the values of the flags needed to unlatch a latched MPB.
Definition ButtonToSwitch_ESP32.cpp:950
const bool getUnlatchRlsPend() const
Returns the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:878
const bool getUnlatchPend() const
Returns the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:873
void setUnlatchPend(const bool &newVal)
Sets the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:928
void setTrnOffASAP(const bool &newVal)
Sets the value of the trnOffASAP attribute.
Definition ButtonToSwitch_ESP32.cpp:917
bool getTrnOffASAP()
Returns the value of the trnOffASAP attribute flag.
Definition ButtonToSwitch_ESP32.cpp:868
void setUnlatchRlsPend(const bool &newVal)
Sets the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:939
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:820
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:850
LtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:811
void clrStatus(bool clrIsOn=true)
Definition ButtonToSwitch_ESP32.cpp:2305
bool setOtptSldrSpd(const uint16_t &newVal)
Sets the output slider speed (otptSldrSpd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2381
uint16_t getOtptValMax()
Returns the top output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2343
bool getOtptCurValIsMin()
Returns the result of comparing the Output Current Value to the Minimum value setting
Definition ButtonToSwitch_ESP32.cpp:2328
bool setSldrDirDn()
Sets the value of the curSldrDirUp attribute to false.
Definition ButtonToSwitch_ESP32.cpp:2479
bool setOtptValMax(const uint16_t &newVal)
Sets the output current value register maximum value attribute (otptValMax attribute).
Definition ButtonToSwitch_ESP32.cpp:2413
bool swapSldrDir()
Inverts the current curSldrDirUp attribute value.
Definition ButtonToSwitch_ESP32.cpp:2576
~SldrDALtchMPBttn()
Virtual class destructor.
Definition ButtonToSwitch_ESP32.cpp:2301
bool setOtptCurVal(const uint16_t &newVal)
Sets the output current value register.
Definition ButtonToSwitch_ESP32.cpp:2365
uint16_t getOtptCurVal()
Returns the Output Current Value (otpCurVal) attribute.
Definition ButtonToSwitch_ESP32.cpp:2318
bool setSldrDirUp()
Sets the value of the curSldrDirUp attribute to true.
Definition ButtonToSwitch_ESP32.cpp:2484
SldrDALtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2291
bool getSldrDirUp()
Returns the value of the curSldrDirUp attribute.
Definition ButtonToSwitch_ESP32.cpp:2353
bool setOtptSldrStpSize(const uint16_t &newVal)
Sets the output slider step size (otptSldrStpSize) attribute value.
Definition ButtonToSwitch_ESP32.cpp:2397
bool getOtptCurValIsMax()
Returns a boolean value indicating if the "Output Current Value" equals the maximum limit.
Definition ButtonToSwitch_ESP32.cpp:2323
void setSwpDirOnPrss(const bool &newVal)
Sets the value of the "Auto-Swap Direction On Press" (autoSwpDirOnPrss) attribute.
Definition ButtonToSwitch_ESP32.cpp:2496
bool setOtptValMin(const uint16_t &newVal)
Sets the output current value register minimum value attribute (otptValMin attribute).
Definition ButtonToSwitch_ESP32.cpp:2435
uint16_t getOtptValMin()
Returns the bottom output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2348
unsigned long getOtptSldrSpd()
Returns the current setting for the Output Slider Speed value.
Definition ButtonToSwitch_ESP32.cpp:2333
uint16_t getOtptSldrStpSize()
Returns the current setting for the Output Slider Step Size value.
Definition ButtonToSwitch_ESP32.cpp:2338
void setSwpDirOnEnd(const bool &newVal)
Sets the value of the "Auto-Swap Direction on Ends" (autoSwpDirOnEnd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2489
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:3145
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3117
virtual ~SnglSrvcVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:3113
SnglSrvcVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:3101
TgglLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1158
TmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1200
const unsigned long int getSrvcTime() const
Returns the configured Service Time.
Definition ButtonToSwitch_ESP32.cpp:1223
void setTmerRstbl(const bool &newIsRstbl)
Configures the timer for the Service Time to be reseted before it reaches unlatching time.
Definition ButtonToSwitch_ESP32.cpp:1244
bool setSrvcTime(const unsigned long int &newSrvcTime)
Sets a new value to the Service Time attribute.
Definition ButtonToSwitch_ESP32.cpp:1228
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1212
TmVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2987
virtual ~TmVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2996
void clrStatus()
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:3028
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3000
const unsigned long int getVoidTime() const
Returns the voidTime attribute current value.
Definition ButtonToSwitch_ESP32.cpp:3039
bool setVoidTime(const unsigned long int &newVoidTime)
Sets a new value to the Void Time attribute.
Definition ButtonToSwitch_ESP32.cpp:3044
bool setIsVoided()
Sets the value of the isVoided attribute flag to true.
Definition ButtonToSwitch_ESP32.cpp:2715
const bool getIsVoided() const
Returns the current value of the isVoided attribute flag.
Definition ButtonToSwitch_ESP32.cpp:2624
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:2614
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2597
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:2688
virtual ~VdblMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2593
VdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2583
fncPtrType getFnWhnTrnOffVdd()
Returns the function that is set to execute every time the object exits the Voided State.
Definition ButtonToSwitch_ESP32.cpp:2609
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:2676
bool getFrcOtptLvlWhnVdd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2619
bool getStOnWhnOtpFrcd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2629
bool setIsNotVoided()
Sets the value of the isVoided attribute flag to false.
Definition ButtonToSwitch_ESP32.cpp:2710
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1748
XtrnUnltchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1698
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1714
Type to hold the complete set of output attribute flags from any DbncdMPBttn class and subclasses obj...
Definition ButtonToSwitch_ESP32.h:80