Skip to content

Commit bed63a9

Browse files
committed
Avoid initiating transfer if no bytes have been written
1 parent 09cc52e commit bed63a9

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
@@ -633,6 +633,11 @@ pub mod serial {
633633
Err(nb::Error::WouldBlock)
634634
}
635635
} else {
636+
// No need to trigger transmit if we don't have anything written
637+
if self.written == 0 {
638+
return Ok(());
639+
}
640+
636641
// Conservative compiler fence to prevent optimizations that do not
637642
// take in to account actions by DMA. The fence has been placed here,
638643
// before any DMA action has started.

0 commit comments

Comments
 (0)