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

Function InputHandler

boards/xk404/interface.cpp:98–128  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

96** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
97**********************************************************************/
98void InputHandler(void) {
99 static unsigned long tm = 0;
100 if (millis() - tm < 200 && !LongPress) return;
101 bool _u = digitalRead(UP_BTN);
102 bool _d = digitalRead(DW_BTN);
103 bool _l = digitalRead(L_BTN);
104 bool _r = digitalRead(R_BTN);
105 bool _s = digitalRead(SEL_BTN);
106
107 if (!_s || !_u || !_d || !_r || !_l) {
108 tm = millis();
109 if (!wakeUpScreen()) AnyKeyPress = true;
110 else return;
111 }
112 if (!_l) { PrevPress = true; }
113 if (!_r) { NextPress = true; }
114 if (!_u) {
115 UpPress = true;
116 PrevPagePress = true;
117 }
118 if (!_d) {
119 DownPress = true;
120 NextPagePress = true;
121 }
122 if (!_s) { SelPress = true; }
123 if (!_l && !_r) {
124 EscPress = true;
125 NextPress = false;
126 PrevPress = false;
127 }
128}
129
130/*********************************************************************
131** Function: powerOff

Callers 9

taskInputHandlerFunction · 0.50
showVolumeControlFunction · 0.50
musicPlayerUIFunction · 0.50
performClickingFunction · 0.50
clicker_setupFunction · 0.50
mic_record_appFunction · 0.50
u2f_setupFunction · 0.50
native_micRecordWavFunction · 0.50
checkFunction · 0.50

Calls 2

millisFunction · 0.85
wakeUpScreenFunction · 0.85

Tested by

no test coverage detected