Browse Source

matrix: wait for row signal to go HIGH for every row (#12945)

I noticed this discrepancy (last row of the matrix treated differently than the
others) when optimizing the input latency of my keyboard controller, see also
https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/

Before this commit, when tuning the delays I noticed ghost key presses when
pressing the F2 key, which is on the last row of the keyboard matrix: the
dead_grave key, which is on the first row of the keyboard matrix, would be
incorrectly detected as pressed.

After this commit, all keyboard matrix rows are interpreted correctly.

I suspect that my setup is more susceptible to this nuance than others because I
use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask
the problem.
pull/12951/head
Michael Stapelberg 3 years ago
committed by GitHub
parent
commit
82aa9ad4a5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 12 deletions
  1. +2
    -6
      quantum/matrix.c
  2. +2
    -6
      quantum/split_common/matrix.c

+ 2
- 6
quantum/matrix.c View File

@ -116,9 +116,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// Unselect row
unselect_row(current_row);
if (current_row + 1 < MATRIX_ROWS) {
matrix_output_unselect_delay(); // wait for row signal to go HIGH
}
matrix_output_unselect_delay(); // wait for all Col signals to go HIGH
// If the row has changed, store the row and return the changed flag.
if (current_matrix[current_row] != current_row_value) {
@ -178,9 +176,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Unselect col
unselect_col(current_col);
if (current_col + 1 < MATRIX_COLS) {
matrix_output_unselect_delay(); // wait for col signal to go HIGH
}
matrix_output_unselect_delay(); // wait for all Row signals to go HIGH
return matrix_changed;
}


+ 2
- 6
quantum/split_common/matrix.c View File

@ -130,9 +130,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// Unselect row
unselect_row(current_row);
if (current_row + 1 < MATRIX_ROWS) {
matrix_output_unselect_delay(); // wait for row signal to go HIGH
}
matrix_output_unselect_delay(); // wait for all Col signals to go HIGH
// If the row has changed, store the row and return the changed flag.
if (current_matrix[current_row] != current_row_value) {
@ -192,9 +190,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Unselect col
unselect_col(current_col);
if (current_col + 1 < MATRIX_COLS) {
matrix_output_unselect_delay(); // wait for col signal to go HIGH
}
matrix_output_unselect_delay(); // wait for all Row signals to go HIGH
return matrix_changed;
}


Loading…
Cancel
Save