Skip to content

Commit 80bc5c8

Browse files
committed
Try #11:
2 parents 4d039af + 61a2ef0 commit 80bc5c8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/japaric/linux-embedded-hal"
99
version = "0.2.0"
1010

1111
[dependencies]
12-
embedded-hal = "0.2.0"
12+
embedded-hal = { version = "0.2.0", features = ["unproven"] }
1313
i2cdev = "0.3.1"
1414
spidev = "0.3.0"
1515
sysfs_gpio = "0.5.1"

src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ impl hal::digital::OutputPin for Pin {
119119
}
120120
}
121121

122+
impl hal::digital::InputPin for Pin {
123+
fn is_high(&self) -> bool{
124+
self.0.get_value().unwrap() != 0
125+
}
126+
127+
fn is_low(&self) -> bool{
128+
self.0.get_value().unwrap() == 0
129+
}
130+
}
131+
122132
impl ops::Deref for Pin {
123133
type Target = sysfs_gpio::Pin;
124134

0 commit comments

Comments
 (0)