Implement async RNG, including rand_core sync traits.

This commit is contained in:
Bob McWhirter
2021-05-06 14:33:29 -04:00
parent 1eb70a7e5d
commit e8537ca9c2
10 changed files with 3449 additions and 3332 deletions

View File

@ -1,8 +1,5 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
#runner = "probe-run --chip STM32F401CCUx"
#runner = "probe-run --chip STM32L4S5VITx"
#runner = "probe-run --chip ${PROBE_RUN_CHIP}"
runner = "probe-run"
runner = "probe-run --chip STM32F401CCUx"
rustflags = [
# LLD (shipped with the Rust toolchain) is used as the default linker
@ -28,5 +25,4 @@ rustflags = [
]
[build]
#target = "thumbv7em-none-eabihf"
target = "thumbv7em-none-eabi"
target = "thumbv7em-none-eabihf"

View File

@ -18,11 +18,9 @@ defmt-error = []
[dependencies]
embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-trace"] }
embassy-traits = { version = "0.1.0", path = "../embassy-traits", features = ["defmt"] }
#embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32l4s5vi"] }
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["defmt", "defmt-trace", "stm32f429zi"] }
embassy-extras = {version = "0.1.0", path = "../embassy-extras" }
#stm32f4 = { version = "0.13", features = ["stm32f429"] }
stm32l4 = { version = "0.13", features = ["stm32l4x5" ] }
stm32f4 = { version = "0.13", features = ["stm32f429"] }
defmt = "0.2.0"
defmt-rtt = "0.2.0"

View File

@ -12,8 +12,7 @@ use embedded_hal::digital::v2::OutputPin;
use example_common::*;
use cortex_m_rt::entry;
//use stm32f4::stm32f429 as pac;
use stm32l4::stm32l4x5 as pac;
use stm32f4::stm32f429 as pac;
#[entry]
fn main() -> ! {
@ -26,21 +25,21 @@ fn main() -> ! {
w.dbg_standby().set_bit();
w.dbg_stop().set_bit()
});
pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit());
pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
pp.RCC.ahb2enr.modify(|_, w| {
w.gpioaen().set_bit();
w.gpioben().set_bit();
w.gpiocen().set_bit();
w.gpioden().set_bit();
w.gpioeen().set_bit();
w.gpiofen().set_bit();
pp.RCC.ahb1enr.modify(|_, w| {
w.gpioaen().enabled();
w.gpioben().enabled();
w.gpiocen().enabled();
w.gpioden().enabled();
w.gpioeen().enabled();
w.gpiofen().enabled();
w
});
let p = embassy_stm32::init(Default::default());
let mut led = Output::new(p.PA5, Level::High);
let mut led = Output::new(p.PB7, Level::High);
loop {
info!("high");

View File

@ -16,8 +16,7 @@ use embassy_traits::gpio::{WaitForFallingEdge, WaitForRisingEdge};
use example_common::*;
use cortex_m_rt::entry;
//use stm32f4::stm32f429 as pac;
use stm32l4::stm32l4x5 as pac;
use stm32f4::stm32f429 as pac;
#[embassy::task]
async fn main_task() {
@ -57,20 +56,19 @@ fn main() -> ! {
w.dbg_standby().set_bit();
w.dbg_stop().set_bit()
});
pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
pp.RCC.ahb1enr.modify(|_, w| w.dma1en().set_bit());
pp.RCC.ahb2enr.modify(|_, w| {
w.gpioaen().set_bit();
w.gpioben().set_bit();
w.gpiocen().set_bit();
w.gpioden().set_bit();
w.gpioeen().set_bit();
w.gpiofen().set_bit();
pp.RCC.ahb1enr.modify(|_, w| {
w.gpioaen().enabled();
w.gpioben().enabled();
w.gpiocen().enabled();
w.gpioden().enabled();
w.gpioeen().enabled();
w.gpiofen().enabled();
w
});
pp.RCC.apb2enr.modify(|_, w| {
w.syscfgen().set_bit();
w.syscfgen().enabled();
w
});