aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32wl
diff options
context:
space:
mode:
authorAdam Greig <[email protected]>2023-10-15 00:57:25 +0100
committerAdam Greig <[email protected]>2023-10-15 01:30:12 +0100
commit0621e957a0ddc7010d46b3ea3ddc8b9852bc8333 (patch)
treef6caefe939109e55a73e9141c736d2f6c20f51e8 /examples/stm32wl
parent7559f9e5834799b041d899767ef4305dcfdf0181 (diff)
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'examples/stm32wl')
-rw-r--r--examples/stm32wl/src/bin/blinky.rs6
-rw-r--r--examples/stm32wl/src/bin/lora_p2p_receive.rs6
-rw-r--r--examples/stm32wl/src/bin/rtc.rs4
3 files changed, 8 insertions, 8 deletions
diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs
index 6af5099ce..5bd5745f0 100644
--- a/examples/stm32wl/src/bin/blinky.rs
+++ b/examples/stm32wl/src/bin/blinky.rs
@@ -5,7 +5,7 @@
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_time::{Duration, Timer}; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[embassy_executor::main] 11#[embassy_executor::main]
@@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
18 loop { 18 loop {
19 info!("high"); 19 info!("high");
20 led.set_high(); 20 led.set_high();
21 Timer::after(Duration::from_millis(500)).await; 21 Timer::after_millis(500).await;
22 22
23 info!("low"); 23 info!("low");
24 led.set_low(); 24 led.set_low();
25 Timer::after(Duration::from_millis(500)).await; 25 Timer::after_millis(500).await;
26 } 26 }
27} 27}
diff --git a/examples/stm32wl/src/bin/lora_p2p_receive.rs b/examples/stm32wl/src/bin/lora_p2p_receive.rs
index 19b0d8531..be33f39c1 100644
--- a/examples/stm32wl/src/bin/lora_p2p_receive.rs
+++ b/examples/stm32wl/src/bin/lora_p2p_receive.rs
@@ -11,7 +11,7 @@ use embassy_lora::iv::{InterruptHandler, Stm32wlInterfaceVariant};
11use embassy_stm32::bind_interrupts; 11use embassy_stm32::bind_interrupts;
12use embassy_stm32::gpio::{Level, Output, Pin, Speed}; 12use embassy_stm32::gpio::{Level, Output, Pin, Speed};
13use embassy_stm32::spi::Spi; 13use embassy_stm32::spi::Spi;
14use embassy_time::{Delay, Duration, Timer}; 14use embassy_time::{Delay, Timer};
15use lora_phy::mod_params::*; 15use lora_phy::mod_params::*;
16use lora_phy::sx1261_2::SX1261_2; 16use lora_phy::sx1261_2::SX1261_2;
17use lora_phy::LoRa; 17use lora_phy::LoRa;
@@ -51,7 +51,7 @@ async fn main(_spawner: Spawner) {
51 let mut start_indicator = Output::new(p.PB15, Level::Low, Speed::Low); 51 let mut start_indicator = Output::new(p.PB15, Level::Low, Speed::Low);
52 52
53 start_indicator.set_high(); 53 start_indicator.set_high();
54 Timer::after(Duration::from_secs(5)).await; 54 Timer::after_secs(5).await;
55 start_indicator.set_low(); 55 start_indicator.set_low();
56 56
57 let mut receiving_buffer = [00u8; 100]; 57 let mut receiving_buffer = [00u8; 100];
@@ -103,7 +103,7 @@ async fn main(_spawner: Spawner) {
103 { 103 {
104 info!("rx successful"); 104 info!("rx successful");
105 debug_indicator.set_high(); 105 debug_indicator.set_high();
106 Timer::after(Duration::from_secs(5)).await; 106 Timer::after_secs(5).await;
107 debug_indicator.set_low(); 107 debug_indicator.set_low();
108 } else { 108 } else {
109 info!("rx unknown packet"); 109 info!("rx unknown packet");
diff --git a/examples/stm32wl/src/bin/rtc.rs b/examples/stm32wl/src/bin/rtc.rs
index a6bb28013..9ebb05f22 100644
--- a/examples/stm32wl/src/bin/rtc.rs
+++ b/examples/stm32wl/src/bin/rtc.rs
@@ -8,7 +8,7 @@ use embassy_executor::Spawner;
8use embassy_stm32::rcc::{ClockSrc, LsConfig}; 8use embassy_stm32::rcc::{ClockSrc, LsConfig};
9use embassy_stm32::rtc::{Rtc, RtcConfig}; 9use embassy_stm32::rtc::{Rtc, RtcConfig};
10use embassy_stm32::Config; 10use embassy_stm32::Config;
11use embassy_time::{Duration, Timer}; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14#[embassy_executor::main] 14#[embassy_executor::main]
@@ -32,7 +32,7 @@ async fn main(_spawner: Spawner) {
32 rtc.set_datetime(now.into()).expect("datetime not set"); 32 rtc.set_datetime(now.into()).expect("datetime not set");
33 33
34 // In reality the delay would be much longer 34 // In reality the delay would be much longer
35 Timer::after(Duration::from_millis(20000)).await; 35 Timer::after_millis(20000).await;
36 36
37 let then: NaiveDateTime = rtc.now().unwrap().into(); 37 let then: NaiveDateTime = rtc.now().unwrap().into();
38 info!("Got RTC! {:?}", then.timestamp()); 38 info!("Got RTC! {:?}", then.timestamp());