Struct imxrt_hal::pit::Pit

source ·
pub struct Pit<const CHAN: u8> { /* private fields */ }
Expand description

A periodic interrupt timer (PIT) channel.

Implementations§

source§

impl<const CHAN: u8> Pit<CHAN>

source

pub unsafe fn new<const N: u8>(instance: &Instance<N>) -> Self
where Const<CHAN>: Valid,

Fabricate a PIT channel instance.

§Safety

This allows you to produce multiple PIT channels that mutably reference the same memory. You must ensure that writes to the peripheral memory are synchronized across instances.

Use the free function new() to safely acquire the four PIT channels.

source

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

Enable (true) or disable (false) interrupt generation.

source

pub fn is_interrupt_enabled(&self) -> bool

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

source

pub fn current_timer_value(&self) -> u32

Reads the current time value, in clock ticks.

Returns 0 if the timer is disabled.

source

pub fn set_load_timer_value(&self, ticks: u32)

Loads the timer value for the next timer run.

ticks is in clock ticks.

source

pub fn load_timer_value(&self) -> u32

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

source

pub fn enable(&mut self)

Enable the timer.

source

pub fn disable(&mut self)

Disable the timer.

source

pub fn is_enabled(&self) -> bool

Returns true if the PIT channel is enabled.

source

pub fn is_elapsed(&self) -> bool

Returns true if the timer has elapsed.

source

pub fn clear_elapsed(&self)

Clear the elapsed flag.

source

pub fn set_chained(&mut self, chained: bool)

Specify that this channel is chained to the previous channel.

This affects how the timer counts. If you’re looking to chain timers easily, see Chained.

source

pub fn is_chained(&self) -> bool

Returns true if this channel is chained to the previous channel.

Trait Implementations§

source§

impl<const CHAN: u8> Send for Pit<CHAN>

Auto Trait Implementations§

§

impl<const CHAN: u8> Freeze for Pit<CHAN>

§

impl<const CHAN: u8> !RefUnwindSafe for Pit<CHAN>

§

impl<const CHAN: u8> !Sync for Pit<CHAN>

§

impl<const CHAN: u8> Unpin for Pit<CHAN>

§

impl<const CHAN: u8> !UnwindSafe for Pit<CHAN>

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.