MCPcopy Create free account
hub / github.com/TailsmanDesign/PocketMage_PDA / processKB_USB

Function processKB_USB

Code/PocketMage_V3/src/OS_APPS/USB.cpp:208–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void processKB_USB() {
209 int currentMillis = millis();
210 char inchar = 0;
211
212 // 1. Drain the hardware buffer continuously at loop speed
213 inchar = KB().updateKeypress();
214
215 // 2. Only process the actual input if the cooldown has expired
216 if (currentMillis - KBBounceMillis >= KB_COOLDOWN) {
217 if (inchar != 0) {
218 KBBounceMillis = currentMillis; // Reset the debounce timer
219
220 // HANDLE INPUTS
221 // Home / Exit / App Switcher recieved
222 if (inchar == 12 || inchar == 8 || inchar == 19 || inchar == 28 || inchar == 23) {
223 USBAppShutdown();
224 prefs.begin("PocketMage", false);
225 prefs.putInt("CurrentAppState", static_cast<int>(HOME));
226 prefs.putBool("Seamless_Reboot", true);
227 prefs.end();
228 esp_restart();
229 }
230 }
231 }
232
233 // 3. Update OLED at 10FPS, completely independent of keyboard bounce
234 currentMillis = millis();
235 if (currentMillis - OLEDFPSMillis >= (1000/10 /*OLED_MAX_FPS*/)) {
236 OLEDFPSMillis = currentMillis;
237 OLED().oledLine(currentLine, currentLine.length(), false);
238 }
239}
240
241void einkHandler_USB() {
242 if (newState) {

Callers 1

processKBFunction · 0.85

Calls 5

USBAppShutdownFunction · 0.85
updateKeypressMethod · 0.80
endMethod · 0.80
oledLineMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected