|
|
|
|
@ -1,8 +1,7 @@
|
|
|
|
|
use crate::epd7in5_v2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH}; |
|
|
|
|
use crate::graphics::{Display, DisplayRotation}; |
|
|
|
|
use embedded_graphics::pixelcolor::BinaryColor; |
|
|
|
|
use embedded_graphics::prelude::*; |
|
|
|
|
use embedded_graphics_core::OriginDimension; |
|
|
|
|
use embedded_graphics_core::prelude::*; |
|
|
|
|
|
|
|
|
|
/// Full size buffer for use with the 7in5 EPD
|
|
|
|
|
///
|
|
|
|
|
@ -27,8 +26,20 @@ impl DrawTarget for Display7in5 {
|
|
|
|
|
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 Display7in5 { |
|
|
|
|
fn size(&self) -> Size { |
|
|
|
|
Size::new(WIDTH, HEIGHT) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -50,19 +61,16 @@ impl Display for Display7in5 {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl OriginDimension for Display7in5 { |
|
|
|
|
fn size(&self) -> Size { |
|
|
|
|
Size::new(WIDTH, HEIGHT) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
|
mod tests { |
|
|
|
|
use super::*; |
|
|
|
|
use crate::color::{Black, Color}; |
|
|
|
|
use crate::epd7in5_v2; |
|
|
|
|
use crate::graphics::{Display, DisplayRotation}; |
|
|
|
|
use embedded_graphics::{primitives::Line, style::PrimitiveStyle}; |
|
|
|
|
use embedded_graphics::{ |
|
|
|
|
prelude::*, |
|
|
|
|
primitives::{Line, PrimitiveStyle}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// test buffer length
|
|
|
|
|
#[test] |
|
|
|
|
|