atsamd_hal/
timer_traits.rs

1use core::convert::Infallible;
2
3use fugit::NanosDurationU32;
4
5/// Specifies a timer that can enable & disable an interrupt that fires
6/// when the timer expires
7pub trait InterruptDrivenTimer {
8    /// Enable the timer interrupt
9    fn enable_interrupt(&mut self);
10
11    /// Start the timer with a given timeout in nanoseconds
12    fn start<T: Into<NanosDurationU32>>(&mut self, timeout: T);
13
14    /// Wait for the timer to finish counting down **without blocking**.
15    fn wait(&mut self) -> nb::Result<(), Infallible>;
16
17    /// Disable the timer interrupt
18    fn disable_interrupt(&mut self);
19}