forked from mirrors/qmk_userspace
fix matrix_io_delay() timing in quantum/matrix.c (#9603)
* fix matrix_io_delay() timing in quantum/matrix.c * Updated comments explaining the need for matrix_io_delay() in quantum/matrix.c * fix matrix_io_delay() timing in quantum/split_common/matrix.c * Update quantum/matrix.c Co-authored-by: Ryan <fauxpark@gmail.com> * Update quantum/split_common/matrix.c Co-authored-by: Ryan <fauxpark@gmail.com> * Update quantum/matrix.c Co-authored-by: Ryan <fauxpark@gmail.com> * Update quantum/split_common/matrix.c Co-authored-by: Ryan <fauxpark@gmail.com> * add waitOutputPinValid() and wait_cpuclock() into quantum/quantum.h and tmk_core/common/wait.h * add matrix_output_select_delay() and matrix_output_unselect_delay() * fix quantum/matrix_common.c, tmk_core/common/matrix.h * fix tmk_core/common/wait.h * fix quantum/quantum.h, tmk_core/common/wait.h * waitOutputPinValid() rename to waitInputPinDelay() in quantum/quantum.h. * waitOutputPinValid() rename to waitInputPinDelay() in quantum/matrix_common.c * update tmk_core/common/wait.h * update comment in quantum/matrix.c, quantum/split_common/matrix.c * update quantum/quantum.h: Make more margin in the GPIO_INPUT_PIN_DELAY default value. Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
017aa5988a
commit
302b35c2a0
6 changed files with 109 additions and 8 deletions
|
@ -114,9 +114,9 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
// Start with a clear matrix row
|
||||
matrix_row_t current_row_value = 0;
|
||||
|
||||
// Select row and wait for row selecton to stabilize
|
||||
// Select row
|
||||
select_row(current_row);
|
||||
matrix_io_delay();
|
||||
matrix_output_select_delay();
|
||||
|
||||
// For each col...
|
||||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
@ -129,6 +129,9 @@ 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
|
||||
}
|
||||
|
||||
// If the row has changed, store the row and return the changed flag.
|
||||
if (current_matrix[current_row] != current_row_value) {
|
||||
|
@ -160,9 +163,9 @@ static void init_pins(void) {
|
|||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
|
||||
bool matrix_changed = false;
|
||||
|
||||
// Select col and wait for col selecton to stabilize
|
||||
// Select col
|
||||
select_col(current_col);
|
||||
matrix_io_delay();
|
||||
matrix_output_select_delay();
|
||||
|
||||
// For each row...
|
||||
for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
|
||||
|
@ -188,6 +191,9 @@ 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
|
||||
}
|
||||
|
||||
return matrix_changed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue