Struct RegisterBlock

Source
#[repr(C)]
pub struct RegisterBlock {
Show 21 fields pub cr1: u32, pub cr2: u32, pub smcr: u32, pub dier: u32, pub sr: u32, pub egr: u32, pub ccmr1: u32, pub ccmr2: u32, pub ccer: u32, pub cnt: u32, pub psc: u32, pub arr: u32, _reserved0: u32, pub ccr1: u32, pub ccr2: u32, pub ccr3: u32, pub ccr4: u32, _reserved1: u32, pub dcr: u32, pub dmar: u32, pub or: u32,
}

Fields§

§cr1: u32§cr2: u32§smcr: u32§dier: u32§sr: u32§egr: u32§ccmr1: u32§ccmr2: u32§ccer: u32§cnt: u32§psc: u32§arr: u32§_reserved0: u32§ccr1: u32§ccr2: u32§ccr3: u32§ccr4: u32§_reserved1: u32§dcr: u32§dmar: u32§or: u32

Implementations§

Source§

impl RegisterBlock

Source

pub fn enable(&mut self)

Enable timer

Source

pub fn disable(&mut self)

Disable timer

Source

pub fn set_direction(&mut self, direction: TimerDirection)

Set direction (up/down counting)

Source

pub fn set_prescaler(&mut self, prescaler: u16)

Set prescaler value

Source

pub fn set_auto_reload(&mut self, arr: u32)

Set auto-reload value

Source

pub fn get_counter(&self) -> u32

Get current counter value

Source

pub fn set_counter(&mut self, value: u32)

Set counter value

Source

pub fn enable_update_interrupt(&mut self)

Enable update interrupt

Source

pub fn disable_update_interrupt(&mut self)

Disable update interrupt

Source

pub fn is_update_interrupt_pending(&self) -> bool

Check if update interrupt flag is set

Source

pub fn clear_update_interrupt(&mut self)

Clear update interrupt flag

Source

pub fn generate_update(&mut self)

Generate update event

Source

pub fn set_ccr1(&mut self, value: u32)

Set capture/compare value for channel 1

Source

pub fn set_ccr2(&mut self, value: u32)

Set capture/compare value for channel 2

Source

pub fn set_ccr3(&mut self, value: u32)

Set capture/compare value for channel 3

Source

pub fn set_ccr4(&mut self, value: u32)

Set capture/compare value for channel 4

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.