aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/usart/buffered.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs
index e050f8e0f..211091c38 100644
--- a/embassy-stm32/src/usart/buffered.rs
+++ b/embassy-stm32/src/usart/buffered.rs
@@ -62,8 +62,8 @@ impl<T: BasicInstance> interrupt::typelevel::Handler<T::Interrupt> for Interrupt
62 state.rx_waker.wake(); 62 state.rx_waker.wake();
63 } 63 }
64 64
65 // With `usart_v4` hardware FIFO is enabled, making `state.tx_buf` 65 // With `usart_v4` hardware FIFO is enabled, making `state.tx_buf` insufficient
66 // insufficient to determine if all bytes are sent out. 66 // to determine if all bytes are sent out.
67 // Transmission complete (TC) interrupt here indicates that all bytes are pushed out from the FIFO. 67 // Transmission complete (TC) interrupt here indicates that all bytes are pushed out from the FIFO.
68 #[cfg(usart_v4)] 68 #[cfg(usart_v4)]
69 if sr_val.tc() { 69 if sr_val.tc() {
@@ -90,9 +90,12 @@ impl<T: BasicInstance> interrupt::typelevel::Handler<T::Interrupt> for Interrupt
90 90
91 tdr(r).write_volatile(buf[0].into()); 91 tdr(r).write_volatile(buf[0].into());
92 tx_reader.pop_done(1); 92 tx_reader.pop_done(1);
93
94 // Notice that in case of `usart_v4` waker is called when TC interrupt happens.
95 #[cfg(not(usart_v4))]
93 state.tx_waker.wake(); 96 state.tx_waker.wake();
94 } else { 97 } else {
95 // Disable interrupt until we have something to transmit again 98 // Disable interrupt until we have something to transmit again.
96 r.cr1().modify(|w| { 99 r.cr1().modify(|w| {
97 w.set_txeie(false); 100 w.set_txeie(false);
98 }); 101 });