tiny-i2c icon indicating copy to clipboard operation
tiny-i2c copied to clipboard

Missing test in TinyI2CMaster.cpp start() routine?

Open nmcgann opened this issue 1 year ago • 1 comments

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?

nmcgann avatar Dec 01 '24 10:12 nmcgann

I'm sorry I don't know. This is based on existing code from Atmel/Microchip.

technoblogy avatar Dec 01 '24 10:12 technoblogy