Merge remote-tracking branch 'origin/main' into round-robin-matrix

This commit is contained in:
down 2022-07-19 01:09:49 +07:00
commit ff153838d9
3 changed files with 22 additions and 0 deletions

View file

@ -36,6 +36,20 @@ config ZMK_KSCAN_GPIO_ROUND_ROBIN_MATRIX
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_GPIO_ROUND_ROBIN_MATRIX))
select ZMK_KSCAN_GPIO_DRIVER
if ZMK_KSCAN_GPIO_MATRIX || ZMK_KSCAN_GPIO_ROUND_ROBIN_MATRIX
config ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS
int "Ticks to wait between each output when scanning"
default 0
help
When iterating over each output to drive it active, read inputs, then set
inactive again, some boards may take time for the previous output to
"settle" before reading inputs for the next active output column. In that
scenario, set this value to a positive value to configure the number of
usecs to wait after reading each column of keys.
endif # ZMK_KSCAN_GPIO_MATRIX
config ZMK_KSCAN_MOCK_DRIVER
bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_MOCK))

View file

@ -250,6 +250,10 @@ static int kscan_matrix_read(const struct device *dev) {
LOG_ERR("Failed to set output %i inactive: %i", o, err);
return err;
}
#if CONFIG_ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS > 0
k_busy_wait(CONFIG_ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS);
#endif
}
// Process the new state.

View file

@ -144,6 +144,10 @@ static int kscan_round_robin_matrix_read(const struct device *dev) {
LOG_ERR("Failed to set output %i inactive: %i", o, err);
return err;
}
#if CONFIG_ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS > 0
k_busy_wait(CONFIG_ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS);
#endif
}
data->scan_time += config->poll_period_ms;