Skip to content

Commit 4513004

Browse files
committed
Include pin active low logic
1 parent 61a2ef0 commit 4513004

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,15 @@ impl hal::digital::OutputPin for Pin {
121121

122122
impl hal::digital::InputPin for Pin {
123123
fn is_high(&self) -> bool{
124-
self.0.get_value().unwrap() != 0
124+
if !self.0.get_active_low().unwrap() {
125+
self.0.get_value().unwrap() != 0
126+
} else {
127+
self.0.get_value().unwrap() == 0
128+
}
125129
}
126130

127131
fn is_low(&self) -> bool{
128-
self.0.get_value().unwrap() == 0
132+
!self.is_high()
129133
}
130134
}
131135

0 commit comments

Comments
 (0)