diff --git a/embassy/src/time/duration.rs b/embassy/src/time/duration.rs index 1d5ad7542..4bc515c0b 100644 --- a/embassy/src/time/duration.rs +++ b/embassy/src/time/duration.rs @@ -8,7 +8,7 @@ pub struct Duration { } impl Duration { - pub fn into_ticks(&self) -> u32 { + pub const fn into_ticks(&self) -> u32 { self.ticks } diff --git a/embassy/src/time/instant.rs b/embassy/src/time/instant.rs index 9c23d088b..154aa6419 100644 --- a/embassy/src/time/instant.rs +++ b/embassy/src/time/instant.rs @@ -17,7 +17,11 @@ impl Instant { Instant { ticks: now() } } - pub fn into_ticks(&self) -> u64 { + pub const fn from_ticks(ticks: u64) -> Self { + Self { ticks } + } + + pub const fn into_ticks(&self) -> u64 { self.ticks }