Struct stm32l4xx_hal::lptimer::LowPowerTimer
source · [−]pub struct LowPowerTimer<LPTIM> { /* private fields */ }
Expand description
A low power hardware timer
Supported things:
- Compare match
- Auto reload matches
Implementations
sourceimpl LowPowerTimer<LPTIM1>
impl LowPowerTimer<LPTIM1>
sourcepub fn lptim1(
lptim: LPTIM1,
config: LowPowerTimerConfig,
apb1rn: &mut <LPTIM1 as RccBus>::Bus,
ccipr: &mut CCIPR,
clocks: Clocks
) -> Self
pub fn lptim1(
lptim: LPTIM1,
config: LowPowerTimerConfig,
apb1rn: &mut <LPTIM1 as RccBus>::Bus,
ccipr: &mut CCIPR,
clocks: Clocks
) -> Self
Consume the LPTIM and produce a LowPowerTimer that encapsulates said LPTIM.
config
contains details about the desired configuration for the
LowPowerTimer
Panics
This function panics if the value of ARR is less than or equal to CMP, and if the clock source is HSI16, LSI, or LSE and that clock is not enabled.
sourcepub fn is_event_triggered(&self, event: Event) -> bool
pub fn is_event_triggered(&self, event: Event) -> bool
Check if the specified event has been triggered for this LowPowerTimer.
If this function returns true
for an Event
that this LowPowerTimer is listening for,
LowPowerTimer::clear_event_flag
must be called for that event to prevent the
interrupt from looping eternally. This is not done in a single function to
avoid using a mutable reference for an operation that does not require it.
sourcepub fn clear_event_flag(&mut self, event: Event)
pub fn clear_event_flag(&mut self, event: Event)
Clear the interrupt flag for the specified event
sourcepub fn set_compare_match(&mut self, value: u16)
pub fn set_compare_match(&mut self, value: u16)
Set the compare match field for this LowPowerTimer
sourcepub fn set_autoreload(&mut self, arr_value: u16)
pub fn set_autoreload(&mut self, arr_value: u16)
Set auto reload register has to be used after enabling of lptim
sourcepub fn get_counter(&self) -> u16
pub fn get_counter(&self) -> u16
Get the current counter value for this LowPowerTimer
pub fn pause(&mut self)
pub fn resume(&mut self)
sourceimpl LowPowerTimer<LPTIM2>
impl LowPowerTimer<LPTIM2>
sourcepub fn lptim2(
lptim: LPTIM2,
config: LowPowerTimerConfig,
apb1rn: &mut <LPTIM2 as RccBus>::Bus,
ccipr: &mut CCIPR,
clocks: Clocks
) -> Self
pub fn lptim2(
lptim: LPTIM2,
config: LowPowerTimerConfig,
apb1rn: &mut <LPTIM2 as RccBus>::Bus,
ccipr: &mut CCIPR,
clocks: Clocks
) -> Self
Consume the LPTIM and produce a LowPowerTimer that encapsulates said LPTIM.
config
contains details about the desired configuration for the
LowPowerTimer
Panics
This function panics if the value of ARR is less than or equal to CMP, and if the clock source is HSI16, LSI, or LSE and that clock is not enabled.
sourcepub fn is_event_triggered(&self, event: Event) -> bool
pub fn is_event_triggered(&self, event: Event) -> bool
Check if the specified event has been triggered for this LowPowerTimer.
If this function returns true
for an Event
that this LowPowerTimer is listening for,
LowPowerTimer::clear_event_flag
must be called for that event to prevent the
interrupt from looping eternally. This is not done in a single function to
avoid using a mutable reference for an operation that does not require it.
sourcepub fn clear_event_flag(&mut self, event: Event)
pub fn clear_event_flag(&mut self, event: Event)
Clear the interrupt flag for the specified event
sourcepub fn set_compare_match(&mut self, value: u16)
pub fn set_compare_match(&mut self, value: u16)
Set the compare match field for this LowPowerTimer
sourcepub fn set_autoreload(&mut self, arr_value: u16)
pub fn set_autoreload(&mut self, arr_value: u16)
Set auto reload register has to be used after enabling of lptim
sourcepub fn get_counter(&self) -> u16
pub fn get_counter(&self) -> u16
Get the current counter value for this LowPowerTimer
pub fn pause(&mut self)
pub fn resume(&mut self)
Auto Trait Implementations
impl<LPTIM> RefUnwindSafe for LowPowerTimer<LPTIM> where
LPTIM: RefUnwindSafe,
impl<LPTIM> Send for LowPowerTimer<LPTIM> where
LPTIM: Send,
impl<LPTIM> Sync for LowPowerTimer<LPTIM> where
LPTIM: Sync,
impl<LPTIM> Unpin for LowPowerTimer<LPTIM> where
LPTIM: Unpin,
impl<LPTIM> UnwindSafe for LowPowerTimer<LPTIM> where
LPTIM: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more