mirror of
https://github.com/Anshorei/epd-waveshare.git
synced 2026-10-03 22:06:43 +00:00
Migrate remaining drivers
This commit is contained in:
@@ -25,6 +25,7 @@ impl Default for Display1in54 {
|
||||
impl DrawTarget for Display1in54 {
|
||||
type Color = BinaryColor;
|
||||
type Error = core::convert::Infallible;
|
||||
|
||||
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||
where
|
||||
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::epd1in54b::{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 1in54 EPD
|
||||
///
|
||||
@@ -25,10 +25,18 @@ impl DrawTarget for Display1in54b {
|
||||
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 Display1in54b {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::epd1in54c::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, 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 1in54c EPD
|
||||
///
|
||||
@@ -24,10 +24,18 @@ impl DrawTarget for Display1in54c {
|
||||
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 Display1in54c {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -36,6 +36,7 @@ impl DrawTarget for Display2in9 {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl OriginDimensions for Display2in9 {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||
use crate::graphics::{Display, DisplayRotation};
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics::pixelcolor::BinaryColor;
|
||||
use embedded_graphics_core::prelude::*;
|
||||
|
||||
/// Display with Fullsize buffer for use with the 2in9 EPD V2
|
||||
///
|
||||
@@ -22,13 +23,21 @@ impl Default for Display2in9 {
|
||||
}
|
||||
|
||||
impl DrawTarget for Display2in9 {
|
||||
type Color = BinaryColor
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,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, PrimitiveStyle},
|
||||
//!};
|
||||
//!use epd_waveshare::{epd2in9_v2::*, prelude::*};
|
||||
//!#
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::epd2in9bc::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
||||
use crate::graphics::{Display, DisplayRotation};
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics::pixelcolor::BinaryColor;
|
||||
use embedded_graphics_core::prelude::*;
|
||||
|
||||
/// Full size buffer for use with the 2in9b/c EPD
|
||||
///
|
||||
@@ -20,13 +21,21 @@ impl Default for Display2in9bc {
|
||||
}
|
||||
|
||||
impl DrawTarget for Display2in9bc {
|
||||
type Color = BinaryColor
|
||||
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 Display2in9bc {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,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, PrimitiveStyle},
|
||||
//!};
|
||||
//!use epd_waveshare::{epd2in9bc::*, prelude::*};
|
||||
//!#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::color::OctColor;
|
||||
use crate::epd5in65f::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||
use crate::graphics::{DisplayRotation, OctDisplay};
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics_core::prelude::*;
|
||||
|
||||
/// Full size buffer for use with the 5in65f EPD
|
||||
///
|
||||
@@ -26,10 +26,18 @@ impl DrawTarget for Display5in65f {
|
||||
type Color = OctColor;
|
||||
type Error = core::convert::Infallible;
|
||||
|
||||
fn draw_pixel(&mut self, pixel: Pixel<OctColor>) -> 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 Display5in65f {
|
||||
fn size(&self) -> Size {
|
||||
Size::new(WIDTH, HEIGHT)
|
||||
}
|
||||
@@ -58,7 +66,10 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::epd5in65f;
|
||||
use crate::graphics::{DisplayRotation, OctDisplay};
|
||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
||||
use embedded_graphics::{
|
||||
prelude::*,
|
||||
primitives::{Line, PrimitiveStyle},
|
||||
};
|
||||
|
||||
// test buffer length
|
||||
#[test]
|
||||
|
||||
+15
-4
@@ -1,7 +1,7 @@
|
||||
use crate::epd7in5::{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 7in5 EPD
|
||||
///
|
||||
@@ -26,10 +26,18 @@ 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)
|
||||
}
|
||||
@@ -60,7 +68,10 @@ mod tests {
|
||||
use crate::color::Color;
|
||||
use crate::epd7in5;
|
||||
use crate::graphics::{Display, DisplayRotation};
|
||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
||||
use embedded_graphics::{
|
||||
prelude::*,
|
||||
primitives::{Line, PrimitiveStyle},
|
||||
};
|
||||
|
||||
// test buffer length
|
||||
#[test]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::epd7in5_hd::{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 7in5 EPD
|
||||
///
|
||||
@@ -26,10 +26,18 @@ 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)
|
||||
}
|
||||
@@ -59,7 +67,10 @@ mod tests {
|
||||
use crate::color::{Black, Color};
|
||||
use crate::epd7in5_hd;
|
||||
use crate::graphics::{Display, DisplayRotation};
|
||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
||||
use embedded_graphics::{
|
||||
prelude::*,
|
||||
primitives::{Line, PrimitiveStyle},
|
||||
};
|
||||
|
||||
// test buffer length
|
||||
#[test]
|
||||
|
||||
+19
-11
@@ -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]
|
||||
|
||||
+9
-9
@@ -74,19 +74,19 @@ pub mod color;
|
||||
mod interface;
|
||||
|
||||
pub mod epd1in54;
|
||||
//pub mod epd1in54b;
|
||||
//pub mod epd1in54c;
|
||||
pub mod epd1in54b;
|
||||
pub mod epd1in54c;
|
||||
pub mod epd2in13_v2;
|
||||
pub mod epd2in13bc;
|
||||
//pub mod epd2in7b;
|
||||
pub mod epd2in7b;
|
||||
pub mod epd2in9;
|
||||
//pub mod epd2in9_v2;
|
||||
//pub mod epd2in9bc;
|
||||
pub mod epd2in9_v2;
|
||||
pub mod epd2in9bc;
|
||||
pub mod epd4in2;
|
||||
//pub mod epd5in65f;
|
||||
//pub mod epd7in5;
|
||||
//pub mod epd7in5_hd;
|
||||
//pub mod epd7in5_v2;
|
||||
pub mod epd5in65f;
|
||||
pub mod epd7in5;
|
||||
pub mod epd7in5_hd;
|
||||
pub mod epd7in5_v2;
|
||||
|
||||
pub(crate) mod type_a;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user