From a83f3946bb68d7c6bae61235090a0168752e4b86 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Sun, 2 May 2021 17:33:04 +0200 Subject: [PATCH] Add trait for count down times that allow reading out elapsed time --- src/timer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/timer.rs b/src/timer.rs index e2b3b5c39..fd55ee6cb 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -79,6 +79,12 @@ pub trait CountDown { fn wait(&mut self) -> nb::Result<(), Self::Error>; } +/// A count down timer that allows reading out elapsed time since start. +pub trait Elapsed: CountDown { + /// The units of time that elapsed since the timer was started. + fn elapsed(&self) -> Result; +} + /// Marker trait that indicates that a timer is periodic pub trait Periodic {}