mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 22:54:52 +00:00
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
This commit is contained in:
parent
3c6bf3a31a
commit
a07702ba7b
@ -347,12 +347,10 @@ impl<'d, T: Instance> Radio<'d, T> {
|
|||||||
trace!("radio drop: stopping");
|
trace!("radio drop: stopping");
|
||||||
|
|
||||||
r.intenclr.write(|w| w.end().clear());
|
r.intenclr.write(|w| w.end().clear());
|
||||||
r.events_end.reset();
|
|
||||||
|
|
||||||
r.tasks_stop.write(|w| unsafe { w.bits(1) });
|
r.tasks_stop.write(|w| unsafe { w.bits(1) });
|
||||||
|
|
||||||
// The docs don't explicitly mention any event to acknowledge the stop task
|
r.events_end.reset();
|
||||||
while r.events_end.read().bits() == 0 {}
|
|
||||||
|
|
||||||
trace!("radio drop: stopped");
|
trace!("radio drop: stopped");
|
||||||
});
|
});
|
||||||
@ -382,7 +380,7 @@ impl<'d, T: Instance> Radio<'d, T> {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
r.events_disabled.reset(); // ACK
|
r.events_end.reset(); // ACK
|
||||||
|
|
||||||
// Everthing ends fine, so it disable the drop
|
// Everthing ends fine, so it disable the drop
|
||||||
drop.defuse();
|
drop.defuse();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user