pub trait Basic16bitInstance: RccPeripheral {
type Interrupt: Interrupt;
// Required method
fn regs() -> TimBasic;
// Provided methods
fn start(&mut self) { ... }
fn stop(&mut self) { ... }
fn reset(&mut self) { ... }
fn set_frequency(&mut self, frequency: Hertz) { ... }
fn clear_update_interrupt(&mut self) -> bool { ... }
fn enable_update_interrupt(&mut self, enable: bool) { ... }
fn enable_update_dma(&mut self, enable: bool) { ... }
fn get_update_dma_state(&self) -> bool { ... }
fn set_autoreload_preload(&mut self, enable: bool) { ... }
fn get_frequency(&self) -> Hertz { ... }
}
Expand description
Basic 16-bit timer instance.
Required Associated Types§
Required Methods§
Sourcefn regs() -> TimBasic
fn regs() -> TimBasic
Get access to the basic 16bit timer registers.
Note: This works even if the timer is more capable, because registers for the less capable timers are a subset. This allows writing a driver for a given set of capabilities, and having it transparently work with more capable timers.
Provided Methods§
Sourcefn set_frequency(&mut self, frequency: Hertz)
fn set_frequency(&mut self, frequency: Hertz)
Set the frequency of how many times per second the timer counts up to the max value or down to 0.
This means that in the default edge-aligned mode, the timer counter will wrap around at the same frequency as is being set. In center-aligned mode (which not all timers support), the wrap-around frequency is effectively halved because it needs to count up and down.
Sourcefn clear_update_interrupt(&mut self) -> bool
fn clear_update_interrupt(&mut self) -> bool
Clear update interrupt.
Returns whether the update interrupt flag was set.
Sourcefn enable_update_interrupt(&mut self, enable: bool)
fn enable_update_interrupt(&mut self, enable: bool)
Enable/disable the update interrupt.
Sourcefn enable_update_dma(&mut self, enable: bool)
fn enable_update_dma(&mut self, enable: bool)
Enable/disable the update dma.
Sourcefn get_update_dma_state(&self) -> bool
fn get_update_dma_state(&self) -> bool
Get the update dma enable/disable state.
Sourcefn set_autoreload_preload(&mut self, enable: bool)
fn set_autoreload_preload(&mut self, enable: bool)
Enable/disable autoreload preload.
Sourcefn get_frequency(&self) -> Hertz
fn get_frequency(&self) -> Hertz
Get the timer frequency.
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.