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

Function InputHandler

boards/m5stack-core/interface.cpp:39–57  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

37** Handles the variables PrevPress, NextPress, check(SelPress), AnyKeyPress and EscPress
38**********************************************************************/
39void InputHandler(void) {
40 M5.update();
41 static unsigned long tm = 0;
42 if (millis() - tm < 200 && !LongPress) return;
43
44 bool aPressed = (M5.BtnA.isPressed());
45 bool bPressed = (M5.BtnB.isPressed());
46 bool cPressed = (M5.BtnC.isPressed());
47
48 bool anyPressed = aPressed || bPressed || cPressed;
49 if (anyPressed) tm = millis();
50 if (anyPressed && wakeUpScreen()) return;
51
52 AnyKeyPress = anyPressed;
53 PrevPress = aPressed;
54 EscPress = aPressed;
55 NextPress = cPressed;
56 SelPress = bPressed;
57}
58
59/*********************************************************************
60** Function: powerOff

Callers

nothing calls this directly

Calls 4

millisFunction · 0.85
wakeUpScreenFunction · 0.85
updateMethod · 0.45
isPressedMethod · 0.45

Tested by

no test coverage detected