workaround for bug in Keypad library: need to set the pull-ups earlier, so the first reading isn't bad

This commit is contained in:
Jorj Bauer 2021-01-20 07:41:24 -05:00
parent d1f42a8771
commit fc805b57e2
1 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,12 @@ static uint8_t shiftedNumber[] = { '<', // ,
TeensyKeyboard::TeensyKeyboard(VMKeyboard *k) : PhysicalKeyboard(k)
{
// Need to set the rows to be pull-ups early, so the pullups have
// time to settle -- otherwise we get a phantom set of keypresses
// on startup for all the keys in the first column
for (byte i=0; i<ROWS; i++) {
pinMode(rowsPins[i], INPUT_PULLUP);
}
keypad.setDebounceTime(10);
leftShiftPressed = false;