Struct SystemTimer

Source
pub struct SystemTimer {
    pub alarm0: Alarm,
    pub alarm1: Alarm,
    pub alarm2: Alarm,
}
Available on crate feature unstable only.
Expand description

System Timer driver.

Fields§

§alarm0: Alarm

Alarm 0.

§alarm1: Alarm

Alarm 1.

§alarm2: Alarm

Alarm 2.

Implementations§

Source§

impl SystemTimer

Source

pub const BIT_MASK: u64 = 4_503_599_627_370_495u64

Bitmask to be applied to the raw register value.

Source

pub fn ticks_per_second() -> u64

Returns the tick frequency of the underlying timer unit.

Source

pub fn new(_systimer: SYSTIMER) -> Self

Create a new instance.

Source

pub fn unit_value(unit: Unit) -> u64

Get the current count of the given unit in the System Timer.

Source

pub unsafe fn configure_unit(unit: Unit, config: UnitConfig)

Configures when this counter can run. It can be configured to stall or continue running when CPU stalls or enters on-chip-debugging mode.

§Safety
  • Disabling a Unit whilst Alarms are using it will affect the Alarms operation.
  • Disabling Unit0 will affect Instant::now.
Source

pub unsafe fn set_unit_value(unit: Unit, value: u64)

Set the value of the counter immediately. If the unit is at work, the counter will continue to count up from the new reloaded value.

This can be used to load back the sleep time recorded by RTC timer via software after Light-sleep

§Safety
  • Modifying a unit’s count whilst Alarms are using it may cause unexpected behaviour
  • Any modification of the unit0 count will affect Instant::now

Auto Trait Implementations§

§

impl Freeze for SystemTimer

§

impl RefUnwindSafe for SystemTimer

§

impl Send for SystemTimer

§

impl Sync for SystemTimer

§

impl Unpin for SystemTimer

§

impl UnwindSafe for SystemTimer

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.