Expand description
Static timing: const-generic durations and async sleep futures.
Sleep registers its deadline with crate::timer on first poll and
then returns Pending without re-arming its own waker โ the platform
timer ISR wakes it when the deadline passes. This means a sleeping task
does not busy-poll: between ticks the executor has nothing ready and
genuinely enters port::arch::idle() (WFI), which is what makes tickless
idle actually save power instead of spinning.
โ
use rivet::time::Sleep;
#[rivet::task(priority = 0)]
async fn blink() {
loop {
toggle_led();
Sleep::<500_000>::new().await; // 500ms
}
}