aboutsummaryrefslogtreecommitdiff
path: root/keyboards/handwired/frenchdev/matrix.c
diff options
context:
space:
mode:
authorNick Brassel <[email protected]>2024-02-28 21:47:37 +1100
committerNick Brassel <[email protected]>2024-02-28 21:47:37 +1100
commit4e369d405af6bba1adce6337b2e1b1ea1788566c (patch)
treeb0f020feff1809e37c9e7795d344929ff0bb290a /keyboards/handwired/frenchdev/matrix.c
parent4e04da397ef643f8fcf4afbe1d19f63aee1fc561 (diff)
parentdd1706e468bb18dd7f7ae143de735a5d3be1bfb8 (diff)
downloadqmk_firmware-0.24.0.tar.gz
qmk_firmware-0.24.0.zip
Merge branch 'develop'0.24.0
Diffstat (limited to 'keyboards/handwired/frenchdev/matrix.c')
-rw-r--r--keyboards/handwired/frenchdev/matrix.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c
index 3e859d47ef..af7c8b5444 100644
--- a/keyboards/handwired/frenchdev/matrix.c
+++ b/keyboards/handwired/frenchdev/matrix.c
@@ -151,7 +151,7 @@ uint8_t matrix_scan(void)
if (matrix_debouncing[i] != cols) {
matrix_debouncing[i] = cols;
if (debouncing) {
- debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ dprintf("bounce!: %02X\n", debouncing);
}
debouncing = DEBOUNCE;
}
@@ -224,15 +224,9 @@ static matrix_row_t read_cols(uint8_t row)
return 0;
} else {
uint8_t data = 0;
- mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOB, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT); if (mcp23018_status) goto out;
- data = i2c_read_nack(I2C_TIMEOUT); if (mcp23018_status < 0) goto out;
- data = ~((uint8_t)mcp23018_status);
- mcp23018_status = I2C_STATUS_SUCCESS;
- out:
- i2c_stop();
- return data;
+ mcp23018_status = i2c_readReg(I2C_ADDR, GPIOB, &data, 1, I2C_TIMEOUT);
+
+ return ~data;
}
} else {
// read from teensy
@@ -263,11 +257,10 @@ static void unselect_rows(void)
// do nothing
} else {
// set all rows hi-Z : 1
- mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write( 0xFF & ~(0<<8), I2C_TIMEOUT); if (mcp23018_status) goto out;
- out:
- i2c_stop();
+ uint8_t data;
+ data = 0xFF & ~(0<<8);
+ mcp23018_status = i2c_writeReg(I2C_ADDR, GPIOA, &data, 1, I2C_TIMEOUT);
+
}
// unselect on teensy
@@ -289,11 +282,8 @@ static void select_row(uint8_t row)
} else {
// set active row low : 0
// set other rows hi-Z : 1
- mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write(GPIOA, I2C_TIMEOUT); if (mcp23018_status) goto out;
- mcp23018_status = i2c_write( 0xFF & ~(1<<row) & ~(0<<8), I2C_TIMEOUT); if (mcp23018_status) goto out;
- out:
- i2c_stop();
+ uint8_t data = 0xFF & ~(1<<row) & ~(0<<8);
+ mcp23018_status = i2c_writeReg(I2C_ADDR, GPIOA, &data, 1, I2C_TIMEOUT);
}
} else {
// select on teensy