Struct imxrt_hal::pit::Chained

source ·
pub struct Chained<const L: u8, const H: u8> { /* private fields */ }
Expand description

Two chained PIT timer channels.

When the low timer counts down to zero, the high timer is decremented by one. This doubles the width of the timer.

Timers must be chained in sequence. For example, timer 2 (high) can be chained to timer 1 (low). But, timer 3 cannot be chained to timer 1.

Chaining channel 1 and 0 enables the lifetime register. The lifetime register allows us to read two 32-bit registers without rollover. Otherwise, the implementation handles rollovers in software with a small loop and comparison.

Implementations§

source§

impl Chained<0, 1>

source

pub fn new(low: Pit<0>, high: Pit<1>) -> Self

Chain together channels 0 and 1.

This creates the lifetime timer.

source

pub fn lifetime_value(&self) -> u64

Read the lifetime register value.

This is only supported when chaining channels 0 and channel 1. Returns 0 if the timer is disabled. The lifetime registers account for rollover possibility in hardware.

This method implements the recommended fix for errata ERR050130.

source§

impl Chained<1, 2>

source

pub fn new(low: Pit<1>, high: Pit<2>) -> Self

Chain together channels 1 and 2.

source§

impl Chained<2, 3>

source

pub fn new(low: Pit<2>, high: Pit<3>) -> Self

Chain together channels 2 and 3.

source§

impl<const L: u8, const H: u8> Chained<L, H>

source

pub fn release(self) -> (Pit<L>, Pit<H>)

Release the chained timers.

When release returns, the timer chain is disabled, and the timer channels are disabled.

source

pub fn set_interrupt_enable(&mut self, enable: bool)

Enable (true) or disable (false) interrupt generation when the chained timer expires.

source

pub fn is_interrupt_enabled(&self) -> bool

Indicates if timeouts will (true) or will not (false) generate interrupts.

source

pub fn set_load_timer_value(&mut self, ticks: u64)

Loads the timer value for the next timer run.

ticks is in clock ticks.

source

pub fn load_timer_value(&self) -> u64

Returns the load timer value for the next timer run, in ticks.

source

pub fn current_timer_value(&self) -> u64

Reads the current timer value, in clock ticks.

Returns 0 if the timer is disabled.

source

pub fn enable(&mut self)

Enable the chained timer.

source

pub fn disable(&mut self)

Disable the chained timer.

source

pub fn is_enabled(&self) -> bool

Returns true if the chained timer is enabled.

source

pub fn is_elapsed(&self) -> bool

Returns true if the chained timer has elapsed.

source

pub fn clear_elapsed(&mut self)

Clear the elapsed flag.

Auto Trait Implementations§

§

impl<const L: u8, const H: u8> !RefUnwindSafe for Chained<L, H>

§

impl<const L: u8, const H: u8> Send for Chained<L, H>

§

impl<const L: u8, const H: u8> !Sync for Chained<L, H>

§

impl<const L: u8, const H: u8> Unpin for Chained<L, H>

§

impl<const L: u8, const H: u8> !UnwindSafe for Chained<L, H>

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>,

§

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>,

§

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.