pub struct Timer0 { /* private fields */ }Implementations§
Source§impl Timer0
impl Timer0
Sourcepub const fn new(ticks_per_s: u32) -> Self
pub const fn new(ticks_per_s: u32) -> Self
Constructs the Timer0 driver.
ticks_per_s should be the clock speed of the core, in Hertz
Sourcepub fn enable_interrupt(&mut self)
pub fn enable_interrupt(&mut self)
Enable the Timer0 interrupt source
Define the ISR using the riscv_rt::external_interrupt attribute
Sourcepub fn disable_interrupt(&mut self)
pub fn disable_interrupt(&mut self)
Disable the Timer0 interrupt source
Sourcepub fn set_periodic(&mut self, period_ns: u32)
pub fn set_periodic(&mut self, period_ns: u32)
Set the timer to fire periodically
Sourcepub fn event_pending(&self) -> bool
pub fn event_pending(&self) -> bool
Check for a pending event
Sourcepub fn clear_event(&self)
pub fn clear_event(&self)
Clear the pending event flag
Trait Implementations§
Source§impl DelayNs for Timer0
impl DelayNs for Timer0
Source§fn delay_ns(&mut self, ns: u32)
fn delay_ns(&mut self, ns: u32)
Pauses execution for at minimum
ns nanoseconds. Pause can be longer
if the implementation requires it due to precision/timing issues.impl Send for Timer0
Auto Trait Implementations§
impl !RefUnwindSafe for Timer0
impl !Sync for Timer0
impl !UnwindSafe for Timer0
impl Freeze for Timer0
impl Unpin for Timer0
impl UnsafeUnpin for Timer0
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