SystickDriver

Struct SystickDriver 

Source
pub struct SystickDriver<const N: usize> { /* private fields */ }
Expand description

Very basic Embassy time driver that uses the SysTick timer.

Wakeups are stored in a fixed-size array

The driver has to be a static instance, create it with:

embassy_time_driver::time_driver_impl!(static DRIVER: SystickDriver<4>
    = SystickDriver::new(48_000_000, 47999));

Implementations§

Source§

impl<const N: usize> SystickDriver<N>

Source

pub const fn new(systick_freq: u64, reload_value: u32) -> Self

SystickDriver constructor.

§Arguments
  • systick_freq - The frequency of the SysTick timer in Hz.
  • reload_value - The reload value for the SysTick timer.

Note the tick frequency is configured to embassy_time_driver::TICK_HZ.

Source

pub const fn new_default(systick_freq: u64) -> Self

Create a new SystickDriver with a default reload value that matches the interrupt frequency to embassy_time_driver::TICK_HZ.

The default reload value is calculated as (systick_freq / embassy_time_driver::TICK_HZ) - 1.

§Arguments
  • systick_freq - The frequency of the SysTick timer in Hz.
Source

pub fn start(&self, syst: &mut SYST)

Source

pub fn systick_interrupt(&self)

Call this from the SysTick interrupt handler.

Trait Implementations§

Source§

impl<const N: usize> Driver for SystickDriver<N>

Source§

fn now(&self) -> u64

Return the current timestamp in ticks. Read more
Source§

fn schedule_wake(&self, at: u64, waker: &Waker)

Schedules a waker to be awoken at moment at. If this moment is in the past, the waker might be awoken immediately.

Auto Trait Implementations§

§

impl<const N: usize> !Freeze for SystickDriver<N>

§

impl<const N: usize> !RefUnwindSafe for SystickDriver<N>

§

impl<const N: usize> Send for SystickDriver<N>

§

impl<const N: usize> Sync for SystickDriver<N>

§

impl<const N: usize> Unpin for SystickDriver<N>

§

impl<const N: usize> UnwindSafe for SystickDriver<N>

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.