diff options
Diffstat (limited to 'keyboards/gboards/gergo/gergo.c')
-rw-r--r-- | keyboards/gboards/gergo/gergo.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/keyboards/gboards/gergo/gergo.c b/keyboards/gboards/gergo/gergo.c index da2a3007a8..41d383d408 100644 --- a/keyboards/gboards/gergo/gergo.c +++ b/keyboards/gboards/gergo/gergo.c @@ -43,23 +43,17 @@ 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(0b10000000, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT); if (mcp23018_status) goto out; - i2c_stop(); + uint8_t data[] = {0b10000000, 0b11111111}; + mcp23018_status = i2c_writeReg(I2C_ADDR, IODIRA, data, sizeof(data), I2C_TIMEOUT); - // 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(0b10000000, I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT); if (mcp23018_status) goto out; + 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); + } -out: - i2c_stop(); // SREG=sreg_prev; //uprintf("Init %x\n", mcp23018_status); return mcp23018_status; |