fix off by one error for twi reads with len != 1.
STOP must be requested before the last byte is received.
This commit is contained in:
parent
da4dad492d
commit
cd93636f3e
@ -348,7 +348,7 @@ at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
|
||||
if ((sr = RD4(sc, TWI_SR)) & TWI_SR_RXRDY) {
|
||||
len--;
|
||||
*buf++ = RD4(sc, TWI_RHR) & 0xff;
|
||||
if (len == 0 && msgs[i].len != 1)
|
||||
if (len == 1)
|
||||
WR4(sc, TWI_CR, TWI_CR_STOP);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user