fn arm(timer: &mut Timer, timestamp: u64) -> bool {
        let now = Instant::now().duration_since_epoch().as_micros();

        if timestamp > now {
            let mut timeout = Duration::from_micros(timestamp - now);
            loop {
                // The timer API doesn't let us query a maximum timeout, so let's try backing
                // off on failure.
                match timer.schedule(timeout) {
                    Ok(()) => break,
                    Err(Error::InvalidTimeout) => {
                        // It's okay to wake up earlier than scheduled.
                        timeout = timeout / 2;
                        assert_ne!(timeout, Duration::ZERO);
                    }
                    other => unwrap!(other),
                }
            }
            true
        } else {
            // If the timestamp is past, we return `false` to ask embassy to poll again
            // immediately.
            timer.stop();
            false
        }
    }
Returns `true` if the timer was armed, `false` if the timestamp is in
the past.
esp-hal-embassy/src/time_driver.rs