diff options
author | David Hoelscher <[email protected]> | 2024-01-17 07:05:38 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-17 14:05:38 +0100 |
commit | e9bd7d7ad308f9c72c86863bf9f19382c7e2d892 (patch) | |
tree | c46ce87aaa57b8f49dc0a2b56527f0bc606038ab /keyboards/handwired/frenchdev/frenchdev.c | |
parent | 2b0965944d9065daa65cd25540cf2dd007f23eda (diff) | |
download | qmk_firmware-e9bd7d7ad308f9c72c86863bf9f19382c7e2d892.tar.gz qmk_firmware-e9bd7d7ad308f9c72c86863bf9f19382c7e2d892.zip |
I2C driver cleanup (#21273)
* remove i2c_start and i2c_stop from i2c drivers
* remove static i2c_address variable from chibios i2c driver
Diffstat (limited to 'keyboards/handwired/frenchdev/frenchdev.c')
-rw-r--r-- | keyboards/handwired/frenchdev/frenchdev.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/keyboards/handwired/frenchdev/frenchdev.c b/keyboards/handwired/frenchdev/frenchdev.c index 6eed4de5ff..65f1ccce4b 100644 --- a/keyboards/handwired/frenchdev/frenchdev.c +++ b/keyboards/handwired/frenchdev/frenchdev.c @@ -83,23 +83,16 @@ uint8_t init_mcp23018(void) { // - unused : input : 1 // - input : input : 1 // - driving : output : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, I2C_TIMEOUT); if (mcp23018_status) goto out; - i2c_stop(); - - // set pull-up - // - unused : on : 1 - // - input : on : 1 - // - driving : off : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, I2C_TIMEOUT); if (mcp23018_status) goto out; - -out: - i2c_stop(); + uint8_t data[] = {0b00000000, 0b00111111}; + mcp23018_status = i2c_writeReg(I2C_ADDR, IODIRA, data, sizeof(data), I2C_TIMEOUT); + + if (!mcp23018_status) { + // set pull-up + // - unused : on : 1 + // - input : on : 1 + // - driving : off : 0 + mcp23018_status = i2c_writeReg(I2C_ADDR, GPPUA, data, sizeof(data), I2C_TIMEOUT); + } // SREG=sreg_prev; |