aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src/timer.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-01-11 22:47:05 +0100
committerDario Nieuwenhuis <[email protected]>2024-01-11 23:01:24 +0100
commitf0606da9adc8032cc92c06c0661b385742459fc8 (patch)
treeccff465740429fa86f3455312ae02eab1170f8d4 /embassy-time/src/timer.rs
parentb3ab2d91f7ed48e6a377661e7e504cb0ae0091a3 (diff)
time: split queue driver too, don't reexport drivers.
Diffstat (limited to 'embassy-time/src/timer.rs')
-rw-r--r--embassy-time/src/timer.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs
index 2705ba03f..565a65cb8 100644
--- a/embassy-time/src/timer.rs
+++ b/embassy-time/src/timer.rs
@@ -1,6 +1,6 @@
1use core::future::{poll_fn, Future}; 1use core::future::{poll_fn, Future};
2use core::pin::Pin; 2use core::pin::Pin;
3use core::task::{Context, Poll, Waker}; 3use core::task::{Context, Poll};
4 4
5use futures_util::future::{select, Either}; 5use futures_util::future::{select, Either};
6use futures_util::stream::FusedStream; 6use futures_util::stream::FusedStream;
@@ -116,7 +116,7 @@ impl Future for Timer {
116 if self.yielded_once && self.expires_at <= Instant::now() { 116 if self.yielded_once && self.expires_at <= Instant::now() {
117 Poll::Ready(()) 117 Poll::Ready(())
118 } else { 118 } else {
119 schedule_wake(self.expires_at, cx.waker()); 119 embassy_time_queue_driver::schedule_wake(self.expires_at.as_ticks(), cx.waker());
120 self.yielded_once = true; 120 self.yielded_once = true;
121 Poll::Pending 121 Poll::Pending
122 } 122 }
@@ -185,7 +185,7 @@ impl Ticker {
185 self.expires_at += dur; 185 self.expires_at += dur;
186 Poll::Ready(()) 186 Poll::Ready(())
187 } else { 187 } else {
188 schedule_wake(self.expires_at, cx.waker()); 188 embassy_time_queue_driver::schedule_wake(self.expires_at.as_ticks(), cx.waker());
189 Poll::Pending 189 Poll::Pending
190 } 190 }
191 }) 191 })
@@ -202,7 +202,7 @@ impl Stream for Ticker {
202 self.expires_at += dur; 202 self.expires_at += dur;
203 Poll::Ready(Some(())) 203 Poll::Ready(Some(()))
204 } else { 204 } else {
205 schedule_wake(self.expires_at, cx.waker()); 205 embassy_time_queue_driver::schedule_wake(self.expires_at.as_ticks(), cx.waker());
206 Poll::Pending 206 Poll::Pending
207 } 207 }
208 } 208 }
@@ -214,11 +214,3 @@ impl FusedStream for Ticker {
214 false 214 false
215 } 215 }
216} 216}
217
218extern "Rust" {
219 fn _embassy_time_schedule_wake(at: Instant, waker: &Waker);
220}
221
222fn schedule_wake(at: Instant, waker: &Waker) {
223 unsafe { _embassy_time_schedule_wake(at, waker) }
224}