diff options
author | unrelentingtech <greg@unrelenting.technology> | 2021-02-28 09:11:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 17:11:52 +1100 |
commit | ce75f48acb3ba622201a0615bccb5825d118a703 (patch) | |
tree | 476886e4c3c4de338afbe88693d42058f37dd2ea /keyboards/spiderisland/split78/matrix.c | |
parent | 9fd5c6f619ec0745a6774cb3f6fe23dcceb1e621 (diff) |
[Keyboard] Update spiderisland/split78 (#11990)
* [Keyboard] spiderisland/split78: add MCP23018 reset code
Now, communication with the right side gets re-established
after unplugging it and plugging it back in.
* [Keyboard] spiderisland/split78: configure debouncing
I've been experiencing particularly bad bounce on the 'A' key.
Also, update maintainer github username
Diffstat (limited to 'keyboards/spiderisland/split78/matrix.c')
-rw-r--r-- | keyboards/spiderisland/split78/matrix.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/keyboards/spiderisland/split78/matrix.c b/keyboards/spiderisland/split78/matrix.c index b5c7028fdf..71e154e5b7 100644 --- a/keyboards/spiderisland/split78/matrix.c +++ b/keyboards/spiderisland/split78/matrix.c @@ -105,9 +105,17 @@ void matrix_init_custom(void) { } +static i2c_status_t mcp23018_status = I2C_STATUS_SUCCESS; + bool matrix_scan_custom(matrix_row_t current_matrix[]) { bool matrix_has_changed = false; +#if defined(RIGHT_HALF) + if (mcp23018_status != I2C_STATUS_SUCCESS) { + mcp23018_status = mcp23018_init(); + } +#endif + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // Store last value of row prior to reading matrix_row_t last_row_value = current_matrix[row]; @@ -124,7 +132,9 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { // as 0x75 would be no keys pressed uint8_t data = 0x7F; // Receive the columns from right half - i2c_receive(TWI_ADDR_WRITE, &data, 1, I2C_TIMEOUT); + if (mcp23018_status == I2C_STATUS_SUCCESS) { + mcp23018_status = i2c_receive(TWI_ADDR_WRITE, &data, 1, I2C_TIMEOUT); + } #endif cols |= ((~(PINA | 0x80)) & 0x7F); @@ -146,7 +156,9 @@ void matrix_set_row_status(uint8_t row) { //Set the remote row on port A txdata[0] = (GPIOA); txdata[1] = ( 0xFF & ~(1<<row) ); - i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)txdata, 2, I2C_TIMEOUT); + if (mcp23018_status == I2C_STATUS_SUCCESS) { + mcp23018_status = i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)txdata, 2, I2C_TIMEOUT); + } #endif //Set the local row on port B |