diff options
author | 2022-09-27 20:47:13 +0200 | |
---|---|---|
committer | 2022-09-27 20:47:13 +0200 | |
commit | 4ccc7d3dcb84f7f8e6556a4cd52efc18df1dc887 (patch) | |
tree | 55171809c3438aec5f8040f8944909114e565f12 /macros/src/codegen | |
parent | ecf5e6e3345ce620513950fa0ad14aac1d8fd079 (diff) | |
download | rtic-4ccc7d3dcb84f7f8e6556a4cd52efc18df1dc887.tar.gz rtic-4ccc7d3dcb84f7f8e6556a4cd52efc18df1dc887.tar.zst rtic-4ccc7d3dcb84f7f8e6556a4cd52efc18df1dc887.zip |
Add `delay_until` a specific time
Diffstat (limited to 'macros/src/codegen')
-rw-r--r-- | macros/src/codegen/monotonic.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/macros/src/codegen/monotonic.rs b/macros/src/codegen/monotonic.rs index ad69af94..1aa11820 100644 --- a/macros/src/codegen/monotonic.rs +++ b/macros/src/codegen/monotonic.rs @@ -46,6 +46,8 @@ pub fn codegen(app: &App, _analysis: &Analysis, _extra: &Extra) -> TokenStream2 #[doc(inline)] pub use #m::delay; #[doc(inline)] + pub use #m::delay_until; + #[doc(inline)] pub use #m::timeout_at; #[doc(inline)] pub use #m::timeout_after; @@ -81,6 +83,15 @@ pub fn codegen(app: &App, _analysis: &Analysis, _extra: &Extra) -> TokenStream2 DelayFuture { until, waker_storage: None } } + /// Delay until a specific time + #[inline(always)] + #[allow(non_snake_case)] + pub fn delay_until(instant: <super::super::#m as rtic::Monotonic>::Instant) + -> DelayFuture { + let until = instant; + DelayFuture { until, waker_storage: None } + } + /// Delay future. #[allow(non_snake_case)] #[allow(non_camel_case_types)] |