RSeries astromech firmware
ButtonController.h
Go to the documentation of this file.
1 #ifndef ButtonController_h
2 #define ButtonController_h
3 
4 #include "ReelTwo.h"
5 #include "core/SetupEvent.h"
6 #include "core/AnimatedEvent.h"
7 
8 #ifdef LedControlMAX7221_h
9 #define DBC_TEECES_D_PIN 6
10 #define DBC_TEECES_C_PIN 7
11 #define DBC_TEECES_L_PIN 8
12 #endif
13 
14 #define DBC_PIN_DISABLED 255
15 #define DBC_PIN_MAIN_POWER_RELAY 16
16 #define DBC_POWER_DOWN_DELAY 2000 // milliseconds time between Power Down Sound Trigger and Turning OFF Main Power Relay
17 #define DBC_SPEED 1
18 
19 #define DBC_LEFT_BUTTON_MAX 4 //4; A, B, C, D
20 #define DBC_RIGHT_BUTTON_MAX 4 //4; 1, 2, 3 // this will be increased to 4 to allow the full 16 outputs (A1 to D4)
21 
22 // GENERAL CONSTANT VARIABLES
23 #define ON 1
24 #define OFF 0
25 
26 // #define HIGH 1
27 // #define LOW 0
28 
29 // REAR PSI LIGHTING MODES
30 #define PSI_YELLOW 1
31 #define PSI_GREEN 2
32 #define PSI_BOTH 3
33 #define PSI_ALTERNATE 4
34 #define PSI_RANDOM -1
35 
36 static const byte DBC_PIN_MAP[] PROGMEM = {
37  DBC_PIN_DISABLED, /* Dummy pin 0 */
38  12, /* Pin 1 */
39  13, /* Pin 2 */
40 #ifdef USE_SMQ
41  DBC_PIN_DISABLED, /* Pin 3 - disabled used for RX Serial */
42  DBC_PIN_DISABLED, /* Pin 4 - disabled used for TX Serial */
43 #else
44  1, /* Pin 3 */
45  0, /* Pin 4 */
46 #endif
47  A3, /* Pin 5 */
48  A2, /* Pin 6 */
49  A1, /* Pin 7 */
50  A0, /* Pin 8 */
51  11, /* Pin 9 */
52  10, /* Pin 10 */
53  9, /* Pin 11 */
54 #ifdef DBC_TEECES_L_PIN
55  DBC_PIN_DISABLED, /* Pin 12 - disabled */
56 #else
57  8, /* Pin 12 */
58 #endif
59 #ifdef DBC_TEECES_D_PIN
60  DBC_PIN_DISABLED, /* Pin 13 - disabled */
61 #else
62  7, /* Pin 13 */
63 #endif
64 #ifdef DBC_TEECES_D_PIN
65  DBC_PIN_DISABLED, /* Pin 14 - disabled */
66 #else
67  6, /* Pin 14 */
68 #endif
69  5, /* Pin 15 */
70  4 /* Pin 16 - power relay */
71 };
72 #define DBC_PIN_MAP_SIZE sizeof(DBC_PIN_MAP)/sizeof(DBC_PIN_MAP[0])
73 
90 {
91 public:
93  void (*flasher)(byte color, int rate) = NULL,
94  const byte leftInputPin = 2,
95  const byte rightInputPin = 3) :
96  fLeftInputPin(leftInputPin),
97  fRightInputPin(rightInputPin),
98  fFlasher(flasher),
99  fMainState(0),
100  fLastTime(0),
101  fNONECounter(0),
102  fBOTHCounter(0),
103  fLEFTCounter(0),
104  fRIGHTCounter(0),
105  fLeftButtonCount(0),
106  fRightButtonCount(0),
107  fInvalidInput(false),
108  fInvalidTime(0),
109  fLedStatusState(0),
110  fYellowRate(0),
111  fGreenRate(0),
112  fYellowFlash(0),
113  fGreenFlash(0),
114  fLEDColor(0),
115  fLEDRate(0),
116  fPowerDown(false),
117  fPowerDownInitialize(false),
118  fPowerDownTime(0),
119  fPowerDownDelay(DBC_POWER_DOWN_DELAY),
120  fDisplaySequence(0)
121  {
122  for (byte i = 0; i < sizeof(fIO); i++)
123  fIO[0] = 0;
124  }
125 
126  virtual void setup() override
127  {
128  // Switch 3 - Power Up Trigger (LEFT)
129  pinMode(fLeftInputPin, INPUT);
130  // Switch 1 - Power Up Trigger (RIGHT)
131  pinMode(fRightInputPin, INPUT);
132 
133  // turn on pullup resistors
134  digitalWrite(fLeftInputPin, HIGH);
135  digitalWrite(fRightInputPin, HIGH);
136  }
137 
138  virtual void animate() override
139  {
140  unsigned long now = millis();
141  if (now - fLastTime > DBC_SPEED)
142  {
143  fLastTime = now;
144  switch (fMainState)
145  {
146  // BOTH INPUTS HIGH (NOT PRESSED)
147  case 0:
148  {
149  if (fPowerDown)
150  {
151  fLEDColor = OFF;
152  }
153  else
154  {
155  fLEDColor = PSI_ALTERNATE;
156  fLEDRate = PSI_RANDOM;
157  }
158  // wait for Extenal Trigger #1 and #2 to go HIGH before watching for external negative trigger
159  if (digitalRead(fLeftInputPin) == HIGH && digitalRead(fRightInputPin) == HIGH)
160  {
161  // Both Buttons need to be Released for 100mS to prevent a false trigger
162  if (fNONECounter++ > 100)
163  {
164  // both external lines are not triggered - ready to watch for negative trigger (go to next state)
165  fMainState++;
166  fNONECounter = 0;
167  }
168  }
169  else
170  {
171  fNONECounter = 0;
172  }
173  break;
174  }
175 
176  // KeyPad Open - reserved for sound or light action
177  case 1:
178  {
179  #ifdef USE_SMQ
180  SMQ::send_start(SMQID("DBCState"));
181  SMQ::send_uint8(MSGID("state"), fMainState);
182  SMQ::send_end();
183  #endif
184  fMainState++;
185  break;
186  }
187 
188  // Watch for LEFT and RIGHT button press
189  case 2:
190  {
191  // wait for BOTH Extenal Trigger #1 and #2 to go LOW
192  if (digitalRead(fLeftInputPin) == LOW && digitalRead(fRightInputPin) == LOW)
193  {
194  // Both Buttons need to be Held Low to trigger Lights
195  if (fBOTHCounter++ > 20)
196  {
197  fLEDColor = PSI_BOTH;
198  fLEDRate = ON;
199  }
200  // Both Buttons need to be Held Low for 100 second (100 x 10mS)
201  if (fBOTHCounter++ > 1000)
202  {
203  fBOTHCounter = 0;
204  fMainState++;
205  }
206  }
207  else
208  {
209  // BOTH buttons not pressed - continue Alternate Pattern
210  if (fPowerDown)
211  {
212  fLEDColor = OFF;
213  }
214  else
215  {
216  fLEDColor = PSI_ALTERNATE;
217  fLEDRate = PSI_RANDOM;
218  }
219  // turn on both Yellow and Green if buttons pressed
220  fBOTHCounter = 0;
221  }
222  break;
223  }
224 
225  // KeyPad Activated - reserved for sound or light action
226  case 3:
227  {
228  #ifdef USE_SMQ
229  SMQ::send_start(SMQID("DBCState"));
230  SMQ::send_uint8(MSGID("state"), fMainState);
231  SMQ::send_end();
232  #endif
233  // Turn off ALL LED's when KeyPad is Unlocked and ready for user input
234  fLEDColor = OFF;
235  fLEDRate = OFF;
236  fMainState++;
237  break;
238  }
239 
240  // Wait for Both Lines to be Released before proceeding
241  case 4:
242  {
243  // wait for Extenal Trigger #1 and #2 to go HIGH before watching for external negative trigger
244  if (digitalRead(fLeftInputPin) == HIGH && digitalRead(fRightInputPin) == HIGH)
245  {
246  // Both Buttons need to be Held Low for 0.200 second (20 x 10mS)
247  if (fNONECounter++ > 20)
248  {
249  fMainState++;
250  fNONECounter = 0;
251  // Turn off ALL LED's when KeyPad is Unlocked and ready for user input
252  fLEDColor = OFF;
253  fLEDRate = OFF;
254  }
255  }
256  else
257  {
258  fNONECounter = 0;
259  }
260  break;
261  }
262 
263  // reserved for sound or light action
264  case 5:
265  {
266  fMainState++;
267  break;
268  }
269 
270  // Watch for LEFT, RIGHT, or BOTH button press
271  case 6:
272  {
273  //
274  // Left Button(s) must be pressed first (before Right Button)
275  //
276  // Once Right Button(s) have been pressed (RightButton >0); pressing the left button again will abort the sequence
277  //
278  //
279  // after a code has been entered - reduce the double press time requirementto 150mS
280  // if no activity in 10 seconds - reset the 2 second double press time requirement
281  if (digitalRead(fLeftInputPin) == LOW && digitalRead(fRightInputPin) == HIGH)
282  {
283  // LEFT button pressed
284  fRIGHTCounter = 0;
285  fBOTHCounter = 0;
286  fNONECounter = 0;
287 
288  // debounce the button press
289  if (fLEFTCounter++ > 20)
290  {
291  fLEDColor = PSI_YELLOW;
292  fLEDRate = ON;
293  fLEFTCounter = 0;
294  //check to see if Right Button has been pressed previously or if Left Button has been pressed too much
295  // if so, SET ERROR FLAG
296  if (++fLeftButtonCount > DBC_LEFT_BUTTON_MAX || fRightButtonCount)
297  {
298  fInvalidInput = 1;
299  }
300  // Look for next Button Press
301  fMainState = 4;
302  #ifdef USE_SMQ
303  SMQ::send_start(SMQID("DBCLeft"));
304  SMQ::send_uint8(MSGID("count"), fLeftButtonCount);
305  SMQ::send_end();
306  #endif
307  }
308  }
309  else if (digitalRead(fRightInputPin) == LOW && digitalRead(fLeftInputPin) == HIGH)
310  {
311  // RIGHT button pressed
312  fLEFTCounter = 0;
313  fBOTHCounter = 0;
314  fNONECounter = 0;
315 
316  if (fRIGHTCounter++ > 20)
317  {
318  fLEDColor = PSI_GREEN;
319  fLEDRate = ON;
320  fRIGHTCounter = 0;
321  //check to see if Left Button has NOT been pressed previously or if Right Button has been pressed too much
322  // if so, SET ERROR FLAG
323  if (++fRightButtonCount > DBC_RIGHT_BUTTON_MAX || !fLeftButtonCount)
324  {
325  fInvalidInput = 1;
326  }
327  // Look for next Button Press
328  fMainState = 4;
329  #ifdef USE_SMQ
330  SMQ::send_start(SMQID("DBCRight"));
331  SMQ::send_uint8(MSGID("count"), fRightButtonCount);
332  SMQ::send_end();
333  #endif
334  }
335  }
336  else if (digitalRead(fRightInputPin) == LOW && digitalRead(fLeftInputPin) == LOW)
337  {
338  // BOTH buttons pressed
339  fLEFTCounter = 0;
340  fRIGHTCounter = 0;
341  fNONECounter = 0;
342 
343  if (fBOTHCounter++ > 20)
344  {
345  fLEDColor = PSI_BOTH;
346  fLEDRate = ON;
347  fBOTHCounter = 0;
348  fNONECounter = 0;
349 
350  if (!fLeftButtonCount || !fRightButtonCount)
351  {
352  fInvalidInput = 1;
353  }
354  // process user inputs
355  fMainState = 7;
356  #ifdef USE_SMQ
357  SMQ::send_start(SMQID("DBCState"));
358  SMQ::send_uint8(MSGID("state"), fMainState);
359  SMQ::send_end();
360  #endif
361  }
362  }
363  else
364  {
365  // NO buttons pressed
366  fLEFTCounter = 0;
367  fRIGHTCounter = 0;
368  fBOTHCounter = 0;
369 
370  if (fNONECounter++ > 4000)
371  {
372  // if nothing is pressed for 5 seconds reset system
373  fNONECounter = 0;
374  fLEDColor = OFF;
375  fLEDRate = OFF;
376  fMainState = 8;
377  fInvalidInput = 1;
378  }
379  }
380  break;
381  }
382 
383  case 7:
384  {
385  // wait for Both Buttons to go HIGH
386  if (digitalRead(fLeftInputPin) == HIGH && digitalRead(fRightInputPin) == HIGH)
387  {
388  if (fNONECounter++ > 20)
389  {
390  fLEDColor = OFF;
391  fLEDRate = OFF;
392  fMainState = 9;
393  }
394  }
395  break;
396  }
397 
398  case 8:
399  {
400  // KEYPAD TIMED OUT - DO SOMETHING SPECIAL
401  #ifdef USE_SMQ
402  SMQ::send_start(MSGID("DBCState"));
403  SMQ::send_uint8(MSGID("state"), fMainState);
404  SMQ::send_end();
405  #endif
406  fMainState++;
407  break;
408  }
409 
410  case 9:
411  {
412  // PROCESS USER INPUTS
413  fLEDColor = OFF;
414  fLEDRate = OFF;
415 
416  fMainState = (fInvalidInput) ? 13 : 11;
417  break;
418  }
419 
420  case 10:
421  {
422  // not used
423  fMainState++;
424  break;
425  }
426 
427  case 11:
428  {
429  #ifdef USE_SMQ
430  SMQ::send_start(MSGID("DBCPress"));
431  SMQ::send_uint8(MSGID("left"), fLeftButtonCount);
432  SMQ::send_uint8(MSGID("right"), fRightButtonCount);
433  SMQ::send_end();
434  #endif
435  // Process Valid Input Command: LEFT = 1-4 RIGHT = 1-3
436  // Now that a Valid Input has been received - allow Rear PSI Lights to turn ON
437  fFirstTime = 0;
438 
439  // produce a value from 1 to 16 (A1-D4)
440  int address = (((DBC_LEFT_BUTTON_MAX * fLeftButtonCount) + fRightButtonCount) - DBC_LEFT_BUTTON_MAX);
441 
442  #ifdef DBC_PIN_MAIN_POWER_RELAY
443  // If The System was Previously Powered Down - Then ONLY a POWER UP CODE IS VALID - ALL OTHERS ARE INVALID
444  if (fPowerDown)
445  {
446  if (address == DBC_PIN_MAIN_POWER_RELAY)
447  {
448  #ifdef USE_SMQ
449  SMQ::send_start(SMQID("DBCPower"));
450  SMQ::send_boolean(MSGID("on"), true);
451  SMQ::send_end();
452  #endif
453  fPowerDown = 0;
454  /* TRIGGER MAIN POWER RELAY - TURN ON POWER*/
456  fMainState++;
457  break;
458  }
459  else
460  {
461  // Invalid Input
462  fMainState = 13;
463  break;
464  }
465  }
466  #endif
467  /*
468  A1 1:1 1
469  A2 1:2 2
470  A3 1:3 3
471  A4 1:4 4
472  B1 2:1 5
473  B2 2:2 6
474  B3 2:3 7
475  B4 2:4 8
476  C1 3:1 9
477  C2 3:2 10
478  C3 3:3 11
479  C4 3:4 12
480  D1 4:1 13
481  D2 4:2 14
482  D3 4:3 15
483  D4 4:4 16
484  */
485  // Toggle The IO Pin State
486 
487  if (fIO[address] == HIGH)
488  {
489  fIO[address] = LOW;
490  setOutputPin(address, LOW);
491  #ifdef DBC_PIN_MAIN_POWER_RELAY
492  if (address == DBC_PIN_MAIN_POWER_RELAY)
493  {
494  // POWER DOWN SEQUENCE
495  fPowerDownInitialize= 1;
496  fPowerDownTime = 0;
497  }
498  #endif
499  }
500  else
501  {
502  fIO[address] = HIGH;
503  #ifdef DBC_PIN_MAIN_POWER_RELAY
504  if (address == DBC_PIN_MAIN_POWER_RELAY)
505  {
506  // POWER DOWN SEQUENCE
507  #ifdef USE_SMQ
508  SMQ::send_start(SMQID("DBCPowerDown"));
509  SMQ::send_uint16(MSGID("delay"), fPowerDownDelay);
510  SMQ::send_end();
511  #endif
512  fPowerDownInitialize = 1;
513  setOutputPin(address, LOW);
514  fPowerDownTime = 0;
515  }
516  else
517  #endif
518  {
519  setOutputPin(address, HIGH);
520  }
521  }
522  fMainState++;
523  break;
524  }
525 
526  case 12:
527  {
528  // Display Valid Input
529 
530  // wait for BOTH Extenal Trigger #1 and #2 to go LOW
531  if (digitalRead(fLeftInputPin) == LOW && digitalRead(fRightInputPin) == LOW)
532  {
533  // Both Buttons are HELD - EXIT and Allow User to Enter a New Code
534  if (fBOTHCounter++ > 50)
535  {
536  fBOTHCounter = 0;
537  fYellowRate = 0;
538  fGreenRate = 0;
539  fLeftButtonCount = 0;
540  fRightButtonCount = 0;
541  fInvalidInput = 0;
542  fLedStatusState = 0;
543  // EXIT and Allow User to Enter a New Code (state 3)
544  fMainState = 3;
545  }
546  }
547  else
548  {
549  // BOTH buttons not pressed - continue FEEDBACK ROUTINE
550  fBOTHCounter = 0;
551  }
552 
554  // Flash Yellow for Left
555  // Flash Green for Right
556  switch (fLedStatusState)
557  {
558  // TURN ALL LEDs OFF - BEFORE FLASHING STATE
559  case 0:
560  {
561  fLEDColor = OFF;
562  fLEDRate = OFF;
563  if (fYellowRate++ > 300)
564  {
565  fYellowRate = 0; // clear flag
566  fLedStatusState++;
567  }
568  break;
569  }
570  // YELLOW ON
571  case 1:
572  {
573  fLEDColor = PSI_YELLOW;
574  fLEDRate = ON;
575  if (fYellowRate++ > 75)
576  {
577  // clear flag
578  fYellowRate = 0;
579  fLedStatusState++;
580  }
581  break;
582  }
583 
584  // YELLOW OFF
585  case 2:
586  {
587  fLEDColor = OFF;
588 
589  if (fYellowRate++ > 150)
590  {
591  // clear flag
592  fYellowRate = 0;
593  // check for the need to flash Yellow again (if Left was pressed more than once)
594  if (++fYellowFlash >= fLeftButtonCount)
595  {
596  fYellowFlash = 0;
597  fLedStatusState++;
598  }
599  else
600  {
601  fLedStatusState = 1;
602  }
603  }
604  break;
605  }
606 
607  // GREEN ON
608  case 3:
609  {
610  fLEDColor = PSI_GREEN;
611  fLEDRate = ON;
612 
613  if (fGreenRate++ > 75)
614  {
615  // clear flag
616  fGreenRate = 0;
617  fLedStatusState++;
618  }
619  break;
620  }
621 
622  // GREEN OFF
623  case 4:
624  {
625  fLEDColor = OFF;
626 
627  if (fGreenRate++ > 150)
628  {
629  // clear flag
630  fGreenRate = 0;
631  if (++fGreenFlash >= fRightButtonCount)
632  {
633  fGreenFlash = 0;
634  fLedStatusState++;
635  }
636  else
637  {
638  fLedStatusState = 3;
639  }
640  }
641  break;
642  }
643 
644  // ALL OFF
645  case 5:
646  {
647  if (fGreenRate++ > 300)
648  {
649  fGreenRate = 0;
650  fLedStatusState++;
651  }
652  break;
653  }
654 
655  // REPEAT
656  case 6:
657  {
658  // In Future and || (PowerDown) || (PowerDownInitialize) to prevent repeating the code sequence during a power down.
659  if (++fDisplaySequence > 1)
660  {
661  fDisplaySequence = 0;
662  fLedStatusState++;
663  }
664  else
665  {
666  fLedStatusState = 1;
667  }
668  break;
669  }
670 
671  case 7:
672  {
673  // small delay before resuming psi routine
674  if (fGreenRate++ > 100)
675  {
676  fGreenRate = 0;
677  fLeftButtonCount = 0;
678  fRightButtonCount = 0;
679  fInvalidInput = 0;
680  fLedStatusState = 0;
681  fMainState = 0;
682  }
683  break;
684  }
685  }
686  // end of case 12
687  break;
688  }
689 
690  case 13:
691  {
692  #ifdef USE_SMQ
693  SMQ::send_start(SMQID("DBCState"));
694  SMQ::send_uint8(MSGID("state"), fMainState);
695  SMQ::send_end();
696  #endif
697  // INVALID INPUT - DO SOMETHING SPECIAL
698 
699  // wait for BOTH Extenal Trigger #1 and #2 to go LOW
700  if (digitalRead(fLeftInputPin) == LOW && digitalRead(fRightInputPin) == LOW)
701  {
702  // Both Buttons are HELD - EXIT and Allow User to Enter a New Code
703  if (fBOTHCounter++ > 50)
704  {
705  fBOTHCounter = 0;
706  fYellowRate = 0;
707  fGreenRate = 0;
708  fLeftButtonCount = 0;
709  fRightButtonCount = 0;
710  fInvalidInput = 0;
711  fLedStatusState = 0;
712  // EXIT and Allow User to Enter a New Code (state 3)
713  fMainState = 3;
714  }
715  }
716  else
717  {
718  // BOTH buttons not pressed - continue FEEDBACK ROUTINE
719  fBOTHCounter = 0;
720  }
721 
722  fLEDColor = PSI_ALTERNATE;
723  fLEDRate = 100;
724  fLeftButtonCount = 0;
725  fRightButtonCount = 0;
726  fInvalidInput = 0;
727 
728  if (fInvalidTime++ > 2000)
729  {
730  fInvalidTime = 0;
731  // RESTART ENTIRE SEQUENCE
732  fMainState = 0;
733  }
734  break;
735  }
736  }// end of switch(MainState)
737 
738  // update LEDs
739  if (fFlasher != NULL)
740  fFlasher(fLEDColor, fLEDRate);
741 
744  // create a power down initialization flag to begin counter - then clear a
745  // IF POWER DOWN COMMAND WAS ENTERED (D3) THEN SET TIMER FOR POWER DOWN.
746  if (fPowerDownInitialize && fPowerDownTime > fPowerDownDelay)
747  {
748  fPowerDownTime = 0;
749  fPowerDown = 1;
750  fPowerDownInitialize = 0;
751 
752  #ifdef USE_SMQ
753  SMQ::send_start(SMQID("DBCPower"));
754  SMQ::send_boolean(MSGID("on"), false);
755  SMQ::send_end();
756  #endif
757  // RESET ALL SETTINGS AND WAIT FOR POWER UP KEYPAD SEQUENCE
758  for (unsigned pin = 1; pin < DBC_PIN_MAP_SIZE; pin++)
759  {
760  setOutputPin(pin, LOW);
761  }
762  for (unsigned n = 0; n < 17; n++)
763  {
764  // Set all outputs LOW
765  fIO[n] = 0;
766  }
767  }
768  }
769 
770  }
771 
772  void setOutputPin(byte domePin, bool state)
773  {
774  #ifdef USE_SMQ
775  SMQ::send_start(SMQID("DBCPin"));
776  SMQ::send_uint8(MSGID("pin"), domePin);
777  SMQ::send_boolean(MSGID("state"), state);
778  SMQ::send_end();
779  #endif
780  int pin;
781  if ((pin = pinMap(domePin)) != DBC_PIN_DISABLED)
782  digitalWrite(pin, state);
783  }
784 
785 private:
786  const byte fLeftInputPin;
787  const byte fRightInputPin;
788  void (*fFlasher)(byte color, int rate);
789 
790  // State Variables
791  byte fMainState;
792 
793  unsigned long fLastTime;
794 
795  unsigned fNONECounter;
796  unsigned fBOTHCounter;
797  unsigned fLEFTCounter;
798  unsigned fRIGHTCounter;
799 
800  // counter that is incremented on each Left Button Press
801  byte fLeftButtonCount;
802  // counter that is incremented on each Right Button Press
803  byte fRightButtonCount;
804 
805  // flag to indicate an invalid input from user
806  bool fInvalidInput;
807  int fInvalidTime;
808 
809  byte fLedStatusState;
810  int fYellowRate;
811  int fGreenRate;
812  byte fYellowFlash;
813  byte fGreenFlash;
814 
815  byte fLEDColor;
816  int fLEDRate;
817 
818  bool fFirstTime = true;
819  bool fPowerDown;
820  bool fPowerDownInitialize;
821  int fPowerDownTime;
822  int fPowerDownDelay;
823 
824  byte fDisplaySequence;
825  byte fIO[DBC_PIN_MAP_SIZE];
826 
827  static inline int pinMap(byte pin)
828  {
829  return (pin < DBC_PIN_MAP_SIZE) ? pgm_read_byte(&DBC_PIN_MAP[pin]) : DBC_PIN_DISABLED;
830  }
831 };
832 
833 #endif
DBC_POWER_DOWN_DELAY
#define DBC_POWER_DOWN_DELAY
Definition: ButtonController.h:16
PSI_ALTERNATE
#define PSI_ALTERNATE
Definition: ButtonController.h:33
ButtonController::setup
virtual void setup() override
Subclasses must implement this function to perform any necessary setup that cannot happen in the cons...
Definition: ButtonController.h:126
ReelTwo.h
SetupEvent.h
AnimatedEvent
Base class for all animated devices. AnimatedEvent::animate() is called for each device once through ...
Definition: AnimatedEvent.h:18
SMQ::send_end
static void send_end()
Definition: ReelTwoSMQ.h:463
SetupEvent
Base class for all devices that require setup that cannot happen in the constructor....
Definition: SetupEvent.h:15
ButtonController::ButtonController
ButtonController(void(*flasher)(byte color, int rate)=NULL, const byte leftInputPin=2, const byte rightInputPin=3)
Definition: ButtonController.h:92
PSI_GREEN
#define PSI_GREEN
Definition: ButtonController.h:31
AnimatedEvent.h
MSGID
#define MSGID(str)
Definition: ReelTwo.h:360
PSI_RANDOM
#define PSI_RANDOM
Definition: ButtonController.h:34
DBC_LEFT_BUTTON_MAX
#define DBC_LEFT_BUTTON_MAX
Definition: ButtonController.h:19
SMQ::send_start
static void send_start(const smq_id id)
Definition: ReelTwoSMQ.h:173
DBC_RIGHT_BUTTON_MAX
#define DBC_RIGHT_BUTTON_MAX
Definition: ButtonController.h:20
ButtonController::setOutputPin
void setOutputPin(byte domePin, bool state)
Definition: ButtonController.h:772
SMQ::send_uint16
static void send_uint16(const msg_id id, uint16_t val)
Definition: ReelTwoSMQ.h:316
OFF
#define OFF
Definition: ButtonController.h:24
ON
#define ON
Definition: ButtonController.h:23
PSI_BOTH
#define PSI_BOTH
Definition: ButtonController.h:32
DBC_PIN_MAIN_POWER_RELAY
#define DBC_PIN_MAIN_POWER_RELAY
Definition: ButtonController.h:15
SMQID
#define SMQID(str)
Definition: ReelTwo.h:359
DBC_SPEED
#define DBC_SPEED
Definition: ButtonController.h:17
DBC_PIN_MAP_SIZE
#define DBC_PIN_MAP_SIZE
Definition: ButtonController.h:72
SMQ::send_uint8
static void send_uint8(const msg_id id, uint8_t val)
Definition: ReelTwoSMQ.h:292
SMQ::send_boolean
static void send_boolean(const msg_id id, bool val)
Definition: ReelTwoSMQ.h:412
PSI_YELLOW
#define PSI_YELLOW
Definition: ButtonController.h:30
ButtonController::animate
virtual void animate() override
Subclasses must implement this function to run through a single frame of animation/activity.
Definition: ButtonController.h:138
DBC_PIN_DISABLED
#define DBC_PIN_DISABLED
Definition: ButtonController.h:14
ButtonController
Controller class for ia-parts.com Dome Button Controller.
Definition: ButtonController.h:88