diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 704f1a97..c2248c84 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs @@ -24,6 +24,8 @@ pub struct Random { impl Random { pub fn new(inner: impl Unborrow) -> Self { + T::enable(); + T::reset(); unborrow!(inner); let mut random = Self { _inner: inner }; random.reset(); @@ -133,7 +135,7 @@ pub(crate) mod sealed { } } -pub trait Instance: sealed::Instance {} +pub trait Instance: sealed::Instance + crate::rcc::RccPeripheral {} crate::pac::peripherals!( (rng, $inst:ident) => {