aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-10-30 21:18:04 -0500
committerxoviat <[email protected]>2025-10-30 21:18:04 -0500
commitac6e75c8887a6d2362cc00dbf246017d2cd1e102 (patch)
tree5becc3774feffab95b9a18edc5e00687b22f2e7d
parent575eae0631dee2052569616521b6f3db6f969ac1 (diff)
remove cs
-rw-r--r--embassy-stm32/src/usart/ringbuffered.rs23
1 files changed, 10 insertions, 13 deletions
diff --git a/embassy-stm32/src/usart/ringbuffered.rs b/embassy-stm32/src/usart/ringbuffered.rs
index 710272e4e..bac570d27 100644
--- a/embassy-stm32/src/usart/ringbuffered.rs
+++ b/embassy-stm32/src/usart/ringbuffered.rs
@@ -340,19 +340,16 @@ impl Drop for RingBufferedUartRx<'_> {
340/// For usart_v1 and usart_v2, all status flags must be handled together anyway because all flags 340/// For usart_v1 and usart_v2, all status flags must be handled together anyway because all flags
341/// are cleared by a single read to the RDR register. 341/// are cleared by a single read to the RDR register.
342fn check_idle_and_errors(r: Regs) -> Result<bool, Error> { 342fn check_idle_and_errors(r: Regs) -> Result<bool, Error> {
343 // Critical section is required so that the flags aren't set after read and before clear 343 // SAFETY: read only and we only use Rx related flags
344 let sr = critical_section::with(|_| { 344 let sr = sr(r).read();
345 // SAFETY: read only and we only use Rx related flags 345
346 let sr = sr(r).read(); 346 #[cfg(not(any(usart_v3, usart_v4)))]
347 347 unsafe {
348 #[cfg(not(any(usart_v3, usart_v4)))] 348 // This read also clears the error and idle interrupt flags on v1 (TODO and v2?)
349 unsafe { 349 rdr(r).read_volatile()
350 // This read also clears the error and idle interrupt flags on v1 (TODO and v2?) 350 };
351 rdr(r).read_volatile() 351 clear_interrupt_flags(r, sr);
352 }; 352
353 clear_interrupt_flags(r, sr);
354 sr
355 });
356 if sr.pe() { 353 if sr.pe() {
357 Err(Error::Parity) 354 Err(Error::Parity)
358 } else if sr.fe() { 355 } else if sr.fe() {