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()'
This commit is contained in:
Timo Kröger 2021-01-03 13:56:13 +01:00
parent 9b1f7b8a17
commit 93780fa31d

View file

@ -131,6 +131,8 @@ where
}
pub fn free(self) -> (T, T::Interrupt, Pins) {
// Wait for the peripheral to be disabled from the ISR.
while self.instance.enable.read().enable().is_enabled() {}
(self.instance, self.irq, self.pins)
}