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

Function InputHandler

boards/m5stack-cores3/interface.cpp:35–67  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

33** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
34**********************************************************************/
35void InputHandler(void) {
36 static unsigned long tm = 0;
37 if (millis() - tm < 200 && !LongPress) return;
38 M5.update();
39 auto t = M5.Touch.getDetail();
40 if (t.isPressed() || t.isHolding()) {
41 tm = millis();
42
43 if (bruceConfigPins.rotation == 3) {
44 t.y = (tftHeight + 20) - t.y;
45 t.x = tftWidth - t.x;
46 }
47 if (bruceConfigPins.rotation == 0) {
48 int tmp = t.x;
49 t.x = tftWidth - t.y;
50 t.y = tmp;
51 }
52 if (bruceConfigPins.rotation == 2) {
53 int tmp = t.x;
54 t.x = t.y;
55 t.y = (tftHeight + 20) - tmp;
56 }
57
58 if (!wakeUpScreen()) AnyKeyPress = true;
59 else return;
60
61 // Touch point global variable
62 touchPoint.x = t.x;
63 touchPoint.y = t.y;
64 touchPoint.pressed = true;
65 touchHeatMap(touchPoint);
66 }
67}
68
69/*********************************************************************
70** Function: powerOff

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected