[−][src]Struct stm32l0xx_hal::lptim::LpTimer
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]
lptim: LPTIM,
pwr: &mut PWR,
rcc: &mut Rcc,
clk: ClockSrc
) -> Self
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]
lptim: LPTIM,
pwr: &mut PWR,
rcc: &mut Rcc,
clk: ClockSrc
) -> Self
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
fn start<T>(&mut self, freq: T) where
T: Into<Hertz>,
[src]
T: Into<Hertz>,
fn wait(&mut self) -> Result<(), Void>
[src]
impl CountDown for LpTimer<OneShot>
[src]
type Time = MicroSeconds
The unit of time used by this timer
fn start<T>(&mut self, period: T) where
T: Into<MicroSeconds>,
[src]
T: Into<MicroSeconds>,
fn wait(&mut self) -> Result<(), Void>
[src]
impl Periodic for LpTimer<Periodic>
[src]
Auto Trait Implementations
impl<M> Unpin for LpTimer<M> where
M: Unpin,
M: Unpin,
impl<M> Send for LpTimer<M> where
M: Send,
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]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self