From a2d35c4e1c47e8025ea9ab2bfff7b2f7af653c9d Mon Sep 17 00:00:00 2001 From: YuhanLiin <linyuhan0315@hotmail.com> Date: Sat, 4 Jan 2020 01:12:58 -0500 Subject: [PATCH] Add CapturePin trait --- src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 13c0d8bd7..282ce36a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -795,6 +795,26 @@ pub trait Capture { R: Into<Self::Time>; } +/// A single input capture channel / pin +/// +/// See `Capture` for details +#[cfg(feature = "unproven")] +pub trait CapturePin { + /// Type of value returned by capture + type Capture; + /// Enumeration of `Capture` errors + /// + /// Possible errors: + /// + /// - *overcapture*, the previous capture value was overwritten because it + /// was not read in a timely manner + type Error; + + /// "Waits" for a transition in the capture `channel` and returns the value + /// of counter at that instant + fn capture(&mut self) -> nb::Result<Self::Capture, Self::Error>; +} + /// Pulse Width Modulation /// /// *This trait is available if embedded-hal is built with the `"unproven"` feature.*