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(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use embassy_stm32::exti::{Channel, ExtiInput};
|
||||
use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
|
||||
use embassy_stm32::spi;
|
||||
use embassy_stm32::time::khz;
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
|
||||
use lora_phy::LoRa;
|
||||
@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut start_indicator = Output::new(p.PB6, 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 mdltn_params = {
|
||||
@ -89,7 +89,7 @@ async fn main(_spawner: Spawner) {
|
||||
info!("cad successful without activity detected")
|
||||
}
|
||||
debug_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
debug_indicator.set_low();
|
||||
}
|
||||
Err(err) => info!("cad unsuccessful = {}", err),
|
||||
|
@ -12,7 +12,7 @@ use embassy_stm32::exti::{Channel, ExtiInput};
|
||||
use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
|
||||
use embassy_stm32::spi;
|
||||
use embassy_stm32::time::khz;
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
|
||||
use lora_phy::LoRa;
|
||||
@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut start_indicator = Output::new(p.PB6, 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];
|
||||
@ -107,7 +107,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");
|
||||
|
@ -7,21 +7,21 @@ use cortex_m_rt::entry;
|
||||
use defmt::*;
|
||||
use embassy_executor::raw::TaskStorage;
|
||||
use embassy_executor::Executor;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
async fn run1() {
|
||||
loop {
|
||||
info!("BIG INFREQUENT TICK");
|
||||
Timer::after(Duration::from_ticks(64000)).await;
|
||||
Timer::after_ticks(64000).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn run2() {
|
||||
loop {
|
||||
info!("tick");
|
||||
Timer::after(Duration::from_ticks(13000)).await;
|
||||
Timer::after_ticks(13000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user