From 6508d8d7b8179b6464ea349d25758ab317767f80 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Thu, 31 Mar 2016 19:01:31 +0900 Subject: [PATCH] kimera: Reduce communication with unused expander --- keyboard/kimera/kimera.c | 80 +++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/keyboard/kimera/kimera.c b/keyboard/kimera/kimera.c index 7082ab42..66fbeeb6 100644 --- a/keyboard/kimera/kimera.c +++ b/keyboard/kimera/kimera.c @@ -84,7 +84,8 @@ static uint8_t col_left_count = 16; static matrix_row_t col_left_mask; #endif static uint8_t data[EXP_COUNT][EXP_PORT_COUNT]; -static uint8_t exp_status = 0; +static uint8_t exp_in_use = 0; +static uint8_t exp_online = 0; static uint8_t read_matrix_mapping(void); static void write_matrix_mapping(void); @@ -146,10 +147,17 @@ uint8_t read_matrix_mapping(void) /* read row mapping */ uint8_t *mapping = EECONFIG_ROW_COL_MAPPING; + uint8_t exp; for (uint8_t i = 0; i < PX_COUNT; i++) { if (i < row_count) { row_mapping[i] = eeprom_read_byte(mapping++); - if (row_mapping[i] >= PX_COUNT) error++; + if (row_mapping[i] >= PX_COUNT) { + error++; + } + else { + exp = PX_TO_EXP(row_mapping[i]); + exp_in_use |= (1<= PX_COUNT) error++; + if (col_mapping[i] >= PX_COUNT) { + error++; + } + else { + exp = PX_TO_EXP(col_mapping[i]); + exp_in_use |= (1<