traits: migrate Delay to embedded-hal 1.0+async, remove Rng and Flash.
This commit is contained in:
@ -5,9 +5,6 @@
|
||||
#[path = "../example_common.rs"]
|
||||
mod example_common;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy::traits::rng::Random;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::rng::Rng;
|
||||
use embassy_stm32::Peripherals;
|
||||
use example_common::*;
|
||||
@ -16,17 +13,9 @@ use example_common::*;
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
info!("Hello World!");
|
||||
|
||||
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
let mut rng = Rng::new(p.RNG);
|
||||
|
||||
let mut rng = Random::new(Rng::new(p.RNG));
|
||||
|
||||
loop {
|
||||
info!("high {}", unwrap!(rng.next_u8(16).await));
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
|
||||
info!("low {}", unwrap!(rng.next_u8(16).await));
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
}
|
||||
let mut buf = [0u8; 16];
|
||||
unwrap!(rng.async_fill_bytes(&mut buf).await);
|
||||
info!("random bytes: {:02x}", buf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user