** Function: InputHandler ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress **********************************************************************/
| 135 | ** Handles the variables PrevPress, NextPress, SelPress, AnyKeyPress and EscPress |
| 136 | **********************************************************************/ |
| 137 | void 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 { |
nothing calls this directly
no test coverage detected