pub trait Timer: Sealed {
// Required methods
fn start(&self);
fn stop(&self);
fn reset(&self);
fn is_running(&self) -> bool;
fn now(&self) -> Instant<u64, 1, 1_000_000>;
fn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>;
fn enable_auto_reload(&self, auto_reload: bool);
fn enable_interrupt(&self, state: bool);
fn clear_interrupt(&self);
fn set_interrupt_handler(&self, handler: InterruptHandler);
fn is_interrupt_set(&self) -> bool;
}Expand description
Functionality provided by any timer peripheral.
Required Methods§
Sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
Is the timer running?
Sourcefn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>
fn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>
Load a target value into the timer.
Sourcefn enable_auto_reload(&self, auto_reload: bool)
fn enable_auto_reload(&self, auto_reload: bool)
Enable auto reload of the loaded value.
Sourcefn enable_interrupt(&self, state: bool)
fn enable_interrupt(&self, state: bool)
Enable or disable the timer’s interrupt.
Sourcefn clear_interrupt(&self)
fn clear_interrupt(&self)
Clear the timer’s interrupt.
Sourcefn set_interrupt_handler(&self, handler: InterruptHandler)
fn set_interrupt_handler(&self, handler: InterruptHandler)
Set the interrupt handler
Note that this will replace any previously set interrupt handler
Sourcefn is_interrupt_set(&self) -> bool
fn is_interrupt_set(&self) -> bool
Has the timer triggered?