diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-27 13:36:46 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-03-27 13:36:46 +0000 |
| commit | d097ccc68cce25c95ca2594c7c0bcd62c3c40640 (patch) | |
| tree | c7cbce970d9884ccb9db075fa2b95702eb757ac5 /embassy-rp | |
| parent | 8186847801a605876136ab7c47bb2bc2c27b1871 (diff) | |
| parent | 1b6e563260ec2b00cb518e0e801222ebd1ba9902 (diff) | |
Merge pull request #4012 from adom-inc/rp2350-adc-fix
rp/adc: fix potential race condition
Diffstat (limited to 'embassy-rp')
| -rw-r--r-- | embassy-rp/src/adc.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index 8defb5231..1265a22a0 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs | |||
| @@ -205,11 +205,13 @@ impl<'d> Adc<'d, Async> { | |||
| 205 | 205 | ||
| 206 | fn wait_for_ready() -> impl Future<Output = ()> { | 206 | fn wait_for_ready() -> impl Future<Output = ()> { |
| 207 | let r = Self::regs(); | 207 | let r = Self::regs(); |
| 208 | r.inte().write(|w| w.set_fifo(true)); | ||
| 209 | compiler_fence(Ordering::SeqCst); | ||
| 210 | 208 | ||
| 211 | poll_fn(move |cx| { | 209 | poll_fn(move |cx| { |
| 212 | WAKER.register(cx.waker()); | 210 | WAKER.register(cx.waker()); |
| 211 | |||
| 212 | r.inte().write(|w| w.set_fifo(true)); | ||
| 213 | compiler_fence(Ordering::SeqCst); | ||
| 214 | |||
| 213 | if r.cs().read().ready() { | 215 | if r.cs().read().ready() { |
| 214 | return Poll::Ready(()); | 216 | return Poll::Ready(()); |
| 215 | } | 217 | } |
