pub struct TimerHandle(/* private fields */);Expand description
A timer handle.
This handle is used to interact with timers created by the driver implementation.
Implementations§
Source§impl TimerHandle
impl TimerHandle
Sourcepub unsafe fn new(
function: unsafe extern "C" fn(*mut c_void),
data: *mut c_void,
) -> Self
pub unsafe fn new( function: unsafe extern "C" fn(*mut c_void), data: *mut c_void, ) -> Self
Creates a new timer instance from the given callback.
§Safety
- The callback and its data must be valid for the lifetime of the timer.
- The callback and its data need to be able to be sent across threads.
Sourcepub unsafe fn from_ptr(ptr: TimerPtr) -> Self
pub unsafe fn from_ptr(ptr: TimerPtr) -> Self
Recovers the object from a leaked pointer.
§Safety
- The caller must only use pointers created using
Self::leak. - The caller must ensure the pointer is not shared.
Sourcepub unsafe fn ref_from_ptr(ptr: &TimerPtr) -> &Self
pub unsafe fn ref_from_ptr(ptr: &TimerPtr) -> &Self
Creates a reference to this object from a leaked pointer.
This function is used in the esp-radio code to interact with the timer.
§Safety
- The caller must only use pointers created using
Self::leak.