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 @@ -585,17 +585,17 @@ where
585
585
let uarte = unsafe { & * T :: ptr ( ) } ;
586
586
587
587
// Prevent writing to buffer while DMA transfer is in progress.
588
- if uarte. events_txstarted . read ( ) . bits ( ) == 1 {
588
+ if uarte. events_txstarted . read ( ) . bits ( ) == 1 && uarte . events_endtx . read ( ) . bits ( ) == 0 {
589
589
return Err ( nb:: Error :: WouldBlock ) ;
590
590
}
591
591
592
- if self . written < self . tx_buf . len ( ) {
593
- self . tx_buf [ self . written ] = b;
594
- self . written += 1 ;
595
- Ok ( ( ) )
596
- } else {
597
- self . flush ( )
592
+ if self . written >= self . tx_buf . len ( ) {
593
+ self . flush ( ) ?;
598
594
}
595
+
596
+ self . tx_buf [ self . written ] = b;
597
+ self . written += 1 ;
598
+ Ok ( ( ) )
599
599
}
600
600
601
601
/// 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