update to hal v2 traits

This commit is contained in:
Eric Trombly 2020-02-26 11:39:39 -06:00
parent 38789231ef
commit 333edf10f0
3 changed files with 18 additions and 15 deletions

View file

@ -18,23 +18,23 @@ travis-ci = { repository = "wezm/ssd1675" }
codecov = { repository = "wezm/ssd1675" } codecov = { repository = "wezm/ssd1675" }
[dependencies] [dependencies]
libm = "0.1.2" libm = "0.2.1"
[dependencies.embedded-hal] [dependencies.embedded-hal]
features = ["unproven"] features = ["unproven"]
version = "0.2.2" version = "0.2.3"
[dependencies.embedded-graphics] [dependencies.embedded-graphics]
optional = true optional = true
version = "0.4.4" version = "0.5.2"
[dependencies.linux-embedded-hal] [dependencies.linux-embedded-hal]
optional = true optional = true
version = "0.2.1" version = "0.3.0"
[dependencies.profont] [dependencies.profont]
optional = true optional = true
version = "0.1" version = "0.3.0"
[features] [features]
default = ["graphics"] default = ["graphics"]

View file

@ -153,7 +153,7 @@ where
{ {
fn draw<T>(&mut self, item_pixels: T) fn draw<T>(&mut self, item_pixels: T)
where where
T: Iterator<Item = Pixel<Color>>, T: IntoIterator<Item = Pixel<Color>>,
{ {
for Pixel(UnsignedCoord(x, y), colour) in item_pixels { for Pixel(UnsignedCoord(x, y), colour) in item_pixels {
if outside_display( if outside_display(

View file

@ -96,10 +96,10 @@ pub struct Interface<SPI, CS, BUSY, DC, RESET> {
impl<SPI, CS, BUSY, DC, RESET> Interface<SPI, CS, BUSY, DC, RESET> impl<SPI, CS, BUSY, DC, RESET> Interface<SPI, CS, BUSY, DC, RESET>
where where
SPI: hal::blocking::spi::Write<u8>, SPI: hal::blocking::spi::Write<u8>,
CS: hal::digital::OutputPin, CS: hal::digital::v2::OutputPin,
BUSY: hal::digital::InputPin, BUSY: hal::digital::v2::InputPin,
DC: hal::digital::OutputPin, DC: hal::digital::v2::OutputPin,
RESET: hal::digital::OutputPin, RESET: hal::digital::v2::OutputPin,
{ {
/// Create a new Interface from embedded hal traits. /// Create a new Interface from embedded hal traits.
pub fn new(spi: SPI, cs: CS, busy: BUSY, dc: DC, reset: RESET) -> Self { pub fn new(spi: SPI, cs: CS, busy: BUSY, dc: DC, reset: RESET) -> Self {
@ -136,10 +136,10 @@ where
impl<SPI, CS, BUSY, DC, RESET> DisplayInterface for Interface<SPI, CS, BUSY, DC, RESET> impl<SPI, CS, BUSY, DC, RESET> DisplayInterface for Interface<SPI, CS, BUSY, DC, RESET>
where where
SPI: hal::blocking::spi::Write<u8>, SPI: hal::blocking::spi::Write<u8>,
CS: hal::digital::OutputPin, CS: hal::digital::v2::OutputPin,
BUSY: hal::digital::InputPin, BUSY: hal::digital::v2::InputPin,
DC: hal::digital::OutputPin, DC: hal::digital::v2::OutputPin,
RESET: hal::digital::OutputPin, RESET: hal::digital::v2::OutputPin,
{ {
type Error = SPI::Error; type Error = SPI::Error;
@ -164,6 +164,9 @@ where
} }
fn busy_wait(&self) { fn busy_wait(&self) {
while self.busy.is_high() {} while match self.busy.is_high() {
Ok(x) => x,
_ => false,
} {}
} }
} }