embassy-stm32

Crates

git

Versions

stm32g4a1ke

Flavors

embassy_stm32::lptim::timer

Struct Timer

Source
pub struct Timer<'d, T: Instance> { /* private fields */ }
Expand description

Low-level timer driver.

Implementations§

Source§

impl<'d, T: Instance> Timer<'d, T>

Source

pub fn new(tim: impl Peripheral<P = T> + 'd) -> Self

Create a new timer driver.

Source

pub fn enable(&self)

Enable the timer.

Source

pub fn disable(&self)

Disable the timer.

Source

pub fn single_mode_start(&self)

Start the timer in single pulse mode.

Source

pub fn continuous_mode_start(&self)

Start the timer in continuous mode.

Source

pub fn set_frequency(&self, frequency: Hertz)

Set the frequency of how many times per second the timer counts up to the max value or down to 0.

Source

pub fn get_frequency(&self) -> Hertz

Get the timer frequency.

Source

pub fn get_clock_frequency(&self) -> Hertz

Get the clock frequency of the timer (before prescaler is applied).

Source

pub fn get_max_compare_value(&self) -> u16

Get max compare value. This depends on the timer frequency and the clock frequency from RCC.

Source§

impl<'d, T: Instance> Timer<'d, T>

Source

pub fn set_compare_value(&self, value: u16)

Set compare value for a channel.

Source

pub fn get_compare_value(&self) -> u16

Get compare value for a channel.

Auto Trait Implementations§

§

impl<'d, T> Freeze for Timer<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for Timer<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for Timer<'d, T>
where T: Send,

§

impl<'d, T> Sync for Timer<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for Timer<'d, T>
where T: Unpin,

§

impl<'d, T> !UnwindSafe for Timer<'d, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.