pub trait Instance: Sealed {
const INTERRUPT: Interrupt;
// Required method
fn as_timer0(&self) -> &RegisterBlock;
// Provided methods
fn timer_start<Time>(&self, cycles: Time)
where Time: Into<u32> { ... }
fn timer_reset_event(&self) { ... }
fn timer_cancel(&self) { ... }
fn timer_running(&self) -> bool { ... }
fn read_counter(&self) -> u32 { ... }
fn disable_interrupt(&self) { ... }
fn enable_interrupt(&self) { ... }
fn set_shorts_periodic(&self) { ... }
fn set_shorts_oneshot(&self) { ... }
fn set_periodic(&self) { ... }
fn set_oneshot(&self) { ... }
}
Expand description
Implemented by all TIMER* instances.
Required Associated Constants§
Required Methods§
Sourcefn as_timer0(&self) -> &RegisterBlock
fn as_timer0(&self) -> &RegisterBlock
Returns the register block for the timer instance.
Provided Methods§
Sourcefn timer_start<Time>(&self, cycles: Time)
fn timer_start<Time>(&self, cycles: Time)
Starts the timer after clearing the counter register and setting the events compare trigger
correctly to the numer of cycles
.
Sourcefn timer_reset_event(&self)
fn timer_reset_event(&self)
Resets event for CC[0] register.
Sourcefn timer_cancel(&self)
fn timer_cancel(&self)
Cancels timer by setting it to stop mode and resetting the events.
Sourcefn timer_running(&self) -> bool
fn timer_running(&self) -> bool
Checks if the timer is still running which means no event is yet generated for CC[0].
fn read_counter(&self) -> u32
Sourcefn disable_interrupt(&self)
fn disable_interrupt(&self)
Disables interrupt for event COMPARE[0].
Sourcefn enable_interrupt(&self)
fn enable_interrupt(&self)
Enables interrupt for event COMPARE[0].
Sourcefn set_shorts_periodic(&self)
fn set_shorts_periodic(&self)
Sets timer into periodic mode.
Sourcefn set_shorts_oneshot(&self)
fn set_shorts_oneshot(&self)
Sets timer into oneshot mode.
Sourcefn set_periodic(&self)
fn set_periodic(&self)
Sets up timer for 1 MHz prescaled periods with 32 bits accuracy.
This is only safe to call when the timer is stopped.
Sourcefn set_oneshot(&self)
fn set_oneshot(&self)
Sets up timer for a 1 MHz prescaled oneshot with 32 bits accuracy.
This is only safe to call when the timer is stopped.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.