mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
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:
parent
dbe21730cd
commit
8b0cfde9a6
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user