Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the prototype of matrix_output_unselect_delay() #13045

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions quantum/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ __attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[]

// Unselect row
unselect_row(current_row);
matrix_output_unselect_delay(); // wait for all Col signals to go HIGH
matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for all Col signals to go HIGH

// Update the matrix
current_matrix[current_row] = current_row_value;
Expand Down Expand Up @@ -222,6 +222,8 @@ __attribute__((weak)) void matrix_init_pins(void) {
}

__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
bool key_pressed = false;

// Select col
if (!select_col(current_col)) { // select col
return; // skip NO_PIN col
Expand All @@ -234,6 +236,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]
if (readMatrixPin(row_pins[row_index]) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
key_pressed = true;
} else {
// Pin HI, clear col bit
current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col);
Expand All @@ -242,7 +245,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]

// Unselect col
unselect_col(current_col);
matrix_output_unselect_delay(); // wait for all Row signals to go HIGH
matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
}

# else
Expand Down
2 changes: 1 addition & 1 deletion quantum/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ matrix_row_t matrix_get_row(uint8_t row);
void matrix_print(void);
/* delay between changing matrix pin state and reading values */
void matrix_output_select_delay(void);
void matrix_output_unselect_delay(void);
void matrix_output_unselect_delay(uint8_t line, bool key_pressed);
/* only for backwards compatibility. delay between changing matrix pin state and reading values */
void matrix_io_delay(void);

Expand Down
2 changes: 1 addition & 1 deletion quantum/matrix_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uint8_t matrix_key_count(void) {
__attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); }

__attribute__((weak)) void matrix_output_select_delay(void) { waitInputPinDelay(); }
__attribute__((weak)) void matrix_output_unselect_delay(void) { matrix_io_delay(); }
__attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { matrix_io_delay(); }

// CUSTOM MATRIX 'LITE'
__attribute__((weak)) void matrix_init_custom(void) {}
Expand Down