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>
impl<const N: usize> SystickDriver<N>
Sourcepub const fn new(systick_freq: u64, reload_value: u32) -> Self
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.
Sourcepub const fn new_default(systick_freq: u64) -> Self
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.
pub fn start(&self, syst: &mut SYST)
Sourcepub fn systick_interrupt(&self)
pub fn systick_interrupt(&self)
Call this from the SysTick interrupt handler.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more