Struct SysTickCalibration

Source
pub struct SysTickCalibration {
    pub ticks_per_ms: u32,
}
Expand description

Configuration information for setting the SysTick reload value.

Fields§

§ticks_per_ms: u32

The number of ticks of the SysTick’s clock source to get to 1ms.

Note that reload values should typically be one fewer than the number of clock cycles, since an extra one is always needed to detect the rollover and reload the counter.

Implementations§

Source§

impl SysTickCalibration

Source

pub fn built_in() -> Option<SysTickCalibration>

Gets the calibration from the chip’s built-in “ticks per 10ms” value.

Returns an Option because this value is is not present on all devices (SAMD51 for example seems to not have it, since its processor speed is configurable). In those cases, use from_clock_hz instead.

Source

pub fn from_clock_hz(hz: u32) -> SysTickCalibration

Creates a calibration from the underlying frequency of the clock that drives SysTick. This typically seems to be the same frequency that the processor is currently running at.

For SAMD51 processors, if you don’t want to hard-code a known size, you can get this from the gclck0 frequency.

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> Same for T

Source§

type Output = T

Should always be Self
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.