File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ stm32-usbd = { version = "0.7.0", optional = true }
2020fixed = { version = " 1.28.0" , optional = true }
2121embedded-io = " 0.6"
2222stm32-hrtim = { version = " 0.1.0" , optional = true }
23- rand = { version = " 0.9" , default-features = false }
23+ rand_core = { version = " 0.9" , default-features = false }
2424
2525[dependencies .cortex-m ]
2626version = " 0.7.7"
@@ -73,6 +73,7 @@ bme680 = "0.6.0"
7373embedded-sdmmc = " 0.3.0"
7474usb-device = { version = " 0.3.2" , features = [" defmt" ] }
7575usbd-serial = " 0.2.2"
76+ rand = { version = " 0.9" , default-features = false }
7677
7778# TODO: Separate feature sets
7879[features ]
Original file line number Diff line number Diff line change 11//! True Random Number Generator (TRNG)
22
3- use rand :: TryRngCore ;
3+ use rand_core :: TryRngCore ;
44
55use crate :: { rcc:: Rcc , stm32:: RNG } ;
66use core:: { fmt:: Formatter , marker:: PhantomData } ;
@@ -27,6 +27,17 @@ impl core::fmt::Display for RngError {
2727 }
2828}
2929
30+ #[ cfg( feature = "defmt" ) ]
31+ impl defmt:: Format for RngError {
32+ fn format ( & self , fmt : defmt:: Formatter ) {
33+ match self {
34+ RngError :: NotReady => defmt:: write!( fmt, "RNG Not ready" ) ,
35+ RngError :: SeedError => defmt:: write!( fmt, "RNG Seed error" ) ,
36+ RngError :: ClockError => defmt:: write!( fmt, "RNG Clock error" ) ,
37+ }
38+ }
39+ }
40+
3041/// Extension trait for the RNG register block
3142pub trait RngExt {
3243 fn constrain ( self , rcc : & mut Rcc ) -> Rng < Stopped > ;
You can’t perform that action at this time.
0 commit comments