diff options
| author | Ulf Lilleengen <[email protected]> | 2021-06-09 13:54:53 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-06-09 13:54:53 +0200 |
| commit | f3d1ac6623cbd622122521154fdaf77f3e42e567 (patch) | |
| tree | db49a15a79ab1c0ea008b984d0dc4add3bcf3ac5 | |
| parent | a92d6a372bea6b111fa1d2023b328942bae19e5f (diff) | |
Enable clock for RNG
| -rw-r--r-- | embassy-stm32/src/rng.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 704f1a97b..c2248c84d 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -24,6 +24,8 @@ pub struct Random<T: Instance> { | |||
| 24 | 24 | ||
| 25 | impl<T: Instance> Random<T> { | 25 | impl<T: Instance> Random<T> { |
| 26 | pub fn new(inner: impl Unborrow<Target = T>) -> Self { | 26 | pub fn new(inner: impl Unborrow<Target = T>) -> Self { |
| 27 | T::enable(); | ||
| 28 | T::reset(); | ||
| 27 | unborrow!(inner); | 29 | unborrow!(inner); |
| 28 | let mut random = Self { _inner: inner }; | 30 | let mut random = Self { _inner: inner }; |
| 29 | random.reset(); | 31 | random.reset(); |
| @@ -133,7 +135,7 @@ pub(crate) mod sealed { | |||
| 133 | } | 135 | } |
| 134 | } | 136 | } |
| 135 | 137 | ||
| 136 | pub trait Instance: sealed::Instance {} | 138 | pub trait Instance: sealed::Instance + crate::rcc::RccPeripheral {} |
| 137 | 139 | ||
| 138 | crate::pac::peripherals!( | 140 | crate::pac::peripherals!( |
| 139 | (rng, $inst:ident) => { | 141 | (rng, $inst:ident) => { |
