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

Function InputHandler

boards/elecrow/interface.cpp:71–105  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

69** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
70**********************************************************************/
71void InputHandler(void) {
72 static unsigned long tm = 0;
73 if (launcherMillis() - tm > 200 || LongPress) {
74 if (touch.touched()) {
75 auto t = touch.getPointScaled();
76 auto t2 = touch.getPointRaw();
77 launcherConsolePrintf("\nRAW: Touch Pressed on x=%d, y=%d, rot: %d", t2.x, t2.y, rotation);
78 launcherConsolePrintf("\nBEF: Touch Pressed on x=%d, y=%d, rot: %d", t.x, t.y, rotation);
79 if (rotation == 3) {
80 t.y = (tftHeight + 20) - t.y;
81 t.x = tftWidth - t.x;
82 }
83 if (rotation == 0) {
84 int tmp = t.x;
85 t.x = tftWidth - t.y;
86 t.y = tmp;
87 }
88 if (rotation == 2) {
89 int tmp = t.x;
90 t.x = t.y;
91 t.y = (tftHeight + 20) - tmp;
92 }
93 launcherConsolePrintf("\nAFT: Touch Pressed on x=%d, y=%d, rot: %d\n", t.x, t.y, rotation);
94 tm = launcherMillis();
95 if (!wakeUpScreen()) AnyKeyPress = true;
96 else return;
97
98 // Touch point global variable
99 touchPoint.x = t.x;
100 touchPoint.y = t.y;
101 touchPoint.pressed = true;
102 touchHeatMap(touchPoint);
103 } else touchPoint.pressed = false;
104 }
105}

Callers

nothing calls this directly

Calls 7

launcherMillisFunction · 0.85
launcherConsolePrintfFunction · 0.85
wakeUpScreenFunction · 0.85
touchHeatMapFunction · 0.85
getPointRawMethod · 0.80
touchedMethod · 0.45
getPointScaledMethod · 0.45

Tested by

no test coverage detected