Add delay_until a specific time

This commit is contained in:
Emil Fresk 2022-09-27 20:47:13 +02:00
parent ecf5e6e334
commit 4ccc7d3dcb

View file

@ -46,6 +46,8 @@ pub fn codegen(app: &App, _analysis: &Analysis, _extra: &Extra) -> TokenStream2
#[doc(inline)] #[doc(inline)]
pub use #m::delay; pub use #m::delay;
#[doc(inline)] #[doc(inline)]
pub use #m::delay_until;
#[doc(inline)]
pub use #m::timeout_at; pub use #m::timeout_at;
#[doc(inline)] #[doc(inline)]
pub use #m::timeout_after; pub use #m::timeout_after;
@ -81,6 +83,15 @@ pub fn codegen(app: &App, _analysis: &Analysis, _extra: &Extra) -> TokenStream2
DelayFuture { until, waker_storage: None } 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. /// Delay future.
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]