Timer

Struct Timer 

Source
pub struct Timer {}
Expand description

Direct access to the MIPS core timer (CP0 timer) and related interrupt control

Can write to the “compare” register of MIPS core timer and can thus be instantiated only once. Write to the “count” register is not implemented to avoid conflicts with the Delay struct.

Implementations§

Source§

impl Timer

Source

pub fn take() -> Self

Get the Timer singleton. Panics if the singleton is not available.

Source

pub fn free(self)

Return the Timer singleton.

Source

pub fn read_count(&self) -> u32

Read Count register (CP0 register 9, select 0)

Source

pub fn read_compare(&self) -> u32

Read Compare register (CP0 register 11, select 0)

Source

pub fn write_compare(&self, compare: u32)

Write to Compare register (CPP0 register 11, select 0)

Source

pub fn enable_interrupts(&self, int: &INT)

Enable interrupts

Source

pub fn disable_interrupts(&self, int: &INT) -> bool

Disable interrupts and return whether interrupts were previously enabled.

Source

pub fn set_interrupt_prio(&self, int: &INT, prio: u8, subprio: u8)

Set interrupt priority and sub priority. A priority level of 0 is the lowest priority level and disables the interrupts.

Auto Trait Implementations§

§

impl Freeze for Timer

§

impl RefUnwindSafe for Timer

§

impl Send for Timer

§

impl Sync for Timer

§

impl Unpin for Timer

§

impl UnwindSafe for Timer

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.