aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/uarte.rs
diff options
context:
space:
mode:
authorTimo Kröger <[email protected]>2021-01-03 13:56:13 +0100
committerTimo Kröger <[email protected]>2021-01-04 22:55:40 +0100
commit93780fa31d3c563e05fac6cd6ff8f15e43dc80fa (patch)
treef2526eb9415166153842463a26672a5e32945f61 /embassy-nrf/src/uarte.rs
parent9b1f7b8a17bd1ebd61e68c5d2a2116794d31cfa7 (diff)
uarte: Wait for the peripheral to be disabled
Prevents a panic in the case of: 1. Abort a receive future 2. Free Uarte::free() 3. Uarte::new() -> panicked at 'assertion failed: uarte.enable.read().enable().is_disabled()'
Diffstat (limited to 'embassy-nrf/src/uarte.rs')
-rw-r--r--embassy-nrf/src/uarte.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index aee91f803..dc2093c38 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -131,6 +131,8 @@ where
131 } 131 }
132 132
133 pub fn free(self) -> (T, T::Interrupt, Pins) { 133 pub fn free(self) -> (T, T::Interrupt, Pins) {
134 // Wait for the peripheral to be disabled from the ISR.
135 while self.instance.enable.read().enable().is_enabled() {}
134 (self.instance, self.irq, self.pins) 136 (self.instance, self.irq, self.pins)
135 } 137 }
136 138