time: Update examples, tests, and other code to use new Timer::after_x convenience methods
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::adc::Adc;
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -29,6 +29,6 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
let v = adc.read(&mut pin);
|
||||
info!("--> {} - {} mV", v, convert_to_millivolts(v));
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub async fn send_can_message(tx: &'static mut CanTx<'static, 'static, CAN3>) {
|
||||
loop {
|
||||
let frame = Frame::new_data(unwrap!(StandardId::new(0 as _)), [0]);
|
||||
tx.write(&frame).await;
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_secs(1)).await;
|
||||
embassy_time::Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use embassy_stm32::peripherals::ETH;
|
||||
use embassy_stm32::rng::Rng;
|
||||
use embassy_stm32::time::mhz;
|
||||
use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_io_async::Write;
|
||||
use rand_core::RngCore;
|
||||
use static_cell::make_static;
|
||||
@ -100,7 +100,7 @@ async fn main(spawner: Spawner) -> ! {
|
||||
let r = socket.connect(remote_endpoint).await;
|
||||
if let Err(e) = r {
|
||||
info!("connect error: {:?}", e);
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
continue;
|
||||
}
|
||||
info!("connected!");
|
||||
@ -111,7 +111,7 @@ async fn main(spawner: Spawner) -> ! {
|
||||
info!("write error: {:?}", e);
|
||||
break;
|
||||
}
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::flash::Flash;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,7 +16,7 @@ async fn main(_spawner: Spawner) {
|
||||
const ADDR: u32 = 0x8_0000; // This is the offset into the third region, the absolute address is 4x32K + 128K + 0x8_0000.
|
||||
|
||||
// wait a bit before accessing the flash
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
let mut f = Flash::new_blocking(p.FLASH).into_blocking_regions().bank1_region3;
|
||||
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -17,6 +17,6 @@ async fn main(_spawner: Spawner) -> ! {
|
||||
|
||||
loop {
|
||||
info!("Hello World!");
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user