Correct where we need to pause before reading

Otherwise, for example, Pin F0 may not be read on the Planck
Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/473/head
Jesse Vincent 6 years ago
parent d193d7bba0
commit fa94cb6e20

@ -66,7 +66,6 @@ void __attribute__((optimize(3))) ATMegaKeyboard::readMatrix(void) {
mask = KeyboardHardware.debounceMaskForRow(current_row);
OUTPUT_TOGGLE(KeyboardHardware.matrix_row_pins[current_row]);
asm volatile("nop");
cols = (KeyboardHardware.readCols() & mask) | (KeyboardHardware.keyState_[current_row] & ~mask);
OUTPUT_TOGGLE(KeyboardHardware.matrix_row_pins[current_row]);
KeyboardHardware.debounceRow(cols ^ KeyboardHardware.keyState_[current_row], current_row);
@ -141,6 +140,7 @@ bool ATMegaKeyboard::isKeyMasked(byte row, byte col) {
uint16_t ATMegaKeyboard::readCols() {
uint16_t results = 0x00 ;
for (uint8_t i = 0; i < KeyboardHardware.matrix_columns; i++) {
asm("NOP"); // We need to pause a beat before reading or we may read before the pin is hot
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[i]) << i);
}
return results;

Loading…
Cancel
Save