diff --git a/src/lib.rs b/src/lib.rs index d7d9ca8..4277436 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -276,13 +276,13 @@ where } } -#[cfg(feature = "graphics")] -use embedded_graphics::Drawing; #[cfg(feature = "graphics")] use embedded_graphics::drawable; +#[cfg(feature = "graphics")] +use embedded_graphics::{drawable::Pixel, pixelcolor::PixelColorU16, Drawing}; #[cfg(feature = "graphics")] -impl Drawing for Ili9341 +impl Drawing for Ili9341 where SPI: spi::Transfer + spi::Write, CS: OutputPin, @@ -292,16 +292,21 @@ where { fn draw(&mut self, item_pixels: T) where - T: Iterator, + T: Iterator>, { - for (pos, color) in item_pixels { + for Pixel(pos, color) in item_pixels { self.draw_raw( pos.0 as u16, pos.1 as u16, pos.0 as u16, pos.1 as u16, - if color == 0 { &[0xff,0xff] } else { &[0,0] }, - ).expect("Failed to communicate with device"); + if color == PixelColorU16(0) { + &[0xff, 0xff] + } else { + &[0, 0] + }, + ) + .expect("Failed to communicate with device"); } } }