ButtonToSwitch Library for Arduino v4.0.1
A library that provides elaborated switch mechanism behavior simulation for digital signals inputs
Loading...
Searching...
No Matches
ButtonToSwitch.h
1
33#ifndef _BUTTONTOSWITCH_H_
34#define _BUTTONTOSWITCH_H_
35
36#include <Arduino.h>
37#include <stdint.h>
38
39//===========================>> BEGIN General use constant definitions
40#define _HwMinDbncTime 20 //Documented minimum wait time for a MPB signal to stabilize
41#define _StdPollDelay 10
42#define _MinSrvcTime 100
43#define _InvalidPinNum 0xFF // Value to give as "yet to be defined", the "Valid pin number" range and characteristics are development platform and environment related
44
45/*---------- DbncdMPBttn complete status 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//===========================>> END General use constant definitions
54
55#ifndef MPBOTPTS_T
56 #define MPBOTPTS_T
63 struct MpbOtpts_t{
64 bool isOn;
65 bool isEnabled;
66 bool pilotOn;
67 bool wrnngOn;
68 bool isVoided;
69 bool isOnScndry;
70 uint16_t otptCurVal;
71 };
72#endif
73/*---------------- DbncdMPBttn complete status related constants, argument structs, information packing and unpacking END -------*/
74
75// Definition workaround to let a function/method return value to be a function pointer
76typedef void (*fncPtrType)();
77typedef fncPtrType (*ptrToTrnFnc)();
78
79//===========================>> BEGIN General use function prototypes
80MpbOtpts_t otptsSttsUnpkg(uint32_t pkgOtpts);
81unsigned long int findMCD(unsigned long int a, unsigned long int b);
82//===========================>> END General use function prototypes
83
109//==========================================================>> Classes declarations BEGIN
110
121 static DbncdMPBttn** _mpbsInstncsLstPtr;
122 static unsigned long int _updTimerPeriod;
123/*
124 * This is the callback function to be executed by the TimerOne managed timer INT.
125 *
126 * The callback function duties:
127 * - Verify for a valid **_mpbsInstncsLstPtr**, if it's nullptr something failed, correct it by disabling the timer
128 * - Save the **current time** for reference and traverse the list till the end (nullptr).
129 * - For each MPB in the list verify the _updTmrAttchd == true
130 * - If _updTmrAttchd == true -> verify the ("current time" - _lstPollTime) >= _pollPeriodMs. If the condition is true:
131 * - Execute the objects mpbPollCallback()
132 * - Set _lstPollTime = "current time" *
133 */
134 static void _ISRMpbsRfrshCb();
135
136protected:
137 enum fdaDmpbStts {
138 stOffNotVPP,
139 stOffVPP,
140 stOn,
141 stOnVRP,
142 stDisabled
143 };
144 const unsigned long int _stdMinDbncTime {_HwMinDbncTime};
145
146 uint8_t _mpbttnPin{};
147 bool _pulledUp{};
148 bool _typeNO{};
149 unsigned long int _dbncTimeOrigSett{};
150
151 unsigned long int _dbncRlsTimerStrt{0};
152 unsigned long int _dbncRlsTimeTempSett{0};
153 unsigned long int _dbncTimerStrt{0};
154 unsigned long int _dbncTimeTempSett{0};
155 void (*_fnWhnTrnOff)() {nullptr};
156 void (*_fnWhnTrnOn)() {nullptr};
157 bool _isEnabled{true};
158 volatile bool _isOn{false};
159 bool _isOnDisabled{false};
160 volatile bool _isPressed{false};
161 unsigned long int _lstPollTime{0};
162 fdaDmpbStts _mpbFdaState {stOffNotVPP};
163 DbncdMPBttn* _mpbInstnc{nullptr};
164 volatile bool _outputsChange {false};
165 uint32_t _outputsChangeCnt{0};
166 unsigned long int _pollPeriodMs{0};
167 bool _prssRlsCcl{false};
168 unsigned long int _strtDelay {0};
169 bool _sttChng {true};
170 bool _updTmrAttchd{false};
171 volatile bool _validDisablePend{false};
172 volatile bool _validEnablePend{false};
173 volatile bool _validPressPend{false};
174 volatile bool _validReleasePend{false};
175
176 void clrSttChng();
177 const bool getIsPressed() const;
178 virtual void mpbPollCallback();
179 virtual uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
180 void _popMpb(DbncdMPBttn** &DMpbTmrUpdLst, DbncdMPBttn* mpbToPop);
181 void _pushMpb(DbncdMPBttn** &DMpbTmrUpdLst, DbncdMPBttn* mpbToPush);
182 void _setIsEnabled(const bool &newEnabledValue);
183 void _setLstPollTime(const unsigned long int &newLstPollTIme);
184 void setSttChng();
185 void _turnOff();
186 void _turnOn();
187 virtual void updFdaState();
188 bool updIsPressed();
189 unsigned long int _updTmrsMCDCalc();
190 virtual bool updValidPressesStatus();
191
192public:
197 DbncdMPBttn();
206 DbncdMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
211 virtual ~DbncdMPBttn();
229 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
240 void clrStatus(bool clrIsOn = true);
251 void disable();
261 void enable();
275 bool end();
283 const unsigned long int getCurDbncTime() const;
294 fncPtrType getFnWhnTrnOff();
305 fncPtrType getFnWhnTrnOn();
314 const bool getIsEnabled() const;
323 const bool getIsOn () const;
335 const bool getIsOnDisabled() const;
343 const unsigned long int getLstPollTime();
351 const uint32_t getOtptsSttsPkgd();
362 const bool getOutputsChange() const;
372 const unsigned long int getPollPeriodMs();
382 unsigned long int getStrtDelay();
392 bool getUpdTmrAttchd();
398 bool init(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0);
409 bool pause();
415 void resetDbncTime();
421 void resetFda();
432 bool resume();
444 bool setDbncTime(const unsigned long int &newDbncTime);
452 void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)());
460 void setFnWhnTrnOnPtr(void (*newFnWhnTrnOn)());
471 void setIsOnDisabled(const bool &newIsOnDisabled);
479 void setOutputsChange(bool newOutputsChange);
480};
481
482//==========================================================>>
483
494public:
509 DbncdDlydMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
518 bool init(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
528 void setStrtDelay(const unsigned long int &newStrtDelay);
529};
530
531//==========================================================>>
532
550protected:
551 enum fdaLmpbStts {
552 stOffNotVPP,
553 stOffVPP,
554 stOnNVRP,
555 stOnVRP,
556 stLtchNVUP,
557 stLtchdVUP,
558 stOffVUP,
559 stOffNVURP,
560 stOffVURP,
561 stDisabled
562 };
563 bool _isLatched{false};
564 fdaLmpbStts _mpbFdaState {stOffNotVPP};
565 bool _trnOffASAP{true};
566 volatile bool _validUnlatchPend{false};
567 volatile bool _validUnlatchRlsPend{false};
568
569 virtual void mpbPollCallback();
570 virtual void stDisabled_In(){};
571 virtual void stDisabled_Out(){};
572 virtual void stLtchNVUP_Do(){};
573 virtual void stOffNotVPP_In(){};
574 virtual void stOffNotVPP_Out(){};
575 virtual void stOffNVURP_Do(){};
576 virtual void stOffVPP_Out(){};
577 virtual void stOffVURP_Out(){};
578 virtual void stOnNVRP_Do(){};
579 virtual void updFdaState();
580 virtual void updValidUnlatchStatus() = 0;
581public:
587 LtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
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:
691 TgglLtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
692};
693
694//==========================================================>>
695
706protected:
707 bool _tmRstbl {true};
708 unsigned long int _srvcTime {};
709 unsigned long int _srvcTimerStrt{0};
710
711 virtual void stOffNotVPP_Out();
712 virtual void stOffVPP_Out();
713 virtual void updValidUnlatchStatus();
714public:
722 TmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
726 void clrStatus(bool clrIsOn = true);
732 const unsigned long int getSrvcTime() const;
745 bool setSrvcTime(const unsigned long int &newSrvcTime);
753 void setTmerRstbl(const bool &newIsRstbl);
754};
755
756//==========================================================>>
757
769protected:
770 void (*_fnWhnTrnOffPilot)() {nullptr};
771 void (*_fnWhnTrnOffWrnng)() {nullptr};
772 void (*_fnWhnTrnOnPilot)() {nullptr};
773 void (*_fnWhnTrnOnWrnng)() {nullptr};
774 bool _keepPilot{false};
775 volatile bool _pilotOn{false};
776 unsigned long int _wrnngMs{0};
777 volatile bool _wrnngOn {false};
778 unsigned int _wrnngPrctg {0};
779
780 bool _validWrnngSetPend{false};
781 bool _validWrnngResetPend{false};
782 bool _validPilotSetPend{false};
783 bool _validPilotResetPend{false};
784
785 virtual void mpbPollCallback();
786 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
787 virtual void stDisabled_In();
788 virtual void stLtchNVUP_Do();
789 virtual void stOffNotVPP_In();
790 virtual void stOffVPP_Out();
791 virtual void stOnNVRP_Do();
792 void _turnOffPilot();
793 void _turnOffWrnng();
794 void _turnOnPilot();
795 void _turnOnWrnng();
796 bool updPilotOn();
797 bool updWrnngOn();
798public:
806 HntdTmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const unsigned int &wrnngPrctg = 0, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
810 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
814 void clrStatus(bool clrIsOn = true);
825 fncPtrType getFnWhnTrnOffPilot();
836 fncPtrType getFnWhnTrnOffWrnng();
847 fncPtrType getFnWhnTrnOnPilot();
858 fncPtrType getFnWhnTrnOnWrnng();
868 const bool getPilotOn() const;
880 const bool getWrnngOn() const;
888 void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)());
896 void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)());
904 void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)());
912 void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)());
918 void setKeepPilot(const bool &newKeepPilot);
924 bool setSrvcTime(const unsigned long int &newSvcTime);
936 bool setWrnngPrctg (const unsigned int &newWrnngPrctg);
937};
938
939//==========================================================>>
940
950protected:
951 DbncdDlydMPBttn* _unLtchBttn {nullptr};
952 bool _xtrnUnltchPRlsCcl {false};
953
954 virtual void stOffNVURP_Do();
955 virtual void updValidUnlatchStatus();
956public:
970 XtrnUnltchMPBttn(const uint8_t &mpbttnPin, DbncdDlydMPBttn* unLtchBttn,
971 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
979 XtrnUnltchMPBttn(const uint8_t &mpbttnPin,
980 const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay);
981
985 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
989 void clrStatus(bool clrIsOn = true);
990};
991
992//==========================================================>>
993
1019protected:
1020 enum fdaDALmpbStts{
1021 stOffNotVPP,
1022 stOffVPP,
1023 stOnMPBRlsd,
1024 //--------
1025 stOnStrtScndMod,
1026 stOnScndMod,
1027 stOnEndScndMod,
1028 //--------
1029 stOnTurnOff,
1030 //--------
1031 stDisabled
1032 };
1033 volatile bool _isOnScndry{false};
1034 fdaDALmpbStts _mpbFdaState {stOffNotVPP};
1035 unsigned long _scndModActvDly {2000};
1036 unsigned long _scndModTmrStrt {0};
1037 bool _validScndModPend{false};
1038
1039 void (*_fnWhnTrnOffScndry)() {nullptr};
1040 void (*_fnWhnTrnOnScndry)() {nullptr};
1041
1042 virtual void mpbPollCallback();
1043 virtual void stDisabled_In(){};
1044 virtual void stOnEndScndMod_Out(){};
1045 virtual void stOnScndMod_Do() = 0;
1046 virtual void stOnStrtScndMod_In(){};
1047 virtual void _turnOffScndry();
1048 virtual void _turnOnScndry();
1049 virtual void updFdaState();
1050 virtual bool updValidPressesStatus();
1051 virtual void updValidUnlatchStatus();
1052
1053public:
1059 DblActnLtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1068 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1072 void clrStatus(bool clrIsOn = true);
1081 fncPtrType getFnWhnTrnOffScndry();
1090 fncPtrType getFnWhnTrnOnScndry();
1098 bool getIsOnScndry();
1106 unsigned long getScndModActvDly();
1114 void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)());
1122 void setFnWhnTrnOnScndryPtr(void (*newFnWhnTrnOn)());
1133 bool setScndModActvDly(const unsigned long &newVal);
1134};
1135
1136//==========================================================>>
1137
1151protected:
1152 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1153 // virtual void stDisabled_In();
1154 virtual void stOnEndScndMod_Out();
1155 virtual void stOnScndMod_Do();
1156 virtual void stOnStrtScndMod_In();
1157public:
1163 DDlydDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1171 void clrStatus(bool clrIsOn = true);
1172};
1173
1174//==========================================================>>
1175
1194
1195protected:
1196 bool _autoSwpDirOnEnd{true}; // Changes slider direction automatically when reaches _otptValMax or _otptValMin
1197 bool _autoSwpDirOnPrss{false};// Changes slider direction each time it enters slider mode
1198 bool _curSldrDirUp{true};
1199 uint16_t _initOtptCurVal{};
1200 uint16_t _otptCurVal{};
1201 unsigned long _otptSldrSpd{1};
1202 uint16_t _otptSldrStpSize{0x01};
1203 uint16_t _otptValMax{0xFFFF};
1204 uint16_t _otptValMin{0x0000};
1205
1206 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1207 bool _setSldrDir(const bool &newVal);
1208 // virtual void stDisabled_In();
1209 void stOnEndScndMod_Out();
1210 virtual void stOnScndMod_Do();
1211 virtual void stOnStrtScndMod_In();
1212public:
1220 SldrDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0, const uint16_t initVal = 0xFFFF);
1229 void clrStatus(bool clrIsOn = true);
1235 uint16_t getOtptCurVal();
1245 bool getOtptCurValIsMax();
1255 bool getOtptCurValIsMin();
1265 unsigned long getOtptSldrSpd();
1275 uint16_t getOtptSldrStpSize();
1281 uint16_t getOtptValMax();
1287 uint16_t getOtptValMin();
1297 bool getSldrDirUp();
1309 bool setOtptCurVal(const uint16_t &newVal);
1324 bool setOtptSldrSpd(const uint16_t &newVal);
1341 bool setOtptSldrStpSize(const uint16_t &newVal);
1357 bool setOtptValMax(const uint16_t &newVal);
1373 bool setOtptValMin(const uint16_t &newVal);
1386 bool setSldrDirDn();
1399 bool setSldrDirUp();
1409 void setSwpDirOnEnd(const bool &newVal);
1418 void setSwpDirOnPrss(const bool &newVal);
1426 bool swapSldrDir();
1427};
1428
1429//==========================================================>>
1430
1450private:
1451 void setFrcdOtptWhnVdd(const bool &newVal);
1452 void setStOnWhnOtpFrcd(const bool &newVal);
1453protected:
1454 enum fdaVmpbStts{
1455 stOffNotVPP,
1456 stOffVPP,
1457 stOnNVRP,
1458 //--------
1459 stOnVVP,
1460 stOnVddNVUP,
1461 stOffVddNVUP,
1462 stOffVddVUP,
1463 stOffUnVdd,
1464 //--------
1465 stOnVRP,
1466 stOnTurnOff,
1467 stOff,
1468 //--------
1469 stDisabled
1470 };
1471 fdaVmpbStts _mpbFdaState {stOffNotVPP};
1472
1473 void (*_fnWhnTrnOffVdd)() {nullptr};
1474 void (*_fnWhnTrnOnVdd)() {nullptr};
1475 bool _frcOtptLvlWhnVdd {true};
1476 bool _isVoided{false};
1477 bool _stOnWhnOtptFrcd{false};
1478 bool _validVoidPend{false};
1479 bool _validUnvoidPend{false};
1480
1481 virtual void mpbPollCallback();
1482 uint32_t _otptsSttsPkg(uint32_t prevVal = 0);
1483 bool setVoided(const bool &newVoidValue);
1484 virtual void stDisabled_In();
1485 virtual void stDisabled_Out();
1486 virtual void stOffNotVPP_In(){};
1487 virtual void stOffVddNVUP_Do(){}; //This provides a setting point for calculating the _validUnvoidPend
1488 virtual void stOffVPP_Do(){}; // This provides a setting point for the voiding mechanism to be started
1489 void _turnOffVdd();
1490 void _turnOnVdd();
1491 virtual void updFdaState();
1492 virtual bool updVoidStatus() = 0;
1493public:
1501 VdblMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0, const bool &isOnDisabled = false);
1505 virtual ~VdblMPBttn();
1509 void clrStatus(bool clrIsOn = true);
1518 fncPtrType getFnWhnTrnOffVdd();
1527 fncPtrType getFnWhnTrnOnVdd();
1537 bool getFrcOtptLvlWhnVdd();
1545 const bool getIsVoided() const;
1557 bool getStOnWhnOtpFrcd();
1565 void setFnWhnTrnOffVddPtr(void(*newFnWhnTrnOff)());
1573 void setFnWhnTrnOnVddPtr(void(*newFnWhnTrnOn)());
1584 bool setIsNotVoided();
1592 bool setIsVoided();
1593};
1594
1595//==========================================================>>
1596
1606protected:
1607 unsigned long int _voidTime;
1608 unsigned long int _voidTmrStrt{0};
1609
1610 virtual void stOffNotVPP_In();
1611 virtual void stOffVddNVUP_Do(); //This provides a setting point for calculating the _validUnvoidPend
1612 virtual void stOffVPP_Do(); // This provides a setting point for the voiding mechanism to be started
1613 bool updIsPressed();
1614 virtual bool updVoidStatus();
1615public:
1623 TmVdblMPBttn(const uint8_t &mpbttnPin, unsigned long int voidTime, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0, const bool &isOnDisabled = false);
1627 virtual ~TmVdblMPBttn();
1631 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1635 void clrStatus();
1643 const unsigned long int getVoidTime() const;
1654 bool setVoidTime(const unsigned long int &newVoidTime);
1655};
1656
1657//==========================================================>>
1658
1675protected:
1676 virtual void stOffVddNVUP_Do(); //This provides the calculation for the _validUnvoidPend
1677 virtual bool updVoidStatus();
1678public:
1684 SnglSrvcVdblMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp = true, const bool &typeNO = true, const unsigned long int &dbncTimeOrigSett = 0, const unsigned long int &strtDelay = 0);
1688 virtual ~SnglSrvcVdblMPBttn();
1692 virtual bool begin(const unsigned long int &pollDelayMs = _StdPollDelay);
1693};
1694
1695//==========================================================>>
1696
1697#endif /*_BUTTONTOSWITCH_H_*/
Models a Debounced Delayed Double Action Latched MPB combo switch (Debounced Delayed DALDD-MPB - DD-D...
Definition ButtonToSwitch.h:1150
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:1955
~DDlydDALtchMPBttn()
Class virtual destructor.
Definition ButtonToSwitch.cpp:1951
DDlydDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:1946
Abstract class, base to model Double Action LDD-MPBs (DALDD-MPBs).
Definition ButtonToSwitch.h:1018
bool setScndModActvDly(const unsigned long &newVal)
Sets a new value for the scndModActvDly class attribute.
Definition ButtonToSwitch.cpp:1689
void setFnWhnTrnOnScndryPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch.cpp:1682
fncPtrType getFnWhnTrnOnScndry()
Returns the function that is set to execute every time the object enters the Secondary On State.
Definition ButtonToSwitch.cpp:1646
void clrStatus(bool clrIsOn=true)
See DbncddMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:1631
bool getIsOnScndry()
Returns the current value of the isOnScndry attribute flag.
Definition ButtonToSwitch.cpp:1651
unsigned long getScndModActvDly()
Returns the current value of the scndModActvDly class attribute.
Definition ButtonToSwitch.cpp:1656
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:1623
void setFnWhnTrnOffScndryPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object enters the Secondary Off State...
Definition ButtonToSwitch.cpp:1674
fncPtrType getFnWhnTrnOffScndry()
returns the function that is set to execute every time the object enters the Secondary Off State.
Definition ButtonToSwitch.cpp:1641
~DblActnLtchMPBttn()
Virtual destructor.
Definition ButtonToSwitch.cpp:1619
DblActnLtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Abstract Class constructor.
Definition ButtonToSwitch.cpp:1614
Models a Debounced Delayed MPB (DD-MPB).
Definition ButtonToSwitch.h:493
DbncdDlydMPBttn()
Default constructor.
Definition ButtonToSwitch.cpp:794
void setStrtDelay(const unsigned long int &newStrtDelay)
Sets a new value to the "Start Delay" strtDelay attribute.
Definition ButtonToSwitch.cpp:815
bool init(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
see DbncdMPBttn::init(const uint8_t, const bool, const bool, const unsigned long int)
Definition ButtonToSwitch.cpp:805
Base class, models a Debounced Momentary Push Button (D-MPB).
Definition ButtonToSwitch.h:120
fncPtrType getFnWhnTrnOn()
Returns the function that is set to execute every time the object enters the On State.
Definition ButtonToSwitch.cpp:200
const unsigned long int getPollPeriodMs()
Returns the poll period time setting attribute's value.
Definition ButtonToSwitch.cpp:240
void resetFda()
Resets the MPB behavior automaton to it's Initial or Start State
Definition ButtonToSwitch.cpp:420
void clrStatus(bool clrIsOn=true)
Clears and resets flags, timers and counters modified through the object's signals processing.
Definition ButtonToSwitch.cpp:140
const unsigned long int getCurDbncTime() const
Returns the current debounce period time set for the object.
Definition ButtonToSwitch.cpp:190
void enable()
Enables the input signal processing.
Definition ButtonToSwitch.cpp:169
bool pause()
Pauses the software timer updating the computation of the object's internal flags value (object's sta...
Definition ButtonToSwitch.cpp:292
virtual ~DbncdMPBttn()
Default virtual destructor.
Definition ButtonToSwitch.cpp:109
void setIsOnDisabled(const bool &newIsOnDisabled)
Sets the value of the isOnDisabled attribute.
Definition ButtonToSwitch.cpp:517
bool init(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0)
Initializes an object instantiated by the default constructor.
Definition ButtonToSwitch.cpp:255
bool end()
Detaches the object from the timer that monitors the input pins, compute and updates the object's sta...
Definition ButtonToSwitch.cpp:174
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.cpp:114
void resetDbncTime()
Resets the debounce process time of the object to the value used at instantiation.
Definition ButtonToSwitch.cpp:414
DbncdMPBttn()
Default class constructor.
Definition ButtonToSwitch.cpp:84
void disable()
Disables the input signal processing, ignoring the changes of its values.
Definition ButtonToSwitch.cpp:164
bool resume()
Restarts the software timer updating the calculation of the object internal flags.
Definition ButtonToSwitch.cpp:428
const bool getIsEnabled() const
Returns the value of the isEnabled attribute flag, indicating the Enabled or Disabled status of the o...
Definition ButtonToSwitch.cpp:205
const unsigned long int getLstPollTime()
Returns the time stamp of the last state update for the object.
Definition ButtonToSwitch.cpp:225
const bool getIsOnDisabled() const
Returns the value of the isOnDisabled attribute.
Definition ButtonToSwitch.cpp:215
void setFnWhnTrnOffPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object enters the Off State.
Definition ButtonToSwitch.cpp:483
const bool getOutputsChange() const
Returns the value of the outputsChange attribute flag.
Definition ButtonToSwitch.cpp:235
const bool getIsOn() const
Returns the value of the isOn attribute flag.
Definition ButtonToSwitch.cpp:210
bool getUpdTmrAttchd()
Returns the value of the Attached to the update timer attribute.
Definition ButtonToSwitch.cpp:250
void setFnWhnTrnOnPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object enters the On State.
Definition ButtonToSwitch.cpp:492
unsigned long int getStrtDelay()
Returns the current value of strtDelay attribute.
Definition ButtonToSwitch.cpp:245
const uint32_t getOtptsSttsPkgd()
Returns the relevant attribute flags values for the object state encoded as a 32 bits value.
Definition ButtonToSwitch.cpp:230
fncPtrType getFnWhnTrnOff()
Returns the function that is set to execute every time the object enters the Off State.
Definition ButtonToSwitch.cpp:195
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.cpp:540
bool setDbncTime(const unsigned long int &newDbncTime)
Sets the debounce process time.
Definition ButtonToSwitch.cpp:468
Models a Hinted Timer Latch DD-MPB, a.k.a. Staircase Switch (HTiLDD-MPB).
Definition ButtonToSwitch.h:768
bool setSrvcTime(const unsigned long int &newSvcTime)
See TmLtchMPBttn::setSrvcTime(const unsigned long int)
Definition ButtonToSwitch.cpp:1337
fncPtrType getFnWhnTrnOnPilot()
Returns the function that is set to execute every time the object's Pilot attribute flag enters the O...
Definition ButtonToSwitch.cpp:1248
void setFnWhnTrnOffWrnngPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object's Warning is reset.
Definition ButtonToSwitch.cpp:1309
fncPtrType getFnWhnTrnOffWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch.cpp:1243
const bool getWrnngOn() const
Returns the current value of the warningOn attribute flag.
Definition ButtonToSwitch.cpp:1263
void setFnWhnTrnOnPilotPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object's Pilot is set.
Definition ButtonToSwitch.cpp:1316
HntdTmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const unsigned int &wrnngPrctg=0, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:1207
const bool getPilotOn() const
Returns the current value of the pilotOn attribute flag.
Definition ButtonToSwitch.cpp:1258
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:1221
fncPtrType getFnWhnTrnOffPilot()
Returns the function that is set to execute every time the object's Pilot attribute flag enters the O...
Definition ButtonToSwitch.cpp:1238
void setFnWhnTrnOnWrnngPtr(void(*newFnWhnTrnOn)())
Sets the function that will be called to execute every time the object's Wrnng is set.
Definition ButtonToSwitch.cpp:1323
bool setWrnngPrctg(const unsigned int &newWrnngPrctg)
Sets the value for the percentage of service time for calculating the warningOn flag value.
Definition ButtonToSwitch.cpp:1349
fncPtrType getFnWhnTrnOnWrnng()
Returns the function that is set to execute every time the object's Warning attribute flag enters the...
Definition ButtonToSwitch.cpp:1253
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:1213
void setFnWhnTrnOffPilotPtr(void(*newFnWhnTrnOff)())
Sets the function that will be called to execute every time the object's Pilot is reset.
Definition ButtonToSwitch.cpp:1302
void setKeepPilot(const bool &newKeepPilot)
Sets the configuration of the keepPilot service attribute.
Definition ButtonToSwitch.cpp:1330
Abstract class, base to model Latched Debounced Delayed MPBs (LDD-MPB).
Definition ButtonToSwitch.h:549
const bool getIsLatched() const
Returns the value of the isLatched attribute flag, indicating the Latched or Unlatched condition of t...
Definition ButtonToSwitch.cpp:846
bool unlatch()
Sets the values of the flags needed to unlatch a latched MPB.
Definition ButtonToSwitch.cpp:902
const bool getUnlatchRlsPend() const
Returns the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch.cpp:861
LtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:824
const bool getUnlatchPend() const
Returns the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch.cpp:856
void setUnlatchPend(const bool &newVal)
Sets the value of the "Valid Unlatch Pending" attribute.
Definition ButtonToSwitch.cpp:888
void setTrnOffASAP(const bool &newVal)
Sets the value of the trnOffASAP attribute.
Definition ButtonToSwitch.cpp:881
bool getTrnOffASAP()
Returns the value of the trnOffASAP attribute flag.
Definition ButtonToSwitch.cpp:851
void setUnlatchRlsPend(const bool &newVal)
Sets the value of the "Valid Unlatch Release Pending" attribute.
Definition ButtonToSwitch.cpp:895
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:829
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:837
Models a Slider Double Action LDD-MPB combo switch, a.k.a. off/on/dimmer, a.k.a. off/on/volume radio ...
Definition ButtonToSwitch.h:1193
void clrStatus(bool clrIsOn=true)
Definition ButtonToSwitch.cpp:2018
bool setOtptSldrSpd(const uint16_t &newVal)
Sets the output slider speed (otptSldrSpd) attribute.
Definition ButtonToSwitch.cpp:2087
uint16_t getOtptValMax()
Returns the top output current value register setting.
Definition ButtonToSwitch.cpp:2052
bool getOtptCurValIsMin()
Returns the result of comparing the Output Current Value to the Minimum value setting
Definition ButtonToSwitch.cpp:2037
bool setSldrDirDn()
Sets the value of the curSldrDirUp attribute to false.
Definition ButtonToSwitch.cpp:2170
bool setOtptValMax(const uint16_t &newVal)
Sets the output current value register maximum value attribute (otptValMax attribute).
Definition ButtonToSwitch.cpp:2113
bool swapSldrDir()
Inverts the current curSldrDirUp attribute value.
Definition ButtonToSwitch.cpp:2280
~SldrDALtchMPBttn()
Virtual class destructor.
Definition ButtonToSwitch.cpp:2014
bool setOtptCurVal(const uint16_t &newVal)
Sets the output current value register.
Definition ButtonToSwitch.cpp:2074
uint16_t getOtptCurVal()
Returns the Output Current Value (otpCurVal) attribute.
Definition ButtonToSwitch.cpp:2027
bool setSldrDirUp()
Sets the value of the curSldrDirUp attribute to true.
Definition ButtonToSwitch.cpp:2175
bool getSldrDirUp()
Returns the value of the curSldrDirUp attribute.
Definition ButtonToSwitch.cpp:2062
bool setOtptSldrStpSize(const uint16_t &newVal)
Sets the output slider step size (otptSldrStpSize) attribute value.
Definition ButtonToSwitch.cpp:2100
bool getOtptCurValIsMax()
Returns a boolean value indicating if the "Output Current Value" equals the maximum limit.
Definition ButtonToSwitch.cpp:2032
SldrDALtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0, const uint16_t initVal=0xFFFF)
Class constructor.
Definition ButtonToSwitch.cpp:2008
void setSwpDirOnPrss(const bool &newVal)
Sets the value of the "Auto-Swap Direction On Press" (autoSwpDirOnPrss) attribute.
Definition ButtonToSwitch.cpp:2187
bool setOtptValMin(const uint16_t &newVal)
Sets the output current value register minimum value attribute (otptValMin attribute).
Definition ButtonToSwitch.cpp:2132
uint16_t getOtptValMin()
Returns the bottom output current value register setting.
Definition ButtonToSwitch.cpp:2057
unsigned long getOtptSldrSpd()
Returns the current setting for the Output Slider Speed value.
Definition ButtonToSwitch.cpp:2042
uint16_t getOtptSldrStpSize()
Returns the current setting for the Output Slider Step Size value.
Definition ButtonToSwitch.cpp:2047
void setSwpDirOnEnd(const bool &newVal)
Sets the value of the "Auto-Swap Direction on Ends" (autoSwpDirOnEnd) attribute.
Definition ButtonToSwitch.cpp:2180
Models a Single Service Voidable DD-MPB a.k.a. Trigger switch (SSVDD-MPB)
Definition ButtonToSwitch.h:1674
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:2733
SnglSrvcVdblMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:2721
virtual ~SnglSrvcVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch.cpp:2729
Models a Toggle Latch DD-MPB, a.k.a. a Toggle Switch (ToLDD-MPB).
Definition ButtonToSwitch.h:681
TgglLtchMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:1104
Models a Timer Latch DD-MPB, a.k.a. Timer Switch (TiLDD-MPB).
Definition ButtonToSwitch.h:705
const unsigned long int getSrvcTime() const
Returns the configured Service Time.
Definition ButtonToSwitch.cpp:1153
void setTmerRstbl(const bool &newIsRstbl)
Configures the timer for the Service Time to be reseted before it reaches unlatching time.
Definition ButtonToSwitch.cpp:1170
bool setSrvcTime(const unsigned long int &newSrvcTime)
Sets a new value to the Service Time attribute.
Definition ButtonToSwitch.cpp:1158
void clrStatus(bool clrIsOn=true)
see DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:1146
TmLtchMPBttn(const uint8_t &mpbttnPin, const unsigned long int &svcTime, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0)
Class constructor.
Definition ButtonToSwitch.cpp:1138
Models a Time Voidable DD-MPB, a.k.a. Anti-tampering switch (TVDD-MPB)
Definition ButtonToSwitch.h:1605
virtual ~TmVdblMPBttn()
Class virtual destructor.
Definition ButtonToSwitch.cpp:2643
void clrStatus()
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:2655
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:2647
TmVdblMPBttn(const uint8_t &mpbttnPin, unsigned long int voidTime, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0, const bool &isOnDisabled=false)
Class constructor.
Definition ButtonToSwitch.cpp:2638
const unsigned long int getVoidTime() const
Returns the voidTime attribute current value.
Definition ButtonToSwitch.cpp:2662
bool setVoidTime(const unsigned long int &newVoidTime)
Sets a new value to the Void Time attribute.
Definition ButtonToSwitch.cpp:2667
Abstract class, base to model Voidable DD-MPBs (VDD-MPB).
Definition ButtonToSwitch.h:1449
bool setIsVoided()
Sets the value of the isVoided attribute flag to true.
Definition ButtonToSwitch.cpp:2383
const bool getIsVoided() const
Returns the current value of the isVoided attribute flag.
Definition ButtonToSwitch.cpp:2321
fncPtrType getFnWhnTrnOnVdd()
Returns the function that is set to execute every time the object enters the Voided or "Voided On" St...
Definition ButtonToSwitch.cpp:2311
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:2297
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.cpp:2364
virtual ~VdblMPBttn()
Default virtual destructor.
Definition ButtonToSwitch.cpp:2293
fncPtrType getFnWhnTrnOffVdd()
Returns the function that is set to execute every time the object exits the Voided State.
Definition ButtonToSwitch.cpp:2306
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.cpp:2356
bool getFrcOtptLvlWhnVdd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch.cpp:2316
bool getStOnWhnOtpFrcd()
Returns the value of the frcOtptLvlWhnVdd attribute.
Definition ButtonToSwitch.cpp:2326
bool setIsNotVoided()
Sets the value of the isVoided attribute flag to false.
Definition ButtonToSwitch.cpp:2378
VdblMPBttn(const uint8_t &mpbttnPin, const bool &pulledUp=true, const bool &typeNO=true, const unsigned long int &dbncTimeOrigSett=0, const unsigned long int &strtDelay=0, const bool &isOnDisabled=false)
Class constructor.
Definition ButtonToSwitch.cpp:2287
Models an External Unlatch LDD-MPB, a.k.a. Emergency Latched Switch (XULDD-MPB)
Definition ButtonToSwitch.h:949
void clrStatus(bool clrIsOn=true)
See DbncdMPBttn::clrStatus(bool)
Definition ButtonToSwitch.cpp:1571
XtrnUnltchMPBttn(const uint8_t &mpbttnPin, DbncdDlydMPBttn *unLtchBttn, const bool &pulledUp, const bool &typeNO, const unsigned long int &dbncTimeOrigSett, const unsigned long int &strtDelay)
Class constructor.
Definition ButtonToSwitch.cpp:1543
virtual bool begin(const unsigned long int &pollDelayMs=_StdPollDelay)
See DbncdMPBttn::begin(const unsigned long int)
Definition ButtonToSwitch.cpp:1555
Type to hold the complete set of output attribute flags from any DbncdMPBttn class and subclasses obj...
Definition ButtonToSwitch.h:63