From ae0219de6f32222be5ef18be86376971a92f1751 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 30 Jun 2021 09:45:49 +1000 Subject: [PATCH] Move initialisation inside of future --- embassy-nrf/src/rng.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs index 40778c64..e5ec02c6 100644 --- a/embassy-nrf/src/rng.rs +++ b/embassy-nrf/src/rng.rs @@ -97,10 +97,10 @@ impl<'d> traits::rng::Rng for Rng<'d> { type RngFuture<'a> where 'd: 'a = impl Future> + 'a; fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> { - self.enable_irq(); - self.start(); - async move { + self.enable_irq(); + self.start(); + let on_drop = OnDrop::new(|| { self.stop(); self.disable_irq();