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?