Migrate remaining drivers

This commit is contained in:
Reinier Balt
2021-06-16 17:36:12 +02:00
parent feac908558
commit 6a10e0cb96
17 changed files with 146 additions and 58 deletions
+15 -4
View File
@@ -1,7 +1,7 @@
use crate::epd2in7b::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
use crate::graphics::{Display, DisplayRotation};
use embedded_graphics::pixelcolor::BinaryColor;
use embedded_graphics::prelude::*;
use embedded_graphics_core::prelude::*;
/// Full size buffer for use with the 2in7B EPD
///
@@ -26,10 +26,18 @@ impl DrawTarget for Display2in7b {
type Color = BinaryColor;
type Error = core::convert::Infallible;
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
self.draw_helper(WIDTH, HEIGHT, pixel)
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
where
I: IntoIterator<Item = Pixel<Self::Color>>,
{
for pixel in pixels {
self.draw_helper(WIDTH, HEIGHT, pixel)?;
}
Ok(())
}
}
impl OriginDimensions for Display2in7b {
fn size(&self) -> Size {
Size::new(WIDTH, HEIGHT)
}
@@ -61,7 +69,10 @@ mod tests {
use crate::epd2in7b;
use crate::epd2in7b::{HEIGHT, WIDTH};
use crate::graphics::{Display, DisplayRotation};
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
use embedded_graphics::{
prelude::*,
primitives::{Line, PrimitiveStyle},
};
// test buffer length
#[test]