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]
 | 
			
		||||
@@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
 | 
			
		||||
    loop {
 | 
			
		||||
        info!("high");
 | 
			
		||||
        led.set_high();
 | 
			
		||||
        Timer::after(Duration::from_millis(500)).await;
 | 
			
		||||
        Timer::after_millis(500).await;
 | 
			
		||||
 | 
			
		||||
        info!("low");
 | 
			
		||||
        led.set_low();
 | 
			
		||||
        Timer::after(Duration::from_millis(500)).await;
 | 
			
		||||
        Timer::after_millis(500).await;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ use embassy_lora::iv::{InterruptHandler, Stm32wlInterfaceVariant};
 | 
			
		||||
use embassy_stm32::bind_interrupts;
 | 
			
		||||
use embassy_stm32::gpio::{Level, Output, Pin, Speed};
 | 
			
		||||
use embassy_stm32::spi::Spi;
 | 
			
		||||
use embassy_time::{Delay, Duration, Timer};
 | 
			
		||||
use embassy_time::{Delay, Timer};
 | 
			
		||||
use lora_phy::mod_params::*;
 | 
			
		||||
use lora_phy::sx1261_2::SX1261_2;
 | 
			
		||||
use lora_phy::LoRa;
 | 
			
		||||
@@ -51,7 +51,7 @@ async fn main(_spawner: Spawner) {
 | 
			
		||||
    let mut start_indicator = Output::new(p.PB15, Level::Low, Speed::Low);
 | 
			
		||||
 | 
			
		||||
    start_indicator.set_high();
 | 
			
		||||
    Timer::after(Duration::from_secs(5)).await;
 | 
			
		||||
    Timer::after_secs(5).await;
 | 
			
		||||
    start_indicator.set_low();
 | 
			
		||||
 | 
			
		||||
    let mut receiving_buffer = [00u8; 100];
 | 
			
		||||
@@ -103,7 +103,7 @@ async fn main(_spawner: Spawner) {
 | 
			
		||||
                {
 | 
			
		||||
                    info!("rx successful");
 | 
			
		||||
                    debug_indicator.set_high();
 | 
			
		||||
                    Timer::after(Duration::from_secs(5)).await;
 | 
			
		||||
                    Timer::after_secs(5).await;
 | 
			
		||||
                    debug_indicator.set_low();
 | 
			
		||||
                } else {
 | 
			
		||||
                    info!("rx unknown packet");
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ use embassy_executor::Spawner;
 | 
			
		||||
use embassy_stm32::rcc::{ClockSrc, LsConfig};
 | 
			
		||||
use embassy_stm32::rtc::{Rtc, RtcConfig};
 | 
			
		||||
use embassy_stm32::Config;
 | 
			
		||||
use embassy_time::{Duration, Timer};
 | 
			
		||||
use embassy_time::Timer;
 | 
			
		||||
use {defmt_rtt as _, panic_probe as _};
 | 
			
		||||
 | 
			
		||||
#[embassy_executor::main]
 | 
			
		||||
@@ -32,7 +32,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());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user