MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / InputHandler

Function InputHandler

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

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

launcherMillisFunction · 0.85
wakeUpScreenFunction · 0.85
isPressedMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected