From 8b0cfde9a6c42ae45463eea42d4749bf919e3ffc Mon Sep 17 00:00:00 2001 From: Daniel Philipp <95503587+Duesentrieb71@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:40:28 +0200 Subject: [PATCH] =?UTF-8?q?Clarified=20comments=20about=20the=20cortex=5Fm?= =?UTF-8?q?::asm::delay=20functionality=20in=20al=E2=80=A6=20(#3064)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Clarified comments about the cortex_m::asm::delay functionality in all multiprio.rs examples * fixed formatting * Changed to using embassy_time::block_for() * removed my formatting scripts * specify embassy_time::Duration --- examples/nrf52840/src/bin/multiprio.rs | 4 ++-- examples/rp/src/bin/multiprio.rs | 4 ++-- examples/stm32f0/src/bin/multiprio.rs | 4 ++-- examples/stm32f3/src/bin/multiprio.rs | 4 ++-- examples/stm32f4/src/bin/multiprio.rs | 4 ++-- examples/stm32h7/src/bin/multiprio.rs | 4 ++-- examples/stm32h7rs/src/bin/multiprio.rs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/nrf52840/src/bin/multiprio.rs b/examples/nrf52840/src/bin/multiprio.rs index b634d8569..797be93a7 100644 --- a/examples/nrf52840/src/bin/multiprio.rs +++ b/examples/nrf52840/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(32_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(64_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs index 26b80c11d..2b397f97d 100644 --- a/examples/rp/src/bin/multiprio.rs +++ b/examples/rp/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(125_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(250_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; diff --git a/examples/stm32f0/src/bin/multiprio.rs b/examples/stm32f0/src/bin/multiprio.rs index 1c3f3991a..84e4077ef 100644 --- a/examples/stm32f0/src/bin/multiprio.rs +++ b/examples/stm32f0/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(8_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(16_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; diff --git a/examples/stm32f3/src/bin/multiprio.rs b/examples/stm32f3/src/bin/multiprio.rs index 87830b416..b4620888f 100644 --- a/examples/stm32f3/src/bin/multiprio.rs +++ b/examples/stm32f3/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(8_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(16_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; diff --git a/examples/stm32f4/src/bin/multiprio.rs b/examples/stm32f4/src/bin/multiprio.rs index 87830b416..b4620888f 100644 --- a/examples/stm32f4/src/bin/multiprio.rs +++ b/examples/stm32f4/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(8_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(16_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; diff --git a/examples/stm32h7/src/bin/multiprio.rs b/examples/stm32h7/src/bin/multiprio.rs index fcbb6c653..b4620888f 100644 --- a/examples/stm32h7/src/bin/multiprio.rs +++ b/examples/stm32h7/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(128_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(256_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; diff --git a/examples/stm32h7rs/src/bin/multiprio.rs b/examples/stm32h7rs/src/bin/multiprio.rs index fcbb6c653..b4620888f 100644 --- a/examples/stm32h7rs/src/bin/multiprio.rs +++ b/examples/stm32h7rs/src/bin/multiprio.rs @@ -80,7 +80,7 @@ async fn run_med() { info!(" [med] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(128_000_000); // ~1 second + embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33; @@ -97,7 +97,7 @@ async fn run_low() { info!("[low] Starting long computation"); // Spin-wait to simulate a long CPU computation - cortex_m::asm::delay(256_000_000); // ~2 seconds + embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds let end = Instant::now(); let ms = end.duration_since(start).as_ticks() / 33;