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

Function InputHandler

boards/smoochiee-board/interface.cpp:93–123  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

millisFunction · 0.85
wakeUpScreenFunction · 0.85

Tested by

no test coverage detected