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

Function InputHandler

boards/m5stack-cplus1_1/interface.cpp:45–63  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

43** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
44**********************************************************************/
45void InputHandler(void) {
46 static unsigned long tm = 0;
47 if (launcherMillis() - tm < 200 && !LongPress) return;
48
49 bool upPressed = (axp192.GetBtnPress());
50 bool selPressed = (launcherGpioRead(SEL_BTN) == LOW);
51 bool dwPressed = (launcherGpioRead(DW_BTN) == LOW);
52
53 bool anyPressed = upPressed || selPressed || dwPressed;
54 if (anyPressed) tm = launcherMillis();
55 if (anyPressed && wakeUpScreen()) return;
56
57 AnyKeyPress = anyPressed;
58 EscPress = upPressed & dwPressed;
59 if (EscPress) return;
60 PrevPress = upPressed;
61 NextPress = dwPressed;
62 SelPress = selPressed;
63}
64
65void powerOff() { axp192.PowerOff(); }
66

Callers

nothing calls this directly

Calls 4

launcherMillisFunction · 0.85
launcherGpioReadFunction · 0.85
wakeUpScreenFunction · 0.85
GetBtnPressMethod · 0.80

Tested by

no test coverage detected