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

Function InputHandler

boards/phantom/interface.cpp:66–100  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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