Same for stm

This commit is contained in:
Ugljesa Jovanovic 2024-09-21 12:01:24 +02:00
parent 057579bce5
commit 244fa979d3
No known key found for this signature in database
GPG Key ID: 5884AC34A0EC67DB
9 changed files with 25 additions and 12 deletions

View File

@ -68,7 +68,7 @@ log = { version = "0.4.14", optional = true }
cortex-m-rt = ">=0.6.15,<0.8"
cortex-m = "0.7.6"
futures-util = { version = "0.3.30", default-features = false }
rand_core = "0.6.3"
rand_core = "0.9.0-alpha.2"
sdio-host = "0.5.0"
critical-section = "1.1"
#stm32-metapac = { version = "15" }

View File

@ -1,13 +1,14 @@
//! Random Number Generator (RNG)
#![macro_use]
use core::convert::Infallible;
use core::future::poll_fn;
use core::marker::PhantomData;
use core::task::Poll;
use embassy_hal_internal::{into_ref, PeripheralRef};
use embassy_sync::waitqueue::AtomicWaker;
use rand_core::{CryptoRng, RngCore};
use rand_core::{CryptoRng, RngCore, TryRngCore};
use crate::interrupt::typelevel::Interrupt;
use crate::{interrupt, pac, peripherals, rcc, Peripheral};
@ -213,9 +214,21 @@ impl<'d, T: Instance> RngCore for Rng<'d, T> {
}
}
}
}
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
self.fill_bytes(dest);
impl<'d, T: crate::rng::Instance> TryRngCore for Rng<'d, T> {
type Error = Infallible;
fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
Ok(self.next_u32())
}
fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
Ok(self.next_u64())
}
fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), Self::Error> {
self.fill_bytes(dst);
Ok(())
}
}

View File

@ -24,7 +24,7 @@ embedded-hal = "0.2.6"
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
nb = "1.0.0"
rand_core = "0.6.3"
rand_core = "0.9.0-alpha.2"
critical-section = "1.1"
embedded-storage = "0.3.1"
static_cell = "2"

View File

@ -26,7 +26,7 @@ embedded-io-async = { version = "0.6.1" }
embedded-nal-async = { version = "0.7.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
rand_core = "0.6.3"
rand_core = "0.9.0-alpha.2"
critical-section = "1.1"
micromath = "2.0.0"
stm32-fmc = "0.3.0"

View File

@ -27,7 +27,7 @@ embedded-nal-async = { version = "0.7.1" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
rand_core = "0.6.3"
rand_core = "0.9.0-alpha.2"
critical-section = "1.1"
micromath = "2.0.0"
stm32-fmc = "0.3.0"

View File

@ -27,7 +27,7 @@ embedded-nal-async = { version = "0.7.1" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
rand_core = "0.6.3"
rand_core = "0.9.0-alpha.2"
critical-section = "1.1"
micromath = "2.0.0"
stm32-fmc = "0.3.0"

View File

@ -30,7 +30,7 @@ embedded-hal-bus = { version = "0.1", features = ["async"] }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
chrono = { version = "^0.4", default-features = false }
rand = { version = "0.8.5", default-features = false }
rand = { version = "0.9.0-alpha.2", default-features = false }
static_cell = "2"
micromath = "2.0.0"

View File

@ -23,7 +23,7 @@ cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-sing
cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
heapless = { version = "0.8", default-features = false }
rand_core = { version = "0.6.3", default-features = false }
rand_core = { version = "0.9.0-alpha.2", default-features = false }
embedded-io-async = { version = "0.6.1" }
static_cell = "2"

View File

@ -79,8 +79,8 @@ embedded-hal-async = { version = "1.0" }
embedded-can = { version = "0.4" }
micromath = "2.0.0"
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
rand_core = { version = "0.6", default-features = false }
rand_chacha = { version = "0.3", default-features = false }
rand_core = { version = "0.9.0-alpha.2", default-features = false }
rand_chacha = { version = "0.9.0-alpha.2", default-features = false }
static_cell = "2"
portable-atomic = { version = "1.5", features = [] }