Timer

Struct Timer 

Source
pub struct Timer<MODE> { /* private fields */ }
Expand description

HAL struct for Timer1 (timer type A)

Implementations§

Source§

impl<MODE> Timer<MODE>

Source

pub fn timer1_synchronous( timer: TMR1, clocking: Clocking, prescale: ClockPrescale, period: u16, stop_in_idle_mode: bool, ) -> Timer<TimerSynchronous>

Initalize the timer for synchronous operation

The timer peripheral is running synchronously with the PBCLOCK and cannot count external pulses when the PBCLOCK is gated.

Source

pub fn timer1_asynchronous( timer: TMR1, prescale: ClockPrescale, period: u16, stop_in_idle_mode: bool, ) -> Timer<TimerAsynchronous>

Initialize the timer for asynchronous operation

The timer will operate asynchronously with respect and independently from to the PBCLOCK When operating asynchronously, the timer is always external clocked, e.g. by a 32 kHz clock source or the like.

Source

pub fn free(self) -> TMR1

Turn the timer off

Source

pub fn tmr(&self) -> u16

Read the current timer count value

Source

pub fn period(&self) -> u16

Read the period (PR register)

Source

pub fn set_period(&mut self, period: u16)

Write to the period (PR register)

Source§

impl Timer<TimerSynchronous>

Source

pub fn set_tmr(&mut self, tmr: u16)

Set the current timer count value

Source§

impl Timer<TimerAsynchronous>

Source

pub fn set_tmr(&mut self, tmr: u16)

Set the current timer count value

Auto Trait Implementations§

§

impl<MODE> Freeze for Timer<MODE>

§

impl<MODE> RefUnwindSafe for Timer<MODE>
where MODE: RefUnwindSafe,

§

impl<MODE> Send for Timer<MODE>
where MODE: Send,

§

impl<MODE> !Sync for Timer<MODE>

§

impl<MODE> Unpin for Timer<MODE>
where MODE: Unpin,

§

impl<MODE> UnwindSafe for Timer<MODE>
where MODE: 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.