[][src]Struct stm32l0xx_hal::lptim::LpTimer

pub struct LpTimer<M: CountMode> { /* fields omitted */ }

Low-Power Timer (LPTIM).

The Low-Power Timer is a 16-bit timer with a prescaler of up to 128. It can run off of the APB1, LSI, HSI16, or LSE clocks. With LSE, the slowest clock at 32.768 kHz, this results in a maximum timeout of 256 seconds, or 4 minutes and 16 seconds.

The timer can be initialized either in one-shot mode or in periodic mode, using init_oneshot or init_periodic respectively. In periodic mode, the embedded-hal Periodic marker trait is implemented and the CountDown implementation uses Hertz as the time unit. In one-shot mode, the CountDown implementation instead uses MicroSeconds, allowing for a multi-second timeout to be configured (with the tradeoff being a larger code size due to use of 64-bit arithmetic).

Methods

impl LpTimer<Periodic>[src]

pub fn init_periodic(
    lptim: LPTIM,
    pwr: &mut PWR,
    rcc: &mut Rcc,
    clk: ClockSrc
) -> Self
[src]

Initializes the Low-Power Timer in periodic mode.

The timer needs to be started by calling .start(freq).

impl LpTimer<OneShot>[src]

pub fn init_oneshot(
    lptim: LPTIM,
    pwr: &mut PWR,
    rcc: &mut Rcc,
    clk: ClockSrc
) -> Self
[src]

Initializes the Low-Power Timer in one-shot mode.

The timer needs to be started by calling .start(freq).

impl<M: CountMode> LpTimer<M>[src]

pub fn free(self) -> LPTIM[src]

Disables and destructs the timer, returning the raw LPTIM peripheral.

pub fn enable_interrupts(&mut self, interrupts: Interrupts)[src]

Disables the timer and enables the given interrupts.

pub fn disable_interrupts(&mut self, interrupts: Interrupts)[src]

Disables the timer and disables the given interrupts.

Trait Implementations

impl CountDown for LpTimer<Periodic>[src]

type Time = Hertz

The unit of time used by this timer

impl CountDown for LpTimer<OneShot>[src]

type Time = MicroSeconds

The unit of time used by this timer

impl Periodic for LpTimer<Periodic>[src]

Auto Trait Implementations

impl<M> Unpin for LpTimer<M> where
    M: Unpin

impl<M> Send for LpTimer<M> where
    M: Send

impl<M> !Sync for LpTimer<M>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self