aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l0/src/bin
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/stm32l0/src/bin
parent7559f9e5834799b041d899767ef4305dcfdf0181 (diff)
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'examples/stm32l0/src/bin')
-rw-r--r--examples/stm32l0/src/bin/blinky.rs6
-rw-r--r--examples/stm32l0/src/bin/lora_cad.rs6
-rw-r--r--examples/stm32l0/src/bin/lora_p2p_receive.rs6
-rw-r--r--examples/stm32l0/src/bin/raw_spawn.rs6
4 files changed, 12 insertions, 12 deletions
diff --git a/examples/stm32l0/src/bin/blinky.rs b/examples/stm32l0/src/bin/blinky.rs
index 07fad07c6..ea40bfc48 100644
--- a/examples/stm32l0/src/bin/blinky.rs
+++ b/examples/stm32l0/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(300)).await; 21 Timer::after_millis(300).await;
22 22
23 info!("low"); 23 info!("low");
24 led.set_low(); 24 led.set_low();
25 Timer::after(Duration::from_millis(300)).await; 25 Timer::after_millis(300).await;
26 } 26 }
27} 27}
diff --git a/examples/stm32l0/src/bin/lora_cad.rs b/examples/stm32l0/src/bin/lora_cad.rs
index 900848fd8..987cdba01 100644
--- a/examples/stm32l0/src/bin/lora_cad.rs
+++ b/examples/stm32l0/src/bin/lora_cad.rs
@@ -12,7 +12,7 @@ use embassy_stm32::exti::{Channel, ExtiInput};
12use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; 12use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
13use embassy_stm32::spi; 13use embassy_stm32::spi;
14use embassy_stm32::time::khz; 14use embassy_stm32::time::khz;
15use embassy_time::{Delay, Duration, Timer}; 15use embassy_time::{Delay, Timer};
16use lora_phy::mod_params::*; 16use lora_phy::mod_params::*;
17use lora_phy::sx1276_7_8_9::SX1276_7_8_9; 17use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
18use lora_phy::LoRa; 18use lora_phy::LoRa;
@@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
55 let mut start_indicator = Output::new(p.PB6, Level::Low, Speed::Low); 55 let mut start_indicator = Output::new(p.PB6, Level::Low, Speed::Low);
56 56
57 start_indicator.set_high(); 57 start_indicator.set_high();
58 Timer::after(Duration::from_secs(5)).await; 58 Timer::after_secs(5).await;
59 start_indicator.set_low(); 59 start_indicator.set_low();
60 60
61 let mdltn_params = { 61 let mdltn_params = {
@@ -89,7 +89,7 @@ async fn main(_spawner: Spawner) {
89 info!("cad successful without activity detected") 89 info!("cad successful without activity detected")
90 } 90 }
91 debug_indicator.set_high(); 91 debug_indicator.set_high();
92 Timer::after(Duration::from_secs(5)).await; 92 Timer::after_secs(5).await;
93 debug_indicator.set_low(); 93 debug_indicator.set_low();
94 } 94 }
95 Err(err) => info!("cad unsuccessful = {}", err), 95 Err(err) => info!("cad unsuccessful = {}", err),
diff --git a/examples/stm32l0/src/bin/lora_p2p_receive.rs b/examples/stm32l0/src/bin/lora_p2p_receive.rs
index edd14bb81..06e2744a4 100644
--- a/examples/stm32l0/src/bin/lora_p2p_receive.rs
+++ b/examples/stm32l0/src/bin/lora_p2p_receive.rs
@@ -12,7 +12,7 @@ use embassy_stm32::exti::{Channel, ExtiInput};
12use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; 12use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
13use embassy_stm32::spi; 13use embassy_stm32::spi;
14use embassy_stm32::time::khz; 14use embassy_stm32::time::khz;
15use embassy_time::{Delay, Duration, Timer}; 15use embassy_time::{Delay, Timer};
16use lora_phy::mod_params::*; 16use lora_phy::mod_params::*;
17use lora_phy::sx1276_7_8_9::SX1276_7_8_9; 17use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
18use lora_phy::LoRa; 18use lora_phy::LoRa;
@@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
55 let mut start_indicator = Output::new(p.PB6, Level::Low, Speed::Low); 55 let mut start_indicator = Output::new(p.PB6, Level::Low, Speed::Low);
56 56
57 start_indicator.set_high(); 57 start_indicator.set_high();
58 Timer::after(Duration::from_secs(5)).await; 58 Timer::after_secs(5).await;
59 start_indicator.set_low(); 59 start_indicator.set_low();
60 60
61 let mut receiving_buffer = [00u8; 100]; 61 let mut receiving_buffer = [00u8; 100];
@@ -107,7 +107,7 @@ async fn main(_spawner: Spawner) {
107 { 107 {
108 info!("rx successful"); 108 info!("rx successful");
109 debug_indicator.set_high(); 109 debug_indicator.set_high();
110 Timer::after(Duration::from_secs(5)).await; 110 Timer::after_secs(5).await;
111 debug_indicator.set_low(); 111 debug_indicator.set_low();
112 } else { 112 } else {
113 info!("rx unknown packet"); 113 info!("rx unknown packet");
diff --git a/examples/stm32l0/src/bin/raw_spawn.rs b/examples/stm32l0/src/bin/raw_spawn.rs
index edc17304a..29c7e0dc7 100644
--- a/examples/stm32l0/src/bin/raw_spawn.rs
+++ b/examples/stm32l0/src/bin/raw_spawn.rs
@@ -7,21 +7,21 @@ use cortex_m_rt::entry;
7use defmt::*; 7use defmt::*;
8use embassy_executor::raw::TaskStorage; 8use embassy_executor::raw::TaskStorage;
9use embassy_executor::Executor; 9use embassy_executor::Executor;
10use embassy_time::{Duration, Timer}; 10use embassy_time::Timer;
11use static_cell::StaticCell; 11use static_cell::StaticCell;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14async fn run1() { 14async fn run1() {
15 loop { 15 loop {
16 info!("BIG INFREQUENT TICK"); 16 info!("BIG INFREQUENT TICK");
17 Timer::after(Duration::from_ticks(64000)).await; 17 Timer::after_ticks(64000).await;
18 } 18 }
19} 19}
20 20
21async fn run2() { 21async fn run2() {
22 loop { 22 loop {
23 info!("tick"); 23 info!("tick");
24 Timer::after(Duration::from_ticks(13000)).await; 24 Timer::after_ticks(13000).await;
25 } 25 }
26} 26}
27 27