Skip to content

Commit 8b0cfde

Browse files
Clarified comments about the cortex_m::asm::delay functionality in al… (#3064)
* 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
1 parent dbe2173 commit 8b0cfde

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

examples/nrf52840/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(32_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(64_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

examples/rp/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(125_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(250_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;

examples/stm32f0/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(8_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(16_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

examples/stm32f3/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(8_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(16_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

examples/stm32f4/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(8_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(16_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

examples/stm32h7/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(128_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(256_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

examples/stm32h7rs/src/bin/multiprio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async fn run_med() {
8080
info!(" [med] Starting long computation");
8181

8282
// Spin-wait to simulate a long CPU computation
83-
cortex_m::asm::delay(128_000_000); // ~1 second
83+
embassy_time::block_for(embassy_time::Duration::from_secs(1)); // ~1 second
8484

8585
let end = Instant::now();
8686
let ms = end.duration_since(start).as_ticks() / 33;
@@ -97,7 +97,7 @@ async fn run_low() {
9797
info!("[low] Starting long computation");
9898

9999
// Spin-wait to simulate a long CPU computation
100-
cortex_m::asm::delay(256_000_000); // ~2 seconds
100+
embassy_time::block_for(embassy_time::Duration::from_secs(2)); // ~2 seconds
101101

102102
let end = Instant::now();
103103
let ms = end.duration_since(start).as_ticks() / 33;

0 commit comments

Comments
 (0)