File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -622,17 +622,17 @@ where
622
622
let uarte = unsafe { & * T :: ptr ( ) } ;
623
623
624
624
// Prevent writing to buffer while DMA transfer is in progress.
625
- if uarte. events_txstarted . read ( ) . bits ( ) == 1 {
625
+ if uarte. events_txstarted . read ( ) . bits ( ) == 1 && uarte . events_endtx . read ( ) . bits ( ) == 0 {
626
626
return Err ( nb:: Error :: WouldBlock ) ;
627
627
}
628
628
629
- if self . written < self . tx_buf . len ( ) {
630
- self . tx_buf [ self . written ] = b;
631
- self . written += 1 ;
632
- Ok ( ( ) )
633
- } else {
634
- self . flush ( )
629
+ if self . written >= self . tx_buf . len ( ) {
630
+ self . flush ( ) ?;
635
631
}
632
+
633
+ self . tx_buf [ self . written ] = b;
634
+ self . written += 1 ;
635
+ Ok ( ( ) )
636
636
}
637
637
638
638
/// Flush the TX buffer non-blocking. Returns nb::Error::WouldBlock if not yet flushed.
You can’t perform that action at this time.
0 commit comments