summaryrefslogtreecommitdiff
path: root/keyboards/cipulot
diff options
context:
space:
mode:
authorCipulot <40441626+Cipulot@users.noreply.github.com>2024-02-26 14:38:52 +0100
committerGitHub <noreply@github.com>2024-02-26 13:38:52 +0000
commit0f701c7dbecc0c90b8e5d74ce81c2575ba0c4144 (patch)
tree4f9c7b404bed777b111f9549943e3a109211b0d7 /keyboards/cipulot
parented791972e1bf812c432655de31e3cf92f3bcf397 (diff)
cipulot/common: Fix for multiple AMUX usage (#23155)
Diffstat (limited to 'keyboards/cipulot')
-rw-r--r--keyboards/cipulot/common/ec_switch_matrix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/keyboards/cipulot/common/ec_switch_matrix.c b/keyboards/cipulot/common/ec_switch_matrix.c
index 945e435e15..845ef99d22 100644
--- a/keyboards/cipulot/common/ec_switch_matrix.c
+++ b/keyboards/cipulot/common/ec_switch_matrix.c
@@ -153,7 +153,10 @@ void ec_noise_floor(void) {
for (uint8_t amux = 0; amux < AMUX_COUNT; amux++) {
disable_unused_amux(amux);
for (uint8_t col = 0; col < amux_n_col_sizes[amux]; col++) {
- uint8_t adjusted_col = amux == 0 ? col : col + amux_n_col_sizes[amux - 1];
+ uint8_t sum = 0;
+ for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
+ sum += amux_n_col_sizes[i];
+ uint8_t adjusted_col = col + sum;
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
ec_config.noise_floor[row][adjusted_col] += ec_readkey_raw(amux, row, col);
}
@@ -178,7 +181,10 @@ bool ec_matrix_scan(matrix_row_t current_matrix[]) {
disable_unused_amux(amux);
for (uint8_t col = 0; col < amux_n_col_sizes[amux]; col++) {
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- uint8_t adjusted_col = amux == 0 ? col : col + amux_n_col_sizes[amux - 1];
+ uint8_t sum = 0;
+ for (uint8_t i = 0; i < (amux > 0 ? amux : 0); i++)
+ sum += amux_n_col_sizes[i];
+ uint8_t adjusted_col = col + sum;
sw_value[row][adjusted_col] = ec_readkey_raw(amux, row, col);
if (ec_config.bottoming_calibration) {