Skip to content

Commit 463d755

Browse files
committed
i2c: Handle the case where a restart is issued right after the address
One case is on read operations for 10bit I2C. First a write is issued with the address, then a restart and a the msb of the address is resent with this time the read flag. Because there is no data phase, the peripheral entered the active state but never switched to either Read or Write.
1 parent 15df24c commit 463d755

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rp2040-hal/src/i2c/peripheral.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<T: Deref<Target = RegisterBlock>, PINS> I2C<T, PINS, Peripheral> {
241241
State::Read if stat.rd_req().bit_is_set() => Some(Event::TransferRead),
242242
State::Write if !self.rx_fifo_empty() => Some(Event::TransferWrite),
243243

244-
State::Read | State::Write if stat.restart_det().bit_is_set() => {
244+
State::Read | State::Write | State::Active if stat.restart_det().bit_is_set() => {
245245
self.i2c.ic_clr_restart_det().read();
246246
self.i2c.ic_clr_start_det().read();
247247
self.mode.state = State::Active;

0 commit comments

Comments
 (0)