Browse Source

kimera: Fix the error handling of reading matrix mapping

kimera
Kai Ryu 9 years ago
parent
commit
f9e449f7cf
1 changed files with 13 additions and 10 deletions
  1. 13
    10
      keyboard/kimera/kimera.c

+ 13
- 10
keyboard/kimera/kimera.c View File



/* init i2c */ /* init i2c */
i2c_init(); i2c_init();
/* init i/o expanders */ /* init i/o expanders */
kimera_scan(); kimera_scan();


uint8_t error = 0; uint8_t error = 0;


/* read number of rows and cols */ /* read number of rows and cols */
row_count = eeprom_read_byte(EECONFIG_ROW_COUNT);
col_count = eeprom_read_byte(EECONFIG_COL_COUNT);
if (row_count == 0) error++;
if (row_count == UNCONFIGURED) error++;
if (col_count == 0) error++;
if (col_count == UNCONFIGURED) error++;
if (row_count + col_count > PX_COUNT) error++;
uint8_t rows = eeprom_read_byte(EECONFIG_ROW_COUNT);
uint8_t cols = eeprom_read_byte(EECONFIG_COL_COUNT);
if (rows == 0) error++;
if (rows == UNCONFIGURED) error++;
if (cols == 0) error++;
if (cols == UNCONFIGURED) error++;
if (rows + cols > PX_COUNT) error++;
if (error) return error;
row_count = rows;
col_count = cols;


/* read row mapping */ /* read row mapping */
uint8_t *mapping = EECONFIG_ROW_COL_MAPPING; uint8_t *mapping = EECONFIG_ROW_COL_MAPPING;
/* write inversion register */ /* write inversion register */
/* /*
for (uint8_t exp = 0; exp < EXP_COUNT; exp++) { for (uint8_t exp = 0; exp < EXP_COUNT; exp++) {
expander_write_inversion(exp, data[exp]);
}
expander_write_inversion(exp, data[exp]);
}
*/ */


/* set output bit */ /* set output bit */