Struct LowPowerTimer

Source
pub struct LowPowerTimer<LPTIM> { /* private fields */ }
Expand description

A low power hardware timer

Supported things:

  • Compare match
  • Auto reload matches

Implementations§

Source§

impl LowPowerTimer<LPTIM1>

Source

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.

Source

pub fn listen(&mut self, event: Event)

Enable interrupts for the specified event

Source

pub fn unlisten(&mut self, event: Event)

Disable interrupts for the specified event

Source

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.

Source

pub fn clear_event_flag(&mut self, event: Event)

Clear the interrupt flag for the specified event

Source

pub fn set_compare_match(&mut self, value: u16)

Set the compare match field for this LowPowerTimer

Source

pub fn set_autoreload(&mut self, arr_value: u16)

Set auto reload register has to be used after enabling of lptim

Source

pub fn get_counter(&self) -> u16

Get the current counter value for this LowPowerTimer

Source

pub fn get_arr(&self) -> u16

Get the value of the ARR register for this LowPowerTimer

Source

pub fn pause(&mut self)

Source

pub fn resume(&mut self)

Source§

impl LowPowerTimer<LPTIM2>

Source

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.

Source

pub fn listen(&mut self, event: Event)

Enable interrupts for the specified event

Source

pub fn unlisten(&mut self, event: Event)

Disable interrupts for the specified event

Source

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.

Source

pub fn clear_event_flag(&mut self, event: Event)

Clear the interrupt flag for the specified event

Source

pub fn set_compare_match(&mut self, value: u16)

Set the compare match field for this LowPowerTimer

Source

pub fn set_autoreload(&mut self, arr_value: u16)

Set auto reload register has to be used after enabling of lptim

Source

pub fn get_counter(&self) -> u16

Get the current counter value for this LowPowerTimer

Source

pub fn get_arr(&self) -> u16

Get the value of the ARR register for this LowPowerTimer

Source

pub fn pause(&mut self)

Source

pub fn resume(&mut self)

Auto Trait Implementations§

§

impl<LPTIM> Freeze for LowPowerTimer<LPTIM>
where LPTIM: Freeze,

§

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§

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.