pub struct CallbackTimer<T: Send + Sync> { /* private fields */ }
Expand description
A zephyr timer that calls a callback each time the timer expires.
Each time the timer fires, the callback will be called. It is important to note the data
associated with the timer must be both Send
and Sync
. As the callback will be called from
interrupt context, a normal Mutex
cannot be used. For this purpose, there is a SpinMutex
type that protects the data with a spin lock. Other useful things a pass as data to the
callback are Sender
from a bounded channel, and a Semaphore
.
Implementations§
Source§impl<T: Send + Sync> CallbackTimer<T>
impl<T: Send + Sync> CallbackTimer<T>
Sourcepub fn stop(self) -> StoppedTimer
pub fn stop(self) -> StoppedTimer
Stop the timer.
Stops the timer, so that it will not fire any more, converting the timer back into a StoppedTimer.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CallbackTimer<T>where
T: Freeze,
impl<T> !RefUnwindSafe for CallbackTimer<T>
impl<T> !Send for CallbackTimer<T>
impl<T> !Sync for CallbackTimer<T>
impl<T> !Unpin for CallbackTimer<T>
impl<T> UnwindSafe for CallbackTimer<T>where
T: UnwindSafe,
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