Skip to main content

Instance

Trait Instance 

Source
pub trait Instance: Enable + Reset {
Show 14 methods // Required methods fn clk(clocks: &Clocks) -> Hertz; fn set_psc(&mut self, psc: u16); fn read_psc(&self) -> u16; fn set_car(&mut self, car: u16); fn read_car(&self) -> u16; fn read_cnt(&self) -> u16; fn gen_update(&mut self); fn set_cen(&mut self, on: bool); fn set_ups(&mut self, on: bool); fn set_upie(&mut self, on: bool); fn read_upie(&self) -> bool; fn read_upif(&self) -> bool; fn clear_upif(&mut self); unsafe fn steal(&self) -> Self;
}
Expand description

A timer peripheral, tying it to the bus that clocks it.

Required Methods§

Source

fn clk(clocks: &Clocks) -> Hertz

The CK_TIMERx branch feeding this timer, taken from a frozen tree.

Source

fn set_psc(&mut self, psc: u16)

Writes the prescaler, which reaches the counter on the next update event.

Source

fn read_psc(&self) -> u16

Reads back the prescaler dividing the clock into counter ticks.

Source

fn set_car(&mut self, car: u16)

Writes the auto-reload value the counter rolls over at.

Source

fn read_car(&self) -> u16

Reads back the auto-reload value the counter rolls over at.

Source

fn read_cnt(&self) -> u16

Reads the counter, which advances on its own while the timer runs.

Source

fn gen_update(&mut self)

Raises an update event in software, loading the shadowed dividers.

Source

fn set_cen(&mut self, on: bool)

Runs or halts the counter.

Source

fn set_ups(&mut self, on: bool)

Restricts what counts as an update event to overflow/underflow — UPG no longer raises UPIF, only the counter rolling over does.

Source

fn set_upie(&mut self, on: bool)

Lets the update event through to the NVIC. The flag is raised either way.

Source

fn read_upie(&self) -> bool

Whether the update event reaches the NVIC.

Source

fn read_upif(&self) -> bool

Update flag — set by hardware on every rollover, never cleared by it.

Source

fn clear_upif(&mut self)

Clears the update flag.

Source

unsafe fn steal(&self) -> Self

Produces a second handle to the same peripheral.

§Safety

The HAL’s typestate rests on one handle meaning one configuration in flight. Keeping two handles from contradicting each other is on the caller — disjoint registers, or no reconfiguration through both.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Instance for Timer0

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Source§

impl Instance for Timer2

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Source§

impl Instance for Timer5

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Source§

impl Instance for Timer13

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Source§

impl Instance for Timer15

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Source§

impl Instance for Timer16

Source§

fn clk(clocks: &Clocks) -> Hertz

Source§

fn set_psc(&mut self, psc: u16)

Source§

fn read_psc(&self) -> u16

Source§

fn set_car(&mut self, car: u16)

Source§

fn read_car(&self) -> u16

Source§

fn read_cnt(&self) -> u16

Source§

fn gen_update(&mut self)

Source§

fn set_cen(&mut self, on: bool)

Source§

fn set_ups(&mut self, on: bool)

Source§

fn set_upie(&mut self, on: bool)

Source§

fn read_upie(&self) -> bool

Source§

fn read_upif(&self) -> bool

Source§

fn clear_upif(&mut self)

Source§

unsafe fn steal(&self) -> Self

Implementors§