From c7e426655dfb82d932d7f63dc73838cd090dbfb5 Mon Sep 17 00:00:00 2001 From: huntc Date: Mon, 18 Oct 2021 11:28:43 +1100 Subject: [PATCH] Ensure the compiler doesn't reorder things before calling the sampler --- embassy-nrf/src/saadc.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index fd7e64e7..41644120 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs @@ -316,6 +316,8 @@ impl<'d, const N: usize> Saadc<'d, N> { WAKER.register(cx.waker()); if r.events_end.read().bits() != 0 { + compiler_fence(Ordering::SeqCst); + r.events_end.reset(); r.intenset.write(|w| w.end().set());