Crates.io | rp2040_wait |
lib.rs | rp2040_wait |
version | 0.1.0 |
source | src |
created_at | 2023-05-23 11:23:17.674078 |
updated_at | 2023-05-23 11:23:17.674078 |
description | Crate for more accurate wait times than Delay using rp2040_hal::timer::Timer. |
homepage | |
repository | |
max_upload_size | |
id | 871920 |
size | 23,977 |
Crate for more accurate wait times than Delay
using rp2040_hal::timer::Timer
.
In addition to wait
function that waits for a specified number of seconds,
gate
function is implemented that keeps the time until it is re-executed constant.
rp2040_hal::timer::Timer
.let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS);
wait_timer::Wait
.let wait = Wait::new(&timer);
wait
and/or gate
methods.wait
functionsMore accurate waiting times than Delay.
wait.wait_us(1_000_000);
wait.wait_ms(1_000);
wait.wait_sec(1);
gate
functionsWait a specified number of seconds since the last execution.
loop {
wait.gate_sec(1); // A
// ...
wait.gate_ms(500); // B
// ...
}