MCPcopy Create free account
hub / github.com/BruceDevices/firmware / InputHandler

Function InputHandler

boards/m5stack-cplus2/interface.cpp:58–75  ·  view source on GitHub ↗

** Function: InputHandler ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress **********************************************************************/

Source from the content-addressed store, hash-verified

56** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
57**********************************************************************/
58void InputHandler(void) {
59 static unsigned long tm = 0;
60 if (millis() - tm < 200 && !LongPress) return;
61
62 bool upPressed = (digitalRead(UP_BTN) == LOW);
63 bool selPressed = (digitalRead(SEL_BTN) == LOW);
64 bool dwPressed = (digitalRead(DW_BTN) == LOW);
65
66 bool anyPressed = upPressed || selPressed || dwPressed;
67 if (anyPressed) tm = millis();
68 if (anyPressed && wakeUpScreen()) return;
69
70 AnyKeyPress = anyPressed;
71 PrevPress = upPressed;
72 EscPress = upPressed;
73 NextPress = dwPressed;
74 SelPress = selPressed;
75}
76
77/*********************************************************************
78** Function: powerOff

Callers

nothing calls this directly

Calls 2

millisFunction · 0.85
wakeUpScreenFunction · 0.85

Tested by

no test coverage detected