mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 22:54:52 +00:00
Merge pull request #4036 from Fredrik-Reinholdsen/main
fix: Fix for #3888 async I2C read bug for introduced in #3887
This commit is contained in:
commit
3bc809eb3e
@ -617,9 +617,10 @@ impl<'d> I2c<'d, Async> {
|
|||||||
restart,
|
restart,
|
||||||
timeout,
|
timeout,
|
||||||
)?;
|
)?;
|
||||||
} else if remaining_len == 0 {
|
if total_len <= 255 {
|
||||||
return Poll::Ready(Ok(()));
|
return Poll::Ready(Ok(()));
|
||||||
} else if !(isr.tcr() || isr.tc()) {
|
}
|
||||||
|
} else if isr.tcr() {
|
||||||
// poll_fn was woken without an interrupt present
|
// poll_fn was woken without an interrupt present
|
||||||
return Poll::Pending;
|
return Poll::Pending;
|
||||||
} else {
|
} else {
|
||||||
@ -628,6 +629,11 @@ impl<'d> I2c<'d, Async> {
|
|||||||
if let Err(e) = Self::master_continue(self.info, remaining_len.min(255), !last_piece, timeout) {
|
if let Err(e) = Self::master_continue(self.info, remaining_len.min(255), !last_piece, timeout) {
|
||||||
return Poll::Ready(Err(e));
|
return Poll::Ready(Err(e));
|
||||||
}
|
}
|
||||||
|
// Return here if we are on last chunk,
|
||||||
|
// end of transfer will be awaited with the DMA below
|
||||||
|
if last_piece {
|
||||||
|
return Poll::Ready(Ok(()));
|
||||||
|
}
|
||||||
self.info.regs.cr1().modify(|w| w.set_tcie(true));
|
self.info.regs.cr1().modify(|w| w.set_tcie(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user