Skip to content

Commit c333210

Browse files
committed
Avoid initiating transfer if no bytes have been written
1 parent d84e1fe commit c333210

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nrf-hal-common/src/uarte.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ pub mod serial {
631631
Err(nb::Error::WouldBlock)
632632
}
633633
} else {
634+
// No need to trigger transmit if we don't have anything written
635+
if self.written == 0 {
636+
return Ok(());
637+
}
638+
634639
// Conservative compiler fence to prevent optimizations that do not
635640
// take in to account actions by DMA. The fence has been placed here,
636641
// before any DMA action has started.

0 commit comments

Comments
 (0)