GenericTimer

Trait GenericTimer 

Source
pub trait GenericTimer {
Show 14 methods // Required methods fn frequency_hz(&self) -> u32; fn counter(&self) -> u64; fn counter_compare(&self) -> u64; fn counter_compare_set(&mut self, value: u64); fn countdown(&self) -> u32; fn countdown_set(&mut self, duration_ticks: u32); fn enabled(&self) -> bool; fn enable(&self, enabled: bool); fn interrupt_masked(&self) -> bool; fn interrupt_mask(&mut self, mask: bool); fn interrupt_status(&self) -> bool; // Provided methods fn delay_ticks(&mut self, ticks: u32) { ... } fn delay_ms(&mut self, ms: u32) { ... } fn delay_us(&mut self, us: u32) { ... }
}
Expand description

Describes either a Physical or Virtual timer

Required Methods§

Source

fn frequency_hz(&self) -> u32

Get the timer frequency

Source

fn counter(&self) -> u64

Get the current counter value.

This is a 64-bit value that goes up. It can be used to measure the passing of time.

Note that speculative reads are allowed and reads may occur out of order. Add ISB and DSB fences before/after this call as required.

Source

fn counter_compare(&self) -> u64

Get the counter compare value.

Source

fn counter_compare_set(&mut self, value: u64)

Set the counter compare value.

The timer condition is met when the counter - compare_value >= 0. This therefore operates as a count-up timer.

Source

fn countdown(&self) -> u32

Get the current value of the countdown timer.

Source

fn countdown_set(&mut self, duration_ticks: u32)

Set the value of the count-down timer.

Sets a value which is decremented on every counter tick. When it reaches zero, the timer fires.

Source

fn enabled(&self) -> bool

This is timer enabled?

Source

fn enable(&self, enabled: bool)

Enable/disable this timer

Source

fn interrupt_masked(&self) -> bool

Is this timer’s interrupt masked?

Source

fn interrupt_mask(&mut self, mask: bool)

Mask (or unmask) this timer’s interrupt.

Source

fn interrupt_status(&self) -> bool

Has this timer’s interrupt fired?

Provided Methods§

Source

fn delay_ticks(&mut self, ticks: u32)

Wait for some number of clock ticks

Source

fn delay_ms(&mut self, ms: u32)

Delay for some number of milliseconds

Source

fn delay_us(&mut self, us: u32)

Delay for some number of microseconds

Implementors§