mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
migrate minimum set of drivers to make tests pass
This commit is contained in:
+13
-5
@@ -1,7 +1,7 @@
|
||||
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||
use crate::graphics::{Display, DisplayRotation};
|
||||
use embedded_graphics::pixelcolor::BinaryColor;
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics_core::prelude::*;
|
||||
|
||||
/// Display with Fullsize buffer for use with the 2in9 EPD
|
||||
///
|
||||
@@ -22,13 +22,21 @@ impl Default for Display2in9 {
|
||||
}
|
||||
}
|
||||
|
||||
impl DrawTarget<BinaryColor> for Display2in9 {
|
||||
impl DrawTarget for Display2in9 {
|
||||
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 Display2in9 {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
}
|
||||
|
||||
+6
-2
@@ -7,7 +7,7 @@
|
||||
//!# use embedded_hal_mock::*;
|
||||
//!# fn main() -> Result<(), MockError> {
|
||||
//!use embedded_graphics::{
|
||||
//! pixelcolor::BinaryColor::On as Black, prelude::*, primitives::Line, style::PrimitiveStyle,
|
||||
//! pixelcolor::BinaryColor::On as Black, prelude::*, primitives::{Line, PrimitiveStyleBuilder},
|
||||
//!};
|
||||
//!use epd_waveshare::{epd2in9::*, prelude::*};
|
||||
//!#
|
||||
@@ -27,8 +27,12 @@
|
||||
//!let mut display = Display2in9::default();
|
||||
//!
|
||||
//!// Use embedded graphics for drawing a line
|
||||
//!let style = PrimitiveStyleBuilder::new()
|
||||
//! .stroke_color(Black)
|
||||
//! .stroke_width(1)
|
||||
//! .build();
|
||||
//!let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
||||
//! .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
||||
//! .into_styled(style)
|
||||
//! .draw(&mut display);
|
||||
//!
|
||||
//! // Display updated frame
|
||||
|
||||
Reference in New Issue
Block a user