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

Function InputHandler

boards/m5stack-core2/interface.cpp:38–68  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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