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

Function InputHandler

boards/reaper/interface.cpp:120–152  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

118** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress
119**********************************************************************/
120void InputHandler(void) {
121 static unsigned long tm = 0;
122 if (millis() - tm < 200 && !LongPress) return;
123 bool _u = digitalRead(UP_BTN);
124 bool _d = digitalRead(DW_BTN);
125 bool _l = digitalRead(L_BTN);
126 bool _r = digitalRead(R_BTN);
127 bool _s = digitalRead(SEL_BTN);
128 bool _e = digitalRead(ESC_BTN);
129
130 if (!_s || !_u || !_d || !_r || !_l || !_e) {
131 tm = millis();
132 if (!wakeUpScreen()) AnyKeyPress = true;
133 else return;
134 }
135 if (!_l) { PrevPress = true; }
136 if (!_r) { NextPress = true; }
137 if (!_u) {
138 UpPress = true;
139 PrevPagePress = true;
140 }
141 if (!_d) {
142 DownPress = true;
143 NextPagePress = true;
144 }
145 if (!_s) { SelPress = true; }
146
147 if (!_e) {
148 EscPress = true;
149 // NextPress = false;
150 // PrevPress = false;
151 }
152}
153
154/*********************************************************************
155** Function: powerOff

Callers

nothing calls this directly

Calls 2

millisFunction · 0.85
wakeUpScreenFunction · 0.85

Tested by

no test coverage detected