Fix errors with matrix_output_unselect_delay function calls (#13645)

This commit is contained in:
Drashna Jaelre 2021-07-22 21:42:59 -07:00 committed by GitHub
parent 750f40566a
commit 816accda3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 58 deletions

View File

@ -178,7 +178,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
writePin(MATRIX_MUL_SELECT, col_sel[col_index]);
waitInputPinDelay();
# endif
while (readPin(col_pins[col_index]) == 0) {}
while (readPin(col_pins[col_index]) == 0) {
}
MATRIX_DEBUG_DELAY_END();
}
}
@ -204,7 +205,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
# endif
if (MATRIX_IO_DELAY_ALWAYS || current_row + 1 < MATRIX_ROWS) {
MATRIX_DEBUG_DELAY_START();
matrix_output_unselect_delay(); // wait for col signal to go HIGH
matrix_output_unselect_delay(current_row, current_row_value != 0);
MATRIX_DEBUG_DELAY_END();
}
@ -267,7 +268,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
// Unselect col
unselect_col(current_col);
if (MATRIX_IO_DELAY_ALWAYS || current_col + 1 < MATRIX_COLS) {
matrix_output_unselect_delay(); // wait for col signal to go HIGH
matrix_output_unselect_delay(current_row, current_row_value != 0);
}
return matrix_changed;
@ -311,11 +312,13 @@ uint8_t matrix_scan(void) {
changed |= read_rows_on_col(raw_matrix, current_col);
}
#endif
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_END();
MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_START();
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
MATRIX_DEBUG_SCAN_END(); MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_END();
MATRIX_DEBUG_GAP();
MATRIX_DEBUG_SCAN_START();
matrix_scan_quantum();

View File

@ -4,7 +4,7 @@
/* In tmk_core/common/wait.h, the implementation for PROTOCOL_CHIBIOS
* calls 'chThdSleepMicroseconds(1)' when 'wait_us(0)'.
* However, 'wait_us(0)' should do nothing. */
void matrix_output_unselect_delay(void) {
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
# if !defined(MATRIX_IO_DELAY) || MATRIX_IO_DELAY > 0
matrix_io_delay();
# endif

View File

@ -38,7 +38,7 @@ static void delay_inline(const uint32_t cycles) {
}
}
void matrix_output_unselect_delay(void) {
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
// Use the cycle counter to do precise timing in microseconds. The ChibiOS
// thread sleep functions only allow sleep durations starting at 1 tick, which
// is 100μs in our configuration.

View File

@ -141,7 +141,7 @@ uint8_t matrix_scan(void) {
/* Drive row pin high again. */
ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[row_idx]); }
matrix_output_unselect_delay();
matrix_output_unselect_delay(row_idx, row_pins[row_idx] != 0);
}
if (memcmp(raw_matrix, current_matrix, sizeof(current_matrix)) != 0) {

View File

@ -12,22 +12,20 @@
#include "common_oled.h"
#include <transactions.h>
void keyboard_post_init_kb(void)
{
void keyboard_post_init_kb(void) {
touch_encoder_init();
transaction_register_rpc(TOUCH_ENCODER_SYNC, touch_encoder_slave_sync);
transaction_register_rpc(RGB_MENU_SYNC, rgb_menu_slave_sync);
keyboard_post_init_user();
}
void housekeeping_task_kb(void)
{
void housekeeping_task_kb(void) {
touch_encoder_update(TOUCH_ENCODER_SYNC);
rgb_menu_update(RGB_MENU_SYNC);
}
#if defined(BUSY_WAIT)
void matrix_output_unselect_delay(void) {
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
for (int32_t i = 0; i < BUSY_WAIT_INSTRUCTIONS; i++) {
__asm__ volatile("nop" ::: "memory");
}