Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CapturePin trait #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
ryankurte marked this conversation as resolved.
Show resolved Hide resolved
}

/// Pulse Width Modulation
///
/// *This trait is available if embedded-hal is built with the `"unproven"` feature.*
Expand Down