aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Edward Gagnon <[email protected]>2024-11-02 16:03:17 -0400
committerGitHub <[email protected]>2024-11-02 16:03:17 -0400
commit1434d2f97a48f29cbe480a4d306ecf8716b1b2d4 (patch)
treec8e35cd459e421054b226ed19119b1359fd923ba
parentfcbbef01cd3c5292be29b78b674f0593277545e7 (diff)
enhanced docs for time driver
-rw-r--r--embassy-time-driver/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-time-driver/src/lib.rs b/embassy-time-driver/src/lib.rs
index 8000a9dcb..75f7037e3 100644
--- a/embassy-time-driver/src/lib.rs
+++ b/embassy-time-driver/src/lib.rs
@@ -109,12 +109,20 @@ pub trait Driver: Send + Sync + 'static {
109 /// Try allocating an alarm handle. Returns None if no alarms left. 109 /// Try allocating an alarm handle. Returns None if no alarms left.
110 /// Initially the alarm has no callback set, and a null `ctx` pointer. 110 /// Initially the alarm has no callback set, and a null `ctx` pointer.
111 /// 111 ///
112 /// The allocated alarm is a reusable resource and can be used multiple times.
113 /// Once the alarm has fired, it remains allocated and can be set again without needing
114 /// to be reallocated.
115 ///
112 /// # Safety 116 /// # Safety
113 /// It is UB to make the alarm fire before setting a callback. 117 /// It is UB to make the alarm fire before setting a callback.
114 unsafe fn allocate_alarm(&self) -> Option<AlarmHandle>; 118 unsafe fn allocate_alarm(&self) -> Option<AlarmHandle>;
115 119
116 /// Set the callback function to be called when the alarm triggers. 120 /// Set the callback function to be called when the alarm triggers.
117 /// The callback may be called from any context (interrupt or thread mode). 121 /// The callback may be called from any context (interrupt or thread mode).
122 ///
123 /// The callback is maintained after the alarm has fired. Callers do not need
124 /// to set a callback again before setting another alarm, unless they want to
125 /// change the callback function or context.
118 fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()); 126 fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ());
119 127
120 /// Set an alarm at the given timestamp. 128 /// Set an alarm at the given timestamp.