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§

source

type Interrupt: Interrupt

Interrupt for this timer.

Required Methods§

source

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§

source

fn start(&mut self)

Start the timer.

source

fn stop(&mut self)

Stop the timer.

source

fn reset(&mut self)

Reset the counter value to 0

source

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.

source

fn clear_update_interrupt(&mut self) -> bool

Clear update interrupt.

Returns whether the update interrupt flag was set.

source

fn enable_update_interrupt(&mut self, enable: bool)

Enable/disable the update interrupt.

source

fn enable_update_dma(&mut self, enable: bool)

Enable/disable the update dma.

source

fn get_update_dma_state(&self) -> bool

Get the update dma enable/disable state.

source

fn set_autoreload_preload(&mut self, enable: bool)

Enable/disable autoreload preload.

source

fn get_frequency(&self) -> Hertz

Get the timer frequency.

Object Safety§

This trait is not object safe.

Implementors§