tiny-i2c
tiny-i2c copied to clipboard
Missing test in TinyI2CMaster.cpp start() routine?
Line 294 says:
if (TWI0.MSTATUS & TWI_ARBLOST_bm) { // Arbitration lost or bus error
but there is no test for the bus error via TWI_BUSERR_bm.
Line 283 in the write() routine has a similar comment, but is:
if (TWI0.MSTATUS & (TWI_ARBLOST_bm|TWI_BUSERR_bm))return false; // Fails if bus error or arblost
Should the condition in 294 be changed to TWI0.MSTATUS & (TWI_ARBLOST_bm|TWI_BUSERR_bm) so both bits are checked?
I'm sorry I don't know. This is based on existing code from Atmel/Microchip.