aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-07-03 09:03:25 +0200
committerUlf Lilleengen <[email protected]>2024-07-03 09:03:25 +0200
commita07702ba7bde8410b224e80afb6aa7a93f1fb375 (patch)
tree50f61919f73ceb509b452f613dfd1d31012ff478
parent3c6bf3a31a951fcea31e39390ba4f0f073144933 (diff)
fix cancellation hanging on event never occuring
- The end event is not triggered by stop and might therefor never occur - Clear the end_event after operation is done instead of disabled
-rw-r--r--embassy-nrf/src/radio/ble.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/embassy-nrf/src/radio/ble.rs b/embassy-nrf/src/radio/ble.rs
index 93003fb19..0fae54f52 100644
--- a/embassy-nrf/src/radio/ble.rs
+++ b/embassy-nrf/src/radio/ble.rs
@@ -347,12 +347,10 @@ impl<'d, T: Instance> Radio<'d, T> {
347 trace!("radio drop: stopping"); 347 trace!("radio drop: stopping");
348 348
349 r.intenclr.write(|w| w.end().clear()); 349 r.intenclr.write(|w| w.end().clear());
350 r.events_end.reset();
351 350
352 r.tasks_stop.write(|w| unsafe { w.bits(1) }); 351 r.tasks_stop.write(|w| unsafe { w.bits(1) });
353 352
354 // The docs don't explicitly mention any event to acknowledge the stop task 353 r.events_end.reset();
355 while r.events_end.read().bits() == 0 {}
356 354
357 trace!("radio drop: stopped"); 355 trace!("radio drop: stopped");
358 }); 356 });
@@ -382,7 +380,7 @@ impl<'d, T: Instance> Radio<'d, T> {
382 .await; 380 .await;
383 381
384 compiler_fence(Ordering::SeqCst); 382 compiler_fence(Ordering::SeqCst);
385 r.events_disabled.reset(); // ACK 383 r.events_end.reset(); // ACK
386 384
387 // Everthing ends fine, so it disable the drop 385 // Everthing ends fine, so it disable the drop
388 drop.defuse(); 386 drop.defuse();