diff --git a/i2c.c b/i2c.c index 139815d..2e35cae 100644 --- a/i2c.c +++ b/i2c.c @@ -65,9 +65,7 @@ // Transmission not interrupted. #define I2C_NOINTERRUPTED 0b01111111 -#define I2C_ERROR_BUS_FAIL 0b00000001 -#define I2C_ERROR_NACK 0b00000010 -#define I2C_ERROR_NO_ANSWER 0b00010000 +#define I2C_ERROR 0b00000001 #define I2C_ERROR_LOW_PRIO 0b00100000 @@ -214,9 +212,7 @@ void i2c_write(uint8_t data, uint8_t last_byte) { } // Recover from error conditions by draining the buffer. - if ((i2c_state & I2C_ERROR_BUS_FAIL) || - (i2c_state & I2C_ERROR_NO_ANSWER) || - (i2c_state & I2C_ERROR_NACK)) { + if (i2c_state & I2C_ERROR) { while (buf_canread(send)) { buf_pop(send, TWDR); } @@ -278,21 +274,10 @@ ISR(TWI_vect) { #endif switch (status) { - case TW_BUS_ERROR: - // A hardware error was detected. - #ifdef TWI_INTERRUPT_DEBUG - serial_writechar('1'); - #endif - i2c_state |= I2C_ERROR_BUS_FAIL; - // Let i2c_write() continue. - i2c_should_end = 0; - // Send stop condition. - TWCR = (1<