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::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -17,8 +17,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::rcc::{Mco, McoPrescaler, McoSource};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -20,8 +20,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use embassy_stm32::rcc::{ClockSrc, LsConfig, PLLSource, PllMul, PllPreDiv, PllRD
|
||||
use embassy_stm32::rtc::{Rtc, RtcConfig};
|
||||
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]
|
||||
@ -39,7 +39,7 @@ async fn main(_spawner: Spawner) {
|
||||
rtc.set_datetime(now.into()).expect("datetime not set");
|
||||
|
||||
// In reality the delay would be much longer
|
||||
Timer::after(Duration::from_millis(20000)).await;
|
||||
Timer::after_millis(20000).await;
|
||||
|
||||
let then: NaiveDateTime = rtc.now().unwrap().into();
|
||||
info!("Got RTC! {:?}", then.timestamp());
|
||||
|
@ -306,7 +306,7 @@ async fn temp_task(temp_dev_i2c: TempSensI2c, mut led: Output<'static, periphera
|
||||
|
||||
loop {
|
||||
led.set_low();
|
||||
match select(temp_sens.read_temp(), Timer::after(Duration::from_millis(500))).await {
|
||||
match select(temp_sens.read_temp(), Timer::after_millis(500)).await {
|
||||
Either::First(i2c_ret) => match i2c_ret {
|
||||
Ok(value) => {
|
||||
led.set_high();
|
||||
@ -424,7 +424,7 @@ where
|
||||
// Start: One shot
|
||||
let cfg = 0b01 << 5;
|
||||
self.write_cfg(cfg).await?;
|
||||
Timer::after(Duration::from_millis(250)).await;
|
||||
Timer::after_millis(250).await;
|
||||
self.bus
|
||||
.write_read(self.addr, &[Registers::Temp_MSB as u8], &mut buffer)
|
||||
.await
|
||||
|
Reference in New Issue
Block a user