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

Function InputHandler

boards/lilygo-t-deck/interface.cpp:137–254  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

135** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
136**********************************************************************/
137void InputHandler(void) {
138 char keyValue = 0;
139 static unsigned long tm = millis();
140 TouchPointPro t;
141 uint8_t touched = 0;
142 uint8_t rot = 5;
143
144#ifdef NORMAL_T_DECK
145 bool isPlus = false;
146#else
147 bool isPlus = true;
148#endif
149 if (rot != bruceConfigPins.rotation) {
150 if (bruceConfigPins.rotation == 1) {
151 touch.setMaxCoordinates(320, 240);
152 touch.setSwapXY(true);
153 touch.setMirrorXY(!isPlus, true);
154 }
155 if (bruceConfigPins.rotation == 3) {
156 touch.setMaxCoordinates(320, 240);
157 touch.setSwapXY(true);
158 touch.setMirrorXY(isPlus, false);
159 }
160 if (bruceConfigPins.rotation == 0) {
161 touch.setMaxCoordinates(240, 320);
162 touch.setSwapXY(false);
163 touch.setMirrorXY(false, !isPlus);
164 }
165 if (bruceConfigPins.rotation == 2) {
166 touch.setMaxCoordinates(240, 320);
167 touch.setSwapXY(false);
168 touch.setMirrorXY(true, isPlus);
169 }
170 rot = bruceConfigPins.rotation;
171 }
172 touched = touch.getPoint(&t.x, &t.y);
173 delay(1);
174 Wire.requestFrom(LILYGO_KB_SLAVE_ADDRESS, 1);
175 while (Wire.available() > 0) {
176 keyValue = Wire.read();
177 delay(1);
178 }
179 if (millis() - tm < 200 && !LongPress) return;
180
181 // 0 - UP
182 // 1 - Down
183 // 2 - Left
184 // 3 - Right
185 if (trackball_interrupted) {
186 uint8_t xx = 1;
187 uint8_t yy = 1;
188 xx += trackball_left_count;
189 xx -= trackball_right_count;
190 yy -= trackball_up_count;
191 yy += trackball_down_count;
192 if (xx == 1 && yy == 1) {
193 ISR_rst();
194 } else {

Callers

nothing calls this directly

Calls 7

millisFunction · 0.85
ISR_rstFunction · 0.85
wakeUpScreenFunction · 0.85
touchHeatMapFunction · 0.85
availableMethod · 0.45
readMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected