arch: extend i2c_rx_byte to return the status (ATmega48P)

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 5 insertions(+), 2 deletions(-)

M arch/atmega48p_i2c.h
M arch/atmega48p_i2c.h +5 -2
@@ 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;
 }