Trait avr_oxide::hal::generic::timer::TimerControl

source ·
pub trait TimerControl {
    // Required methods
    fn set_interrupt_period(&mut self, period: u16);
    fn set_mode(&mut self, mode: TimerMode);
    fn set_count_max(&mut self, max: u16);
    fn start(&self, handler: TimerIsrCallback);
    fn stop(&self);
    fn get_count(&self) -> u16;
    fn reset_count(&mut self);
}

Required Methods§

source

fn set_interrupt_period(&mut self, period: u16)

Set the period (number of underlying timer interrupts) that trigger an interrupt callback (i.e. if 10, every 10 timer events the callback passed to start() will be called.)

source

fn set_mode(&mut self, mode: TimerMode)

Set the clock’s mode

source

fn set_count_max(&mut self, max: u16)

Set the clock’s counter trigger

source

fn start(&self, handler: TimerIsrCallback)

Start this timer. The given callback will be called periodically when timer interrupts occur (see the interrupting(period) method.)

If the timer is in a constant-run mode (e.g. TimerMode::Periodic), it will run constantly until either stopped (with the stop() method!) or until the callback function returns false.

source

fn stop(&self)

Stop this timer

source

fn get_count(&self) -> u16

Get the timer’s current count value

source

fn reset_count(&mut self)

Reset the timer’s current count value

Implementors§