diff options
author | QMK Bot <hello@qmk.fm> | 2021-09-07 15:35:32 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-09-07 15:35:32 +0000 |
commit | af19461a02b8a5f89d26c448b10984aa0ac19f42 (patch) | |
tree | be484d88bf4d4621355c4fd5f8d30bbd4117e1d1 /keyboards/sx60/sx60.c | |
parent | c669c4376972446f52340584976d935ea9bf23ca (diff) | |
parent | 04c0704b280c4847c43b164335e9741b19219131 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/sx60/sx60.c')
-rwxr-xr-x | keyboards/sx60/sx60.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/keyboards/sx60/sx60.c b/keyboards/sx60/sx60.c index ede8c07e97..cb7f2b88ff 100755 --- a/keyboards/sx60/sx60.c +++ b/keyboards/sx60/sx60.c @@ -1,5 +1,5 @@ #include "sx60.h" -#include "i2cmaster.h" +#include "i2c_master.h" bool i2c_initialized = 0; @@ -18,21 +18,18 @@ uint8_t init_mcp23018(void) { /* B Pins are Row, A pins are Columns Set them to output */ - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111); if (mcp23018_status) goto out; - /* Now write to IODIRB */ - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - i2c_stop(); - - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111); if (mcp23018_status) goto out; - /* Now write to GPPUB */ - mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out; - -out: - i2c_stop(); - + static uint8_t direction[2] = { + 0b11111111, + 0b00000000, + }; + static uint8_t pullup[2] = { + 0b11111111, + 0b00000000, + }; + + mcp23018_status = i2c_writeReg(I2C_ADDR, IODIRA, direction, 2, I2C_TIMEOUT); + if (mcp23018_status) return mcp23018_status; + + mcp23018_status = i2c_writeReg(I2C_ADDR, GPPUA, pullup, 2, I2C_TIMEOUT); return mcp23018_status; } |