Skip to content

Add InputPin trait #36

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

Merged
merged 3 commits into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[package]
authors = ["Jorge Aparicio <[email protected]>"]
authors = [
"Jorge Aparicio <[email protected]>",
"Jonathan 'theJPster' Pallant <[email protected]>"
]
categories = ["asynchronous", "embedded", "hardware-support", "no-std"]
description = " A Hardware Abstraction Layer (HAL) for embedded systems "
documentation = "https://docs.rs/embedded-hal"
keywords = ["hal", "IO"]
license = "MIT OR Apache-2.0"
name = "embedded-hal"
repository = "https://github.com/japaric/embedded-hal"
version = "0.1.0"
version = "0.1.1"

[dependencies.nb]
version = "0.1.1"
Expand Down
9 changes: 9 additions & 0 deletions src/digital.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ pub trait OutputPin {
/// Sets the pin high
fn set_high(&mut self);
}

/// Single digital input pin
pub trait InputPin {
/// Is the input pin high?
fn is_high(&self) -> bool;

/// Is the input pin low?
fn is_low(&self) -> bool;
}
1 change: 1 addition & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub use ::timer::CountDown as _embedded_hal_timer_CountDown;
pub use ::blocking::delay::DelayMs as _embedded_hal_blocking_delay_DelayMs;
pub use ::blocking::delay::DelayUs as _embedded_hal_blocking_delay_DelayUs;
pub use ::digital::OutputPin as _embedded_hal_digital_OutputPin;
pub use ::digital::InputPin as _embedded_hal_digital_InputPin;
pub use ::serial::Read as _embedded_hal_serial_Read;
pub use ::serial::Write as _embedded_hal_serial_Write;
pub use ::spi::FullDuplex as _embedded_hal_spi_FullDuplex;