Migrate remaining drivers
parent
feac908558
commit
6a10e0cb96
|
|
@ -89,7 +89,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
display.clear_buffer(Color::White);
|
||||
|
||||
// draw a analog clock
|
||||
let _ = Circle::new(Point::new(64, 64), 40)
|
||||
let _ = Circle::with_center(Point::new(64, 64), 80)
|
||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
||||
.draw(&mut display);
|
||||
let _ = Line::new(Point::new(64, 64), Point::new(30, 40))
|
||||
|
|
@ -117,7 +117,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
.background_color(Black)
|
||||
.build();
|
||||
|
||||
let _ = Text::with_text_style("It's working-WoB!", Point::new(90, 40), style, text_style)
|
||||
let _ = Text::with_text_style("It's working\nWoB!", Point::new(90, 40), style, text_style)
|
||||
.draw(&mut display);
|
||||
|
||||
// Demonstrating how to use the partial refresh feature of the screen.
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
let mut epd4in2 =
|
||||
Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
||||
|
||||
//println!("Test all the rotations");
|
||||
println!("Test all the rotations");
|
||||
let mut display = Display4in2::default();
|
||||
|
||||
display.set_rotation(DisplayRotation::Rotate0);
|
||||
|
|
@ -85,7 +85,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
.expect("display frame new graphics");
|
||||
delay.delay_ms(5000u16);
|
||||
|
||||
//println!("Now test new graphics with default rotation and some special stuff:");
|
||||
println!("Now test new graphics with default rotation and some special stuff");
|
||||
display.clear_buffer(Color::White);
|
||||
|
||||
// draw a analog clock
|
||||
|
|
@ -94,7 +94,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
.stroke_width(1)
|
||||
.build();
|
||||
|
||||
let _ = Circle::new(Point::new(64, 64), 40)
|
||||
let _ = Circle::with_center(Point::new(64, 64), 80)
|
||||
.into_styled(style)
|
||||
.draw(&mut display);
|
||||
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
.stroke_width(1)
|
||||
.build();
|
||||
|
||||
let _ = Circle::new(Point::new(64, 64), 64)
|
||||
let _ = Circle::with_center(Point::new(64, 64), 128)
|
||||
.into_styled(style)
|
||||
.draw(&mut display);
|
||||
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
18
src/lib.rs
18
src/lib.rs
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue