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
This commit is contained in:
Daniel Philipp 2024-06-12 19:40:28 +02:00 committed by GitHub
parent dbe21730cd
commit 8b0cfde9a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 14 additions and 14 deletions

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;

View File

@ -80,7 +80,7 @@ async fn run_med() {
info!(" [med] Starting long computation"); info!(" [med] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;
@ -97,7 +97,7 @@ async fn run_low() {
info!("[low] Starting long computation"); info!("[low] Starting long computation");
// Spin-wait to simulate a long CPU 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 end = Instant::now();
let ms = end.duration_since(start).as_ticks() / 33; let ms = end.duration_since(start).as_ticks() / 33;