diff options
Diffstat (limited to 'keyboards/ergodox_ez/ergodox_ez.c')
-rw-r--r-- | keyboards/ergodox_ez/ergodox_ez.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 3a2d1273fa..65671b38fe 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -24,7 +24,7 @@ extern inline void ergodox_led_all_set(uint8_t n); bool i2c_initialized = 0; -uint8_t mcp23018_status = 0x20; +i2c_status_t mcp23018_status = 0x20; void matrix_init_kb(void) { // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") @@ -125,23 +125,23 @@ uint8_t init_mcp23018(void) { // - unused : input : 1 // - input : input : 1 // - driving : output : 0 - 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(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; - i2c_stop(); + mcp23018_status = i2c_start(I2C_ADDR_WRITE, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(IODIRA, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, 0); if (mcp23018_status) goto out; + i2c_stop(0); // set pull-up // - unused : on : 1 // - input : on : 1 // - driving : off : 0 - 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(0b00000000); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPPUA, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, 0); if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, 0); if (mcp23018_status) goto out; out: - i2c_stop(); + i2c_stop(0); #ifdef LEFT_LEDS if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update(); @@ -165,22 +165,22 @@ uint8_t ergodox_left_leds_update(void) { // - unused : hi-Z : 1 // - input : hi-Z : 1 // - driving : hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); + mcp23018_status = i2c_start(I2C_ADDR_WRITE, 0); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(OLATA); + mcp23018_status = i2c_write(OLATA, 0); if (mcp23018_status) goto out; mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT) - ); + & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT), + 0); if (mcp23018_status) goto out; mcp23018_status = i2c_write(0b11111111 & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT) - & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT) - ); + & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT), + 0); if (mcp23018_status) goto out; out: - i2c_stop(); + i2c_stop(0); return mcp23018_status; } #endif |