ButtonToSwitch Library for ESP32 (Arduino) v4.4.0
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
Loading...
Searching...
No Matches
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 bool _beginDisabled{false};
113 unsigned long int _dbncRlsTimerStrt{0};
114 unsigned long int _dbncRlsTimeTempSett{0};
115 unsigned long int _dbncTimerStrt{0};
116 unsigned long int _dbncTimeTempSett{0};
117 fncPtrType _fnWhnTrnOff{nullptr};
118 fncPtrType _fnWhnTrnOn{nullptr};
119 bool _isEnabled{true};
120 volatile bool _isOn{false};
121 bool _isOnDisabled{false};
122 volatile bool _isPressed{false};
123 fdaDmpbStts _mpbFdaState {stOffNotVPP};
124 TimerHandle_t _mpbPollTmrHndl {NULL}; //FreeRTOS returns NULL if creation fails (not nullptr)
125 String _mpbPollTmrName {""};
126 bool _outputsChange {false};
127 uint32_t _outputsChangeCnt{0};
128 bool _outputsChngTskTrggr{false};
129 bool _prssRlsCcl{false};
130 unsigned long int _strtDelay {0};
131 bool _sttChng {true};
132 TaskHandle_t _taskToNotifyHndl {NULL};
133 TaskHandle_t _taskWhileOnHndl{NULL};
134 volatile bool _validDisablePend{false};
135 volatile bool _validEnablePend{false};
136 volatile bool _validPressPend{false};
137 volatile bool _validReleasePend{false};
138
139 void clrSttChng();
140 const bool getIsPressed() const;
141 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
142 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
143 void _setIsEnabled(const bool &newEnabledValue);
144 void setSttChng();
145 void _turnOff();
146 void _turnOn();
147 virtual void updFdaState();
148 bool updIsPressed();
149 virtual bool updValidPressesStatus();
150 const bool getOutputsChngTskTrggr() const;
151 void resetOutputsChngTskTrggr();
152
153public:
158 DbncdMPBttn();
168 DbncdMPBttn(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
173 virtual ~DbncdMPBttn();
185 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
196 void clrStatus(bool clrIsOn = true);
207 void disable();
216 void enable();
226 bool end();
234 const unsigned long int getCurDbncTime() const;
245 fncPtrType getFnWhnTrnOff();
256 fncPtrType getFnWhnTrnOn();
265 const bool getIsEnabled() const;
274 const bool getIsOn () const;
286 const bool getIsOnDisabled() const;
294 const uint32_t getOtptsSttsPkgd();
305 const bool getOutputsChange() const;
314 // const bool getOutputsChngTskTrggr() const;
324 unsigned long int getStrtDelay();
335 const TaskHandle_t getTaskToNotify() const;
346 const TaskHandle_t getTaskWhileOn();
352 bool init(const int8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
361 bool pause();
367 void resetDbncTime();
373 void resetFda();
379 // void resetOutputsChngTskTrggr();
390 bool resume();
398 void setBeginDisabled(const bool &newBeginDisabled = false);
410 bool setDbncTime(const unsigned long int &newDbncTime);
418// void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)());
419 void setFnWhnTrnOffPtr(fncPtrType newFnWhnTrnOff);
420
428 // void setFnWhnTrnOnPtr(void (*newFnWhnTrnOn)());
429 void setFnWhnTrnOnPtr(fncPtrType newFnWhnTrnOn);
440 void setIsOnDisabled(const bool &newIsOnDisabled);
448 void setOutputsChange(bool newOutputsChange);
458 void setTaskToNotify(const TaskHandle_t &newTaskHandle);
474 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
475};
476
477//==========================================================>>
478
489public:
504 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);
513 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);
523 void setStrtDelay(const unsigned long int &newStrtDelay);
524};
525
526//==========================================================>>
527
545protected:
546 enum fdaLmpbStts {
547 stOffNotVPP,
548 stOffVPP,
549 stOnNVRP,
550 stOnVRP,
551 stLtchNVUP,
552 stLtchdVUP,
553 stOffVUP,
554 stOffNVURP,
555 stOffVURP,
556 stDisabled
557 };
558 bool _isLatched{false};
559 fdaLmpbStts _mpbFdaState {stOffNotVPP};
560 bool _trnOffASAP{true};
561 volatile bool _validUnlatchPend{false};
562 volatile bool _validUnlatchRlsPend{false};
563
564 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
565
566 virtual void stDisabled_In(){};
567 virtual void stDisabled_Out(){};
568 virtual void stLtchNVUP_Do(){};
569 virtual void stOffNotVPP_In(){};
570 virtual void stOffNotVPP_Out(){};
571 virtual void stOffNVURP_Do(){};
572 virtual void stOffVPP_Out(){};
573 virtual void stOffVURP_Out(){};
574 virtual void stOnNVRP_Do(){};
575 virtual void updFdaState();
576 virtual void updValidUnlatchStatus() = 0;
577public:
581 LtchMPBttn();
587 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);
591 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
595 void clrStatus(bool clrIsOn = true);
604 const bool getIsLatched() const;
614 bool getTrnOffASAP();
622 const bool getUnlatchPend() const;
630 const bool getUnlatchRlsPend() const;
642 void setTrnOffASAP(const bool &newVal);
650 void setUnlatchPend(const bool &newVal);
658 void setUnlatchRlsPend(const bool &newVal);
669 bool unlatch();
670};
671
672//==========================================================>>
673
682protected:
683 virtual void stOffNVURP_Do();
684 virtual void updValidUnlatchStatus();
685public:
696 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);
697};
698
699//==========================================================>>
700
711protected:
712 bool _tmRstbl {true};
713 unsigned long int _srvcTime {};
714 unsigned long int _srvcTimerStrt{0};
715
716 virtual void stOffNotVPP_Out();
717 virtual void stOffVPP_Out();
718 virtual void updValidUnlatchStatus();
719public:
724 TmLtchMPBttn();
732 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);
736 void clrStatus(bool clrIsOn = true);
742 const unsigned long int getSrvcTime() const;
753 bool setSrvcTime(const unsigned long int &newSrvcTime);
761 void setTmerRstbl(const bool &newIsRstbl);
762};
763
764//==========================================================>>
765
777protected:
778 void (*_fnWhnTrnOffPilot)() {nullptr};
779 void (*_fnWhnTrnOffWrnng)() {nullptr};
780 void (*_fnWhnTrnOnPilot)() {nullptr};
781 void (*_fnWhnTrnOnWrnng)() {nullptr};
782 bool _keepPilot{false};
783 volatile bool _pilotOn{false};
784 unsigned long int _wrnngMs{0};
785 volatile bool _wrnngOn {false};
786 unsigned int _wrnngPrctg {0};
787
788 bool _validWrnngSetPend{false};
789 bool _validWrnngResetPend{false};
790 bool _validPilotSetPend{false};
791 bool _validPilotResetPend{false};
792
793 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
794 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
795 virtual void stDisabled_In();
796 virtual void stLtchNVUP_Do();
797 virtual void stOffNotVPP_In();
798 virtual void stOffVPP_Out();
799 virtual void stOnNVRP_Do();
800 void _turnOffPilot();
801 void _turnOffWrnng();
802 void _turnOnPilot();
803 void _turnOnWrnng();
804 bool updPilotOn();
805 bool updWrnngOn();
806public:
819 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);
823 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
827 void clrStatus(bool clrIsOn = true);
838 fncPtrType getFnWhnTrnOffPilot();
849 fncPtrType getFnWhnTrnOffWrnng();
860 fncPtrType getFnWhnTrnOnPilot();
871 fncPtrType getFnWhnTrnOnWrnng();
881 const bool getPilotOn() const;
893 const bool getWrnngOn() const;
901 void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)());
909 void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)());
917 void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)());
925 void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)());
931 void setKeepPilot(const bool &newKeepPilot);
937 bool setSrvcTime(const unsigned long int &newSvcTime);
949 bool setWrnngPrctg (const unsigned int &newWrnngPrctg);
950};
951
952//==========================================================>>
953
963protected:
964 DbncdDlydMPBttn* _unLtchBttn {nullptr};
965 bool _xtrnUnltchPRlsCcl {false};
966
967 virtual void stOffNVURP_Do();
968 virtual void updValidUnlatchStatus();
969public:
988 XtrnUnltchMPBttn(const int8_t &mpbttnPin, DbncdDlydMPBttn* unLtchBttn,
989 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
997 XtrnUnltchMPBttn(const int8_t &mpbttnPin,
998 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
999
1003 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1007 void clrStatus(bool clrIsOn = true);
1008};
1009
1010//==========================================================>>
1011
1037protected:
1038 enum fdaDALmpbStts{
1039 stOffNotVPP,
1040 stOffVPP,
1041 stOnMPBRlsd,
1042 //--------
1043 stOnStrtScndMod,
1044 stOnScndMod,
1045 stOnEndScndMod,
1046 //--------
1047 stOnTurnOff,
1048 //--------
1049 stDisabled
1050 };
1051 volatile bool _isOnScndry{false};
1052 fdaDALmpbStts _mpbFdaState {stOffNotVPP};
1053 unsigned long _scndModActvDly {2000};
1054 unsigned long _scndModTmrStrt {0};
1055 bool _validScndModPend{false};
1056
1057 void (*_fnWhnTrnOffScndry)() {nullptr};
1058 void (*_fnWhnTrnOnScndry)() {nullptr};
1059 TaskHandle_t _taskWhileOnScndryHndl{NULL};
1060
1061 static void mpbPollCallback(TimerHandle_t mpbTmrCbArg);
1062 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1063 virtual void stDisabled_In(){};
1064 virtual void stOnEndScndMod_Out(){};
1065 virtual void stOnScndMod_Do() = 0;
1066 virtual void stOnStrtScndMod_In(){};
1067 virtual void _turnOffScndry();
1068 virtual void _turnOnScndry();
1069 virtual void updFdaState();
1070 virtual bool updValidPressesStatus();
1071 virtual void updValidUnlatchStatus();
1072
1073public:
1084 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);
1093 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1097 void clrStatus(bool clrIsOn = true);
1106 fncPtrType getFnWhnTrnOffScndry();
1115 fncPtrType getFnWhnTrnOnScndry();
1123 bool getIsOnScndry();
1131 unsigned long getScndModActvDly();
1142 const TaskHandle_t getTaskWhileOnScndry();
1150 void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)());
1158 void setFnWhnTrnOnScndryPtr(void (*newFnWhnTrnOn)());
1169 bool setScndModActvDly(const unsigned long &newVal);
1187 void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle);
1188
1189};
1190
1191//==========================================================>>
1192
1206protected:
1207 virtual void stOnEndScndMod_Out();
1208 virtual void stOnScndMod_Do();
1209 virtual void stOnStrtScndMod_In();
1210public:
1221 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);
1229 void clrStatus(bool clrIsOn = true);
1230};
1231
1232//==========================================================>>
1233
1252
1253protected:
1254 bool _autoSwpDirOnEnd{true}; // Changes slider direction automatically when reaches _otptValMax or _otptValMin
1255 bool _autoSwpDirOnPrss{false};// Changes slider direction each time it enters slider mode
1256 bool _curSldrDirUp{true};
1257 uint16_t _initOtptCurVal{};
1258 uint16_t _otptCurVal{};
1259 unsigned long _otptSldrSpd{1};
1260 uint16_t _otptSldrStpSize{0x01};
1261 uint16_t _otptValMax{0xFFFF};
1262 uint16_t _otptValMin{0x0000};
1263
1264 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1265 bool _setSldrDir(const bool &newVal);
1266 void stOnEndScndMod_Out();
1267 virtual void stOnScndMod_Do();
1268 virtual void stOnStrtScndMod_In();
1269public:
1282 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);
1291 void clrStatus(bool clrIsOn = true);
1297 uint16_t getOtptCurVal();
1307 bool getOtptCurValIsMax();
1317 bool getOtptCurValIsMin();
1327 unsigned long getOtptSldrSpd();
1337 uint16_t getOtptSldrStpSize();
1343 uint16_t getOtptValMax();
1349 uint16_t getOtptValMin();
1359 bool getSldrDirUp();
1371 bool setOtptCurVal(const uint16_t &newVal);
1386 bool setOtptSldrSpd(const uint16_t &newVal);
1403 bool setOtptSldrStpSize(const uint16_t &newVal);
1419 bool setOtptValMax(const uint16_t &newVal);
1435 bool setOtptValMin(const uint16_t &newVal);
1448 bool setSldrDirDn();
1461 bool setSldrDirUp();
1471 void setSwpDirOnEnd(const bool &newVal);
1480 void setSwpDirOnPrss(const bool &newVal);
1488 bool swapSldrDir();
1489};
1490
1491//==========================================================>>
1492
1512private:
1513 void setFrcdOtptWhnVdd(const bool &newVal);
1514 void setStOnWhnOtpFrcd(const bool &newVal);
1515protected:
1516 enum fdaVmpbStts{
1517 stOffNotVPP,
1518 stOffVPP,
1519 stOnNVRP,
1520 //--------
1521 stOnVVP,
1522 stOnVddNVUP,
1523 stOffVddNVUP,
1524 stOffVddVUP,
1525 stOffUnVdd,
1526 //--------
1527 stOnVRP,
1528 stOnTurnOff,
1529 stOff,
1530 //--------
1531 stDisabled
1532 };
1533 fdaVmpbStts _mpbFdaState {stOffNotVPP};
1534
1535 void (*_fnWhnTrnOffVdd)() {nullptr};
1536 void (*_fnWhnTrnOnVdd)() {nullptr};
1537 bool _frcOtptLvlWhnVdd {true};
1538 bool _isVoided{false};
1539 bool _stOnWhnOtptFrcd{false};
1540 bool _validVoidPend{false};
1541 bool _validUnvoidPend{false};
1542
1543 static void mpbPollCallback(TimerHandle_t mpbTmrCb);
1544 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1545 bool setVoided(const bool &newVoidValue);
1546 virtual void stDisabled_In();
1547 virtual void stDisabled_Out();
1548 virtual void stOffNotVPP_In(){};
1549 virtual void stOffVddNVUP_Do(){}; // This provides a setting point for calculating the _validUnvoidPend
1550 virtual void stOffVPP_Do(){}; // This provides a setting point for the voiding mechanism to be started
1551 void _turnOffVdd();
1552 void _turnOnVdd();
1553 virtual void updFdaState();
1554 virtual bool updVoidStatus() = 0;
1555public:
1559 VdblMPBttn();
1567 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);
1571 virtual ~VdblMPBttn();
1575 void clrStatus(bool clrIsOn = true);
1584 fncPtrType getFnWhnTrnOffVdd();
1593 fncPtrType getFnWhnTrnOnVdd();
1603 bool getFrcOtptLvlWhnVdd();
1611 const bool getIsVoided() const;
1623 bool getStOnWhnOtpFrcd();
1631 void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)());
1639 void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)());
1650 bool setIsNotVoided();
1658 bool setIsVoided();
1659};
1660
1661//==========================================================>>
1662
1672protected:
1673 unsigned long int _voidTime;
1674 unsigned long int _voidTmrStrt{0};
1675
1676 virtual void stOffNotVPP_In();
1677 virtual void stOffVddNVUP_Do(); // This provides a setting point for calculating the _validUnvoidPend
1678 virtual void stOffVPP_Do(); // This provides a setting point for the voiding mechanism to be started
1679 bool updIsPressed();
1680 virtual bool updVoidStatus();
1681public:
1685 TmVdblMPBttn();
1693 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);
1697 virtual ~TmVdblMPBttn();
1701 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1705 void clrStatus();
1713 const unsigned long int getVoidTime() const;
1724 bool setVoidTime(const unsigned long int &newVoidTime);
1725};
1726
1727//==========================================================>>
1728
1745protected:
1746 virtual void setTaskWhileOn(const TaskHandle_t &newTaskHandle);
1747 virtual void stOffVddNVUP_Do(); // This provides the calculation for the _validUnvoidPend
1748 virtual bool updVoidStatus();
1749public:
1760 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);
1764 virtual ~SnglSrvcVdblMPBttn();
1768 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1769};
1770
1771//==========================================================>>
1772
1773#endif /*_BUTTONTOSWITCH_ESP32_H_*/
MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts)
Unpackages a 32-bit value into a DbncdMPBttn object status.
Definition ButtonToSwitch_ESP32.cpp:3162
Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-D...
Definition ButtonToSwitch_ESP32.h:1205
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2241
~DDlydDALtchMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2237
DDlydDALtchMPBttn()
Default class constructor.
Definition ButtonToSwitch_ESP32.cpp:2228
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs).
Definition ButtonToSwitch_ESP32.h:1036
bool setScndModActvDly(const unsigned long &newVal)
Sets a new value for the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1921
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:1910
const TaskHandle_t getTaskWhileOnScndry()
Returns the task to be run while the object is in the Secondary On state.
Definition ButtonToSwitch_ESP32.cpp:1855
fncPtrType getFnWhnTrnOnScndry()
Returns the function that is set to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch_ESP32.cpp:1840
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1821
bool getIsOnScndry()
Returns the current value of the isOnScndry attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1845
DblActnLtchMPBttn()
Abstract Class default constructor.
Definition ButtonToSwitch_ESP32.cpp:1779
void setTaskWhileOnScndry(const TaskHandle_t &newTaskHandle)
Sets the task to be run while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:1937
unsigned long getScndModActvDly()
Returns the current value of the scndModActvDly class attribute.
Definition ButtonToSwitch_ESP32.cpp:1850
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1792
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:1900
fncPtrType getFnWhnTrnOffScndry()
returns the function that is set to execute every time the object enters the Secondary Off State.
Definition ButtonToSwitch_ESP32.cpp:1835
~DblActnLtchMPBttn()
Virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:1788
Models a Debounced Delayed MPB (DD-MPB).
Definition ButtonToSwitch_ESP32.h:488
DbncdDlydMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:764
void setStrtDelay(const unsigned long int &newStrtDelay)
Sets a new value to the "Start Delay" strtDelay attribute.
Definition ButtonToSwitch_ESP32.cpp:785
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:775
Base class, models a Debounced Momentary Push Button (D-MPB).
Definition ButtonToSwitch_ESP32.h:96
void setBeginDisabled(const bool &newBeginDisabled=false)
Sets the starting isDisabled state.
Definition ButtonToSwitch_ESP32.cpp:364
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:387
fncPtrType getFnWhnTrnOn()
Returns the function that is set to execute every time the object enters the On State.
Definition ButtonToSwitch_ESP32.cpp:164
void resetFda()
Resets the MPB behavior automaton to it's Initial or Start State
Definition ButtonToSwitch_ESP32.cpp:330
void clrStatus(bool clrIsOn=true)
Clears and resets flags, timers and counters modified through the object's signals processing.
Definition ButtonToSwitch_ESP32.cpp:98
const unsigned long int getCurDbncTime() const
Returns the current debounce period time set for the object.
Definition ButtonToSwitch_ESP32.cpp:154
const TaskHandle_t getTaskWhileOn()
Returns the task to be run (resumed) while the object is in the On state.
Definition ButtonToSwitch_ESP32.cpp:215
void enable()
Enables the input signal processing.
Definition ButtonToSwitch_ESP32.cpp:131
bool pause()
Pauses the software timer updating the computation of the object's internal flags value.
Definition ButtonToSwitch_ESP32.cpp:306
const TaskHandle_t getTaskToNotify() const
Returns the task to be notified by the object when its output flags changes.
Definition ButtonToSwitch_ESP32.cpp:209
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:507
void setIsOnDisabled(const bool &newIsOnDisabled)
Sets the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:432
bool end()
Detaches the object from the timer that monitors the input pins, compute and updates the object's sta...
Definition ButtonToSwitch_ESP32.cpp:136
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:324
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:126
bool resume()
Resets the outputs change task unblocking trigger (outputsChngTskTrggr) attribute flag.
Definition ButtonToSwitch_ESP32.cpp:348
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:169
const bool getIsOnDisabled() const
Returns the value of the isOnDisabled attribute flag.
Definition ButtonToSwitch_ESP32.cpp:179
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:220
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:484
const bool getOutputsChange() const
Returns the value of the outputsChange attribute flag.
Definition ButtonToSwitch_ESP32.cpp:194
const bool getIsOn() const
Returns the value of the isOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:174
unsigned long int getStrtDelay()
Returns the current value of the outputs change task unblocking trigger (outputsChngTskTrggr) attribu...
Definition ButtonToSwitch_ESP32.cpp:199
const uint32_t getOtptsSttsPkgd()
Returns the relevant attribute flags values for the object state encoded as a 32 bits value,...
Definition ButtonToSwitch_ESP32.cpp:189
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:399
fncPtrType getFnWhnTrnOff()
Returns the function that is set to execute every time the object enters the Off State.
Definition ButtonToSwitch_ESP32.cpp:159
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:452
bool setDbncTime(const unsigned long int &newDbncTime)
Sets the debounce process time.
Definition ButtonToSwitch_ESP32.cpp:371
Models a Hinted Timer Latch DD-MPB, a.k.a. Staircase Switch (HTiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:776
bool setSrvcTime(const unsigned long int &newSvcTime)
See TmLtchMPBttn::setSrvcTime(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1463
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:1341
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:1419
fncPtrType getFnWhnTrnOffWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1336
const bool getWrnngOn() const
Returns the current value of the warningOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1356
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:1430
const bool getPilotOn() const
Returns the current value of the pilotOn attribute flag.
Definition ButtonToSwitch_ESP32.cpp:1351
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1311
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:1331
HntdTmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1272
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:1441
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:1478
fncPtrType getFnWhnTrnOnWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch_ESP32.cpp:1346
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1282
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:1408
void setKeepPilot(const bool &newKeepPilot)
Sets the configuration of the keepPilot service attribute.
Definition ButtonToSwitch_ESP32.cpp:1452
Abstract class, base to model Latched Debounced Delayed MPBs (LDD-MPB).
Definition ButtonToSwitch_ESP32.h:544
const bool getIsLatched() const
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of t...
Definition ButtonToSwitch_ESP32.cpp:849
bool unlatch()
Sets the values of the flags needed to unlatch a latched MPB.
Definition ButtonToSwitch_ESP32.cpp:936
const bool getUnlatchRlsPend() const
Returns the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:864
const bool getUnlatchPend() const
Returns the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:859
void setUnlatchPend(const bool &newVal)
Sets the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:914
void setTrnOffASAP(const bool &newVal)
Sets the value of the trnOffASAP attribute.
Definition ButtonToSwitch_ESP32.cpp:903
bool getTrnOffASAP()
Returns the value of the trnOffASAP attribute flag.
Definition ButtonToSwitch_ESP32.cpp:854
void setUnlatchRlsPend(const bool &newVal)
Sets the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch_ESP32.cpp:925
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:807
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:836
LtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:798
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:1251
void clrStatus(bool clrIsOn=true)
Definition ButtonToSwitch_ESP32.cpp:2289
bool setOtptSldrSpd(const uint16_t &newVal)
Sets the output slider speed (otptSldrSpd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2365
uint16_t getOtptValMax()
Returns the top output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2327
bool getOtptCurValIsMin()
Returns the result of comparing the Output Current Value to the Minimum value setting
Definition ButtonToSwitch_ESP32.cpp:2312
bool setSldrDirDn()
Sets the value of the curSldrDirUp attribute to false.
Definition ButtonToSwitch_ESP32.cpp:2463
bool setOtptValMax(const uint16_t &newVal)
Sets the output current value register maximum value attribute (otptValMax attribute).
Definition ButtonToSwitch_ESP32.cpp:2397
bool swapSldrDir()
Inverts the current curSldrDirUp attribute value.
Definition ButtonToSwitch_ESP32.cpp:2560
~SldrDALtchMPBttn()
Virtual class destructor.
Definition ButtonToSwitch_ESP32.cpp:2285
bool setOtptCurVal(const uint16_t &newVal)
Sets the output current value register.
Definition ButtonToSwitch_ESP32.cpp:2349
uint16_t getOtptCurVal()
Returns the Output Current Value (otpCurVal) attribute.
Definition ButtonToSwitch_ESP32.cpp:2302
bool setSldrDirUp()
Sets the value of the curSldrDirUp attribute to true.
Definition ButtonToSwitch_ESP32.cpp:2468
SldrDALtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2275
bool getSldrDirUp()
Returns the value of the curSldrDirUp attribute.
Definition ButtonToSwitch_ESP32.cpp:2337
bool setOtptSldrStpSize(const uint16_t &newVal)
Sets the output slider step size (otptSldrStpSize) attribute value.
Definition ButtonToSwitch_ESP32.cpp:2381
bool getOtptCurValIsMax()
Returns a boolean value indicating if the "Output Current Value" equals the maximum limit.
Definition ButtonToSwitch_ESP32.cpp:2307
void setSwpDirOnPrss(const bool &newVal)
Sets the value of the "Auto-Swap Direction On Press" (autoSwpDirOnPrss) attribute.
Definition ButtonToSwitch_ESP32.cpp:2480
bool setOtptValMin(const uint16_t &newVal)
Sets the output current value register minimum value attribute (otptValMin attribute).
Definition ButtonToSwitch_ESP32.cpp:2419
uint16_t getOtptValMin()
Returns the bottom output current value register setting.
Definition ButtonToSwitch_ESP32.cpp:2332
unsigned long getOtptSldrSpd()
Returns the current setting for the Output Slider Speed value.
Definition ButtonToSwitch_ESP32.cpp:2317
uint16_t getOtptSldrStpSize()
Returns the current setting for the Output Slider Step Size value.
Definition ButtonToSwitch_ESP32.cpp:2322
void setSwpDirOnEnd(const bool &newVal)
Sets the value of the "Auto-Swap Direction on Ends" (autoSwpDirOnEnd) attribute.
Definition ButtonToSwitch_ESP32.cpp:2473
Models a Single Service Voidable DD-MPB a.k.a. Trigger switch (SSVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1744
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:3127
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:3100
virtual ~SnglSrvcVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:3096
SnglSrvcVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:3084
Models a Toggle Latch DD-MPB, a.k.a. a Toggle Switch (ToLDD-MPB).
Definition ButtonToSwitch_ESP32.h:681
TgglLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1144
Models a Timer Latch DD-MPB, a.k.a. Timer Switch (TiLDD-MPB).
Definition ButtonToSwitch_ESP32.h:710
TmLtchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1186
const unsigned long int getSrvcTime() const
Returns the configured Service Time.
Definition ButtonToSwitch_ESP32.cpp:1209
void setTmerRstbl(const bool &newIsRstbl)
Configures the timer for the Service Time to be reseted before it reaches unlatching time.
Definition ButtonToSwitch_ESP32.cpp:1230
bool setSrvcTime(const unsigned long int &newSrvcTime)
Sets a new value to the Service Time attribute.
Definition ButtonToSwitch_ESP32.cpp:1214
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1198
Models a Time Voidable DD-MPB, a.k.a. Anti-tampering switch (TVDD-MPB)
Definition ButtonToSwitch_ESP32.h:1671
TmVdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2971
virtual ~TmVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2980
void clrStatus()
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:3011
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:2984
const unsigned long int getVoidTime() const
Returns the voidTime attribute current value.
Definition ButtonToSwitch_ESP32.cpp:3022
bool setVoidTime(const unsigned long int &newVoidTime)
Sets a new value to the Void Time attribute.
Definition ButtonToSwitch_ESP32.cpp:3027
Abstract class, base to model Voidable DD-MPBs (VDD-MPB).
Definition ButtonToSwitch_ESP32.h:1511
bool setIsVoided()
Sets the value of the isVoided attribute flag to true.
Definition ButtonToSwitch_ESP32.cpp:2699
const bool getIsVoided() const
Returns the current value of the isVoided attribute flag.
Definition ButtonToSwitch_ESP32.cpp:2608
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:2598
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:2581
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:2672
virtual ~VdblMPBttn()
Default virtual destructor.
Definition ButtonToSwitch_ESP32.cpp:2577
VdblMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:2567
fncPtrType getFnWhnTrnOffVdd()
Returns the function that is set to execute every time the object exits the Voided State.
Definition ButtonToSwitch_ESP32.cpp:2593
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:2660
bool getFrcOtptLvlWhnVdd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2603
bool getStOnWhnOtpFrcd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch_ESP32.cpp:2613
bool setIsNotVoided()
Sets the value of the isVoided attribute flag to false.
Definition ButtonToSwitch_ESP32.cpp:2694
Models an External Unlatch LDD-MPB, a.k.a. Emergency Latched Switch (XULDD-MPB)
Definition ButtonToSwitch_ESP32.h:962
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch_ESP32.cpp:1732
XtrnUnltchMPBttn()
Default constructor.
Definition ButtonToSwitch_ESP32.cpp:1683
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch_ESP32.cpp:1699
Type to hold the complete set of output attribute flags from any DbncdMPBttn class and subclasses obj...
Definition ButtonToSwitch_ESP32.h:62