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
.rust
let timer = hal::timer::Timer::new(pac.TIMER, &mut pac.RESETS);
wait_timer::Wait
.rust
let wait = Wait::new(&timer);
wait
and/or gate
methods.wait
functionsMore accurate waiting times than Delay.
rust
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.
rust
loop {
wait.gate_sec(1); // A
// ...
wait.gate_ms(500); // B
// ...
}