@@ 93,12 93,15 @@ static inline void i2c_tx_byte(uint8_t v
}
/* return received byte, sends ACK if !last and NACK if last */
-static inline uint8_t i2c_rx_byte(bool last)
+static inline uint8_t i2c_rx_byte(bool last, bool *_sync)
{
+ bool dummy;
+ bool *sync = _sync ? _sync : &dummy;
+
mmregs->twcr = REG_TWCR_TWINT | REG_TWCR_TWEN |
(last ? 0 : REG_TWCR_TWEA);
- i2c_sync(last ? I2C_STATUS_MR_DATA_NACK : I2C_STATUS_MR_DATA_ACK);
+ *sync = i2c_sync(last ? I2C_STATUS_MR_DATA_NACK : I2C_STATUS_MR_DATA_ACK);
return mmregs->twdr;
}