mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-27 04:10:25 +00:00
Merge pull request #4214 from embedded-rust-iml/feature/drop-impl-for-stm32-rng
Impl Drop for stm32 Rng
This commit is contained in:
commit
a32e665f63
@ -186,6 +186,15 @@ impl<'d, T: Instance> Rng<'d, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> Drop for Rng<'d, T> {
|
||||
fn drop(&mut self) {
|
||||
T::regs().cr().modify(|reg| {
|
||||
reg.set_rngen(false);
|
||||
});
|
||||
rcc::disable::<T>();
|
||||
}
|
||||
}
|
||||
|
||||
impl<'d, T: Instance> RngCore for Rng<'d, T> {
|
||||
fn next_u32(&mut self) -> u32 {
|
||||
loop {
|
||||
|
Loading…
x
Reference in New Issue
Block a user