Update to linux-embedded-hal v0.2.1 and remove hackinputpin

This commit is contained in:
Chris
2018-10-30 08:44:51 +01:00
parent 3090637546
commit 40506b580c
6 changed files with 4 additions and 98 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ authors = ["Christoph Groß <christoph-gross@mailbox.org>"]
eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd2in9", "graphics"]}
linux-embedded-hal = "0.2.0"
linux-embedded-hal = "0.2.1"
embedded-graphics = "0.4.3"
+1 -27
View File
@@ -39,35 +39,9 @@ use embedded_hal::prelude::*;
// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore)
use embedded_hal::digital::{InputPin};
//TODO: Remove when linux_embedded_hal implements InputPin
struct HackInputPin<'a> {
pin: &'a Pin
}
//TODO: Remove when linux_embedded_hal implements InputPin
impl<'a> HackInputPin<'a> {
fn new(p : &'a Pin) -> HackInputPin {
HackInputPin {
pin: p
}
}
}
//TODO: Remove when linux_embedded_hal implements InputPin
// for now it defaults to is_low if an error appears
// could be handled better!
impl<'a> InputPin for HackInputPin<'a> {
fn is_low(&self) -> bool {
self.pin.get_value().unwrap_or(0) == 0
}
fn is_high(&self) -> bool {
!self.is_low()
}
}
//TODO: Test this implemenation
//BE CAREFUL: this wasn't tested yet
//TODO: Test this implemenation with a new display
fn main() {
run().unwrap();