aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/uart/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index 9f5ba4e8a..f372cb640 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -604,8 +604,8 @@ impl<'d, T: Instance> UartRx<'d, T, Async> {
604 return match (all_full, last_was_break) { 604 return match (all_full, last_was_break) {
605 (true, true) | (false, _) => { 605 (true, true) | (false, _) => {
606 // We got less than the full amount + a break, or the full amount 606 // We got less than the full amount + a break, or the full amount
607 // and the last byte was a break. Subtract the break off. 607 // and the last byte was a break. Subtract the break off by adding one to sval.
608 Ok((next_addr - 1) - sval) 608 Ok(next_addr.saturating_sub(1 + sval))
609 } 609 }
610 (true, false) => { 610 (true, false) => {
611 // We finished the whole DMA, and the last DMA'd byte was NOT a break 611 // We finished the whole DMA, and the last DMA'd byte was NOT a break