Trait embassy_stm32::timer::low_level::Basic16bitInstance
source · 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.