embassy-stm32

Crates

0.1.0

Versions

stm32f730z8

Flavors

Trait 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.

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.

Implementors§