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
622622 let uarte = unsafe { & * T :: ptr ( ) } ;
623623
624624 // 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 {
626626 return Err ( nb:: Error :: WouldBlock ) ;
627627 }
628628
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 ( ) ?;
635631 }
632+
633+ self . tx_buf [ self . written ] = b;
634+ self . written += 1 ;
635+ Ok ( ( ) )
636636 }
637637
638638 /// 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