Trait nrf52833_hal::timer::Instance

source ·
pub trait Instance: Sealed {
    const INTERRUPT: Interrupt;

    // Required method
    fn as_timer0(&self) -> &RegisterBlock;

    // Provided methods
    fn timer_start<Time>(&self, cycles: Time)
       where Time: Into<u32> { ... }
    fn timer_reset_event(&self) { ... }
    fn timer_cancel(&self) { ... }
    fn timer_running(&self) -> bool { ... }
    fn read_counter(&self) -> u32 { ... }
    fn disable_interrupt(&self) { ... }
    fn enable_interrupt(&self) { ... }
    fn set_shorts_periodic(&self) { ... }
    fn set_shorts_oneshot(&self) { ... }
    fn set_periodic(&self) { ... }
    fn set_oneshot(&self) { ... }
}
Expand description

Implemented by all TIMER* instances.

Required Associated Constants§

source

const INTERRUPT: Interrupt

The interrupt associated with this RTC instance.

Required Methods§

source

fn as_timer0(&self) -> &RegisterBlock

Returns the register block for the timer instance.

Provided Methods§

source

fn timer_start<Time>(&self, cycles: Time)
where Time: Into<u32>,

Starts the timer after clearing the counter register and setting the events compare trigger correctly to the numer of cycles.

source

fn timer_reset_event(&self)

Resets event for CC[0] register.

source

fn timer_cancel(&self)

Cancels timer by setting it to stop mode and resetting the events.

source

fn timer_running(&self) -> bool

Checks if the timer is still running which means no event is yet generated for CC[0].

source

fn read_counter(&self) -> u32

source

fn disable_interrupt(&self)

Disables interrupt for event COMPARE[0].

source

fn enable_interrupt(&self)

Enables interrupt for event COMPARE[0].

source

fn set_shorts_periodic(&self)

Sets timer into periodic mode.

source

fn set_shorts_oneshot(&self)

Sets timer into oneshot mode.

source

fn set_periodic(&self)

Sets up timer for 1 MHz prescaled periods with 32 bits accuracy.

This is only safe to call when the timer is stopped.

source

fn set_oneshot(&self)

Sets up timer for a 1 MHz prescaled oneshot with 32 bits accuracy.

This is only safe to call when the timer is stopped.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Instance for TIMER0

source§

const INTERRUPT: Interrupt = Interrupt::TIMER0

source§

impl Instance for TIMER1

source§

const INTERRUPT: Interrupt = Interrupt::TIMER1

source§

impl Instance for TIMER2

source§

const INTERRUPT: Interrupt = Interrupt::TIMER2

source§

impl Instance for TIMER3

source§

const INTERRUPT: Interrupt = Interrupt::TIMER3

source§

impl Instance for TIMER4

source§

const INTERRUPT: Interrupt = Interrupt::TIMER4