diff --git a/i2c.c b/i2c.c index baaa033..2bd7491 100644 --- a/i2c.c +++ b/i2c.c @@ -26,6 +26,7 @@ #include #include +#include #if defined I2C_MASTER_MODE && defined I2C_SLAVE_MODE @@ -158,14 +159,14 @@ void i2c_do_nothing(void) { */ ISR(TWI_vect) { - switch (TWSR & 0xF8) { // Cut the prescaler bits out. - case I2C_STATE_BUS_FAIL: + switch (TWSR & TW_STATUS_MASK) { + case TW_BUS_ERROR: // A hardware error was detected. i2c_state |= I2C_ERROR_BUS_FAIL; TWCR = (1<