From 53825a7ee4785912656bba702461873073534395 Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Thu, 1 Feb 2018 20:49:58 +0000 Subject: [PATCH 1/3] Implement simple InputPin trait. --- Cargo.toml | 7 +++++-- src/digital.rs | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ebe2118ea..3ff629aa4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [package] -authors = ["Jorge Aparicio "] +authors = [ + "Jorge Aparicio ", + "Jonathan 'theJPster' Pallant " +] categories = ["asynchronous", "embedded", "hardware-support", "no-std"] description = " A Hardware Abstraction Layer (HAL) for embedded systems " documentation = "https://docs.rs/embedded-hal" @@ -7,7 +10,7 @@ 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" diff --git a/src/digital.rs b/src/digital.rs index a2f3000cd..33dfbae2c 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -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 output pin high? + fn is_high(&self) -> bool; + + /// Is the output pin low? + fn is_low(&self) -> bool; +} From cd5fe0e4655c18121f7b7155527a23d17e1d1adf Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Thu, 1 Feb 2018 20:51:49 +0000 Subject: [PATCH 2/3] Add to prelude. --- src/prelude.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/prelude.rs b/src/prelude.rs index 442723d23..38a553ec3 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -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; From 278145a0d0517d910267a11a83348fe7ed5df7f0 Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Thu, 1 Feb 2018 20:53:07 +0000 Subject: [PATCH 3/3] Typo. --- src/digital.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/digital.rs b/src/digital.rs index 33dfbae2c..9f54c5d1a 100644 --- a/src/digital.rs +++ b/src/digital.rs @@ -17,9 +17,9 @@ pub trait OutputPin { /// Single digital input pin pub trait InputPin { - /// Is the output pin high? + /// Is the input pin high? fn is_high(&self) -> bool; - /// Is the output pin low? + /// Is the input pin low? fn is_low(&self) -> bool; }