Trait kernel::systick::SysTick [] [src]

pub trait SysTick {
    fn set_timer(&self, us: u32);
fn value(&self) -> u32;
fn overflowed(&self) -> bool;
fn reset(&self);
fn enable(&self, with_interrupt: bool); }

Interface for the system tick timer.

A system tick timer provides a countdown timer to enforce process scheduling quantums. Implementations should have consistent timing while the CPU is active, but need not operate during sleep.

On most chips, this will be implemented by the core (e.g. the ARM core), but some chips lack this optional peripheral, in which case it might be implemented by another timer or alarm controller.

Required Methods

Sets the timer as close as possible to the given interval in microseconds.

Callers can assume at least a 24-bit wide clock. Specific timing is dependent on the driving clock. In practice, increments of 10ms are most accurate and values up to 400ms are valid.

Returns the time left in microseconds

Returns true if the timer has expired

Resets the timer

Resets the timer to 0 and disables it

Enables the timer

Enabling the timer will begin a count down from the value set with set_timer.

  • with_interrupt - if set, an expiring timer will fire an interrupt.