Merge pull request #78 from lrbalt/update-to-eg070
Migrate to embedded-graphics 0.7.0 (thanks to @lrbalt )main
commit
239691e8d3
|
|
@ -16,7 +16,8 @@ edition = "2018"
|
||||||
# travis-ci = { repository = "caemor/epd-waveshare" }
|
# travis-ci = { repository = "caemor/epd-waveshare" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embedded-graphics = { version = "0.6.2", optional = true}
|
embedded-graphics = { version = "0.7.1", optional = true}
|
||||||
|
embedded-graphics-core = { version = "0.3.2", optional = true}
|
||||||
embedded-hal = {version = "0.2.4", features = ["unproven"]}
|
embedded-hal = {version = "0.2.4", features = ["unproven"]}
|
||||||
bit_field = "0.10.1"
|
bit_field = "0.10.1"
|
||||||
|
|
||||||
|
|
@ -27,7 +28,7 @@ embedded-hal-mock = "0.7"
|
||||||
[features]
|
[features]
|
||||||
default = ["graphics"]
|
default = ["graphics"]
|
||||||
|
|
||||||
graphics = ["embedded-graphics"]
|
graphics = ["embedded-graphics","embedded-graphics-core"]
|
||||||
|
|
||||||
# Offers an alternative fast full lut for type_a displays, but the refreshed screen isnt as clean looking
|
# Offers an alternative fast full lut for type_a displays, but the refreshed screen isnt as clean looking
|
||||||
type_a_alternative_faster_lut = []
|
type_a_alternative_faster_lut = []
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
fonts::{Font12x16, Font6x8, Text},
|
mono_font::MonoTextStyleBuilder,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::{Circle, Line},
|
primitives::{Circle, Line, PrimitiveStyle},
|
||||||
style::PrimitiveStyle,
|
text::{Baseline, Text, TextStyleBuilder},
|
||||||
text_style,
|
|
||||||
};
|
};
|
||||||
use embedded_hal::prelude::*;
|
use embedded_hal::prelude::*;
|
||||||
use epd_waveshare::{
|
use epd_waveshare::{
|
||||||
color::*,
|
color::*,
|
||||||
epd2in13_v2::{Display2in13, Epd2in13},
|
epd2in13_v2::{Display2in13, Epd2in13},
|
||||||
graphics::{Display, DisplayRotation},
|
graphics::DisplayRotation,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use linux_embedded_hal::{
|
use linux_embedded_hal::{
|
||||||
|
|
@ -90,7 +89,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
display.clear_buffer(Color::White);
|
display.clear_buffer(Color::White);
|
||||||
|
|
||||||
// draw a analog clock
|
// 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))
|
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(30, 40))
|
let _ = Line::new(Point::new(64, 64), Point::new(30, 40))
|
||||||
|
|
@ -101,21 +100,24 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// draw white on black background
|
// draw white on black background
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(90, 10))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(90, 10), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// use bigger/different font
|
// use bigger/different font
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(90, 40))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_10X20)
|
||||||
font = Font12x16,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
|
||||||
|
let _ = Text::with_text_style("It's working\nWoB!", Point::new(90, 40), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// Demonstrating how to use the partial refresh feature of the screen.
|
// Demonstrating how to use the partial refresh feature of the screen.
|
||||||
|
|
@ -157,11 +159,13 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_text(display: &mut Display2in13, text: &str, x: i32, y: i32) {
|
fn draw_text(display: &mut Display2in13, text: &str, x: i32, y: i32) {
|
||||||
let _ = Text::new(text, Point::new(x, y))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = Black,
|
.background_color(Black)
|
||||||
background_color = White
|
.build();
|
||||||
))
|
|
||||||
.draw(display);
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style(text, Point::new(x, y), style, text_style).draw(display);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
fonts::{Font12x16, Font6x8, Text},
|
mono_font::MonoTextStyleBuilder,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::{Circle, Line},
|
primitives::{Circle, Line, PrimitiveStyle},
|
||||||
style::PrimitiveStyle,
|
text::{Baseline, Text, TextStyleBuilder},
|
||||||
text_style,
|
|
||||||
};
|
};
|
||||||
use embedded_hal::prelude::*;
|
use embedded_hal::prelude::*;
|
||||||
use epd_waveshare::{
|
use epd_waveshare::{
|
||||||
|
|
@ -104,8 +103,8 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
println!("Now test new graphics with default rotation and three colors:");
|
println!("Now test new graphics with default rotation and three colors:");
|
||||||
display.clear_buffer(TriColor::White);
|
display.clear_buffer(TriColor::White);
|
||||||
|
|
||||||
// draw a analog clock in black
|
// 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(TriColor::Black, 1))
|
.into_styled(PrimitiveStyle::with_stroke(TriColor::Black, 1))
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(30, 40))
|
let _ = Line::new(Point::new(64, 64), Point::new(30, 40))
|
||||||
|
|
@ -115,23 +114,25 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
.into_styled(PrimitiveStyle::with_stroke(TriColor::Black, 1))
|
.into_styled(PrimitiveStyle::with_stroke(TriColor::Black, 1))
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// draw text white on chromatic (red or yellow) background
|
// draw text white on Red background by using the chromatic buffer
|
||||||
|
let style = MonoTextStyleBuilder::new()
|
||||||
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
|
.text_color(TriColor::White)
|
||||||
|
.background_color(TriColor::Chromatic)
|
||||||
|
.build();
|
||||||
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(90, 10))
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(90, 10), style, text_style)
|
||||||
.into_styled(text_style!(
|
|
||||||
font = Font6x8,
|
|
||||||
text_color = TriColor::White,
|
|
||||||
background_color = TriColor::Chromatic
|
|
||||||
))
|
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// use bigger/different font
|
// use bigger/different font
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(90, 40))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_10X20)
|
||||||
font = Font12x16,
|
.text_color(TriColor::White)
|
||||||
text_color = TriColor::White,
|
.background_color(TriColor::Chromatic)
|
||||||
background_color = TriColor::Chromatic
|
.build();
|
||||||
))
|
|
||||||
|
let _ = Text::with_text_style("It's working\nWoB!", Point::new(90, 40), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// we used three colors, so we need to update both bw-buffer and chromatic-buffer
|
// we used three colors, so we need to update both bw-buffer and chromatic-buffer
|
||||||
|
|
@ -154,11 +155,13 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_text(display: &mut Display2in13bc, text: &str, x: i32, y: i32) {
|
fn draw_text(display: &mut Display2in13bc, text: &str, x: i32, y: i32) {
|
||||||
let _ = Text::new(text, Point::new(x, y))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(TriColor::White)
|
||||||
text_color = TriColor::Black,
|
.background_color(TriColor::Black)
|
||||||
background_color = TriColor::White
|
.build();
|
||||||
))
|
|
||||||
.draw(display);
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style(text, Point::new(x, y), style, text_style).draw(display);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
fonts::{Font12x16, Font6x8, Text},
|
mono_font::MonoTextStyleBuilder,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::{Circle, Line},
|
primitives::{Circle, Line, PrimitiveStyleBuilder},
|
||||||
style::PrimitiveStyle,
|
text::{Baseline, Text, TextStyleBuilder},
|
||||||
text_style,
|
|
||||||
};
|
};
|
||||||
use embedded_hal::prelude::*;
|
use embedded_hal::prelude::*;
|
||||||
use epd_waveshare::{
|
use epd_waveshare::{
|
||||||
color::*,
|
color::*,
|
||||||
epd4in2::{Display4in2, Epd4in2},
|
epd4in2::{Display4in2, Epd4in2},
|
||||||
graphics::{Display, DisplayRotation},
|
graphics::DisplayRotation,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use linux_embedded_hal::{
|
use linux_embedded_hal::{
|
||||||
|
|
@ -65,7 +64,7 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
let mut epd4in2 =
|
let mut epd4in2 =
|
||||||
Epd4in2::new(&mut spi, cs, busy, dc, rst, &mut delay).expect("eink initalize error");
|
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();
|
let mut display = Display4in2::default();
|
||||||
|
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
|
|
@ -86,36 +85,44 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
.expect("display frame new graphics");
|
.expect("display frame new graphics");
|
||||||
delay.delay_ms(5000u16);
|
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);
|
display.clear_buffer(Color::White);
|
||||||
|
|
||||||
// draw a analog clock
|
// draw a analog clock
|
||||||
let _ = Circle::new(Point::new(64, 64), 64)
|
let style = PrimitiveStyleBuilder::new()
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.stroke_color(Black)
|
||||||
|
.stroke_width(1)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let _ = Circle::with_center(Point::new(64, 64), 80)
|
||||||
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(80, 80))
|
let _ = Line::new(Point::new(64, 64), Point::new(80, 80))
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// draw white on black background
|
// draw white on black background
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(175, 250))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(175, 250), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// use bigger/different font
|
// use bigger/different font
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(50, 200))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_10X20)
|
||||||
font = Font12x16,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
|
||||||
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(50, 200), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// a moving `Hello World!`
|
// a moving `Hello World!`
|
||||||
|
|
@ -142,11 +149,13 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_text(display: &mut Display4in2, text: &str, x: i32, y: i32) {
|
fn draw_text(display: &mut Display4in2, text: &str, x: i32, y: i32) {
|
||||||
let _ = Text::new(text, Point::new(x, y))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = Black,
|
.background_color(Black)
|
||||||
background_color = White
|
.build();
|
||||||
))
|
|
||||||
.draw(display);
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style(text, Point::new(x, y), style, text_style).draw(display);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
fonts::{Font12x16, Font6x8, Text},
|
mono_font::MonoTextStyleBuilder,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::{Circle, Line},
|
primitives::{Circle, Line, PrimitiveStyleBuilder},
|
||||||
style::PrimitiveStyle,
|
text::{Baseline, Text, TextStyleBuilder},
|
||||||
text_style,
|
|
||||||
};
|
};
|
||||||
use embedded_hal::prelude::*;
|
use embedded_hal::prelude::*;
|
||||||
use epd_waveshare::{
|
use epd_waveshare::{
|
||||||
|
|
@ -97,33 +96,40 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
display.clear_buffer(Color::White);
|
display.clear_buffer(Color::White);
|
||||||
|
|
||||||
// draw a analog clock
|
// draw a analog clock
|
||||||
// draw a analog clock
|
let style = PrimitiveStyleBuilder::new()
|
||||||
let _ = Circle::new(Point::new(64, 64), 64)
|
.stroke_color(Black)
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.stroke_width(1)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let _ = Circle::with_center(Point::new(64, 64), 128)
|
||||||
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
let _ = Line::new(Point::new(64, 64), Point::new(0, 64))
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
let _ = Line::new(Point::new(64, 64), Point::new(80, 80))
|
let _ = Line::new(Point::new(64, 64), Point::new(80, 80))
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
.into_styled(style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// draw white on black background
|
// draw white on black background
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(175, 250))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(175, 250), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// use bigger/different font
|
// use bigger/different font
|
||||||
let _ = Text::new("It's working-WoB!", Point::new(50, 200))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_10X20)
|
||||||
font = Font12x16,
|
.text_color(White)
|
||||||
text_color = White,
|
.background_color(Black)
|
||||||
background_color = Black
|
.build();
|
||||||
))
|
|
||||||
|
let _ = Text::with_text_style("It's working-WoB!", Point::new(50, 200), style, text_style)
|
||||||
.draw(&mut display);
|
.draw(&mut display);
|
||||||
|
|
||||||
// a moving `Hello World!`
|
// a moving `Hello World!`
|
||||||
|
|
@ -148,11 +154,13 @@ fn main() -> Result<(), std::io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_text(display: &mut VarDisplay, text: &str, x: i32, y: i32) {
|
fn draw_text(display: &mut VarDisplay, text: &str, x: i32, y: i32) {
|
||||||
let _ = Text::new(text, Point::new(x, y))
|
let style = MonoTextStyleBuilder::new()
|
||||||
.into_styled(text_style!(
|
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
|
||||||
font = Font6x8,
|
.text_color(White)
|
||||||
text_color = Black,
|
.background_color(Black)
|
||||||
background_color = White
|
.build();
|
||||||
))
|
|
||||||
.draw(display);
|
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();
|
||||||
|
|
||||||
|
let _ = Text::with_text_style(text, Point::new(x, y), style, text_style).draw(display);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd1in54::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd1in54::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 1in54 EPD
|
/// Full size buffer for use with the 1in54 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display1in54 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display1in54 {
|
impl DrawTarget for Display1in54 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
where
|
||||||
|
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
for pixel in pixels {
|
||||||
|
self.draw_helper(WIDTH, HEIGHT, pixel)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OriginDimensions for Display1in54 {
|
||||||
fn size(&self) -> Size {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +66,10 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::color::{Black, Color};
|
use crate::color::{Black, Color};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::{epd1in54::*, prelude::*};
|
//!use epd_waveshare::{epd1in54::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
@ -26,8 +26,12 @@
|
||||||
//!let mut display = Display1in54::default();
|
//!let mut display = Display1in54::default();
|
||||||
//!
|
//!
|
||||||
//!// Use embedded graphics for drawing a line
|
//!// 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))
|
//!let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
||||||
//! .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
//! .into_styled(style)
|
||||||
//! .draw(&mut display);
|
//! .draw(&mut display);
|
||||||
//!
|
//!
|
||||||
//!// Display updated frame
|
//!// Display updated frame
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd1in54b::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd1in54b::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 1in54 EPD
|
/// Full size buffer for use with the 1in54 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -21,13 +21,22 @@ impl Default for Display1in54b {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display1in54b {
|
impl DrawTarget for Display1in54b {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd1in54c::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
use crate::epd1in54c::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 1in54c EPD
|
/// Full size buffer for use with the 1in54c EPD
|
||||||
///
|
///
|
||||||
|
|
@ -20,13 +20,22 @@ impl Default for Display1in54c {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display1in54c {
|
impl DrawTarget for Display1in54c {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use crate::buffer_len;
|
||||||
use crate::epd2in13_v2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd2in13_v2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 2in13 v2 EPD
|
/// Full size buffer for use with the 2in13 v2 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -23,13 +23,22 @@ impl Default for Display2in13 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display2in13 {
|
impl DrawTarget for Display2in13 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
where
|
||||||
|
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
for pixel in pixels {
|
||||||
|
self.draw_helper(WIDTH, HEIGHT, pixel)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OriginDimensions for Display2in13 {
|
||||||
fn size(&self) -> Size {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +68,10 @@ mod tests {
|
||||||
use crate::color::{Black, Color};
|
use crate::color::{Black, Color};
|
||||||
use crate::epd2in13_v2;
|
use crate::epd2in13_v2;
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::color::TriColor;
|
use crate::color::TriColor;
|
||||||
use crate::epd2in13bc::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
use crate::epd2in13bc::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
||||||
use crate::graphics::{DisplayRotation, TriDisplay};
|
use crate::graphics::{DisplayRotation, TriDisplay};
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 2.13" b/c EPD
|
/// Full size buffer for use with the 2.13" b/c EPD
|
||||||
///
|
///
|
||||||
|
|
@ -23,13 +23,21 @@ impl Default for Display2in13bc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<TriColor> for Display2in13bc {
|
impl DrawTarget for Display2in13bc {
|
||||||
|
type Color = TriColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<TriColor>) -> Result<(), Self::Error> {
|
where
|
||||||
self.draw_helper_tri(WIDTH, HEIGHT, pixel)
|
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
for pixel in pixels {
|
||||||
|
self.draw_helper_tri(WIDTH, HEIGHT, pixel)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OriginDimensions for Display2in13bc {
|
||||||
fn size(&self) -> Size {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
//!```rust, no_run
|
//!```rust, no_run
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{prelude::*, primitives::Line, style::PrimitiveStyle};
|
//!use embedded_graphics::{prelude::*, primitives::{Line, PrimitiveStyle, PrimitiveStyleBuilder}};
|
||||||
//!use epd_waveshare::{epd2in13bc::*, prelude::*, color::TriColor};
|
//!use epd_waveshare::{epd2in13bc::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
//!# let expectations = [];
|
//!# let expectations = [];
|
||||||
//!# let mut spi = spi::Mock::new(&expectations);
|
//!# let mut spi = spi::Mock::new(&expectations);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd2in7b::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd2in7b::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 2in7B EPD
|
/// Full size buffer for use with the 2in7B EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display2in7b {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display2in7b {
|
impl DrawTarget for Display2in7b {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +69,10 @@ mod tests {
|
||||||
use crate::epd2in7b;
|
use crate::epd2in7b;
|
||||||
use crate::epd2in7b::{HEIGHT, WIDTH};
|
use crate::epd2in7b::{HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Display with Fullsize buffer for use with the 2in9 EPD
|
/// Display with Fullsize buffer for use with the 2in9 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display2in9 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display2in9 {
|
impl DrawTarget for Display2in9 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::*, prelude::*};
|
//!use epd_waveshare::{epd2in9::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd2in9::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Display with Fullsize buffer for use with the 2in9 EPD V2
|
/// Display with Fullsize buffer for use with the 2in9 EPD V2
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display2in9 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display2in9 {
|
impl DrawTarget for Display2in9 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::*};
|
//!use epd_waveshare::{epd2in9_v2::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd2in9bc::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
use crate::epd2in9bc::{DEFAULT_BACKGROUND_COLOR, HEIGHT, NUM_DISPLAY_BITS, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 2in9b/c EPD
|
/// Full size buffer for use with the 2in9b/c EPD
|
||||||
///
|
///
|
||||||
|
|
@ -20,13 +20,22 @@ impl Default for Display2in9bc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display2in9bc {
|
impl DrawTarget for Display2in9bc {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::*};
|
//!use epd_waveshare::{epd2in9bc::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd4in2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd4in2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 4in2 EPD
|
/// Full size buffer for use with the 4in2 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,21 @@ impl Default for Display4in2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display4in2 {
|
impl DrawTarget for Display4in2 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
where
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
for pixel in pixels {
|
||||||
|
self.draw_helper(WIDTH, HEIGHT, pixel)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OriginDimensions for Display4in2 {
|
||||||
fn size(&self) -> Size {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +67,10 @@ mod tests {
|
||||||
use crate::color::Color;
|
use crate::color::Color;
|
||||||
use crate::epd4in2;
|
use crate::epd4in2;
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::{epd4in2::*, prelude::*};
|
//!use epd_waveshare::{epd4in2::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::color::OctColor;
|
use crate::color::OctColor;
|
||||||
use crate::epd5in65f::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd5in65f::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{DisplayRotation, OctDisplay};
|
use crate::graphics::{DisplayRotation, OctDisplay};
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 5in65f EPD
|
/// Full size buffer for use with the 5in65f EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display5in65f {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<OctColor> for Display5in65f {
|
impl DrawTarget for Display5in65f {
|
||||||
|
type Color = OctColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<OctColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +66,10 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::epd5in65f;
|
use crate::epd5in65f;
|
||||||
use crate::graphics::{DisplayRotation, OctDisplay};
|
use crate::graphics::{DisplayRotation, OctDisplay};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd7in5::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd7in5::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 7in5 EPD
|
/// Full size buffer for use with the 7in5 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display7in5 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display7in5 {
|
impl DrawTarget for Display7in5 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +68,10 @@ mod tests {
|
||||||
use crate::color::Color;
|
use crate::color::Color;
|
||||||
use crate::epd7in5;
|
use crate::epd7in5;
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd7in5_hd::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd7in5_hd::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 7in5 EPD
|
/// Full size buffer for use with the 7in5 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display7in5 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display7in5 {
|
impl DrawTarget for Display7in5 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +67,10 @@ mod tests {
|
||||||
use crate::color::{Black, Color};
|
use crate::color::{Black, Color};
|
||||||
use crate::epd7in5_hd;
|
use crate::epd7in5_hd;
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::epd7in5_v2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
use crate::epd7in5_v2::{DEFAULT_BACKGROUND_COLOR, HEIGHT, WIDTH};
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::pixelcolor::BinaryColor;
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
use embedded_graphics::prelude::*;
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Full size buffer for use with the 7in5 EPD
|
/// Full size buffer for use with the 7in5 EPD
|
||||||
///
|
///
|
||||||
|
|
@ -22,13 +22,22 @@ impl Default for Display7in5 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawTarget<BinaryColor> for Display7in5 {
|
impl DrawTarget for Display7in5 {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(WIDTH, HEIGHT, pixel)
|
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 {
|
fn size(&self) -> Size {
|
||||||
Size::new(WIDTH, HEIGHT)
|
Size::new(WIDTH, HEIGHT)
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +67,10 @@ mod tests {
|
||||||
use crate::color::{Black, Color};
|
use crate::color::{Black, Color};
|
||||||
use crate::epd7in5_v2;
|
use crate::epd7in5_v2;
|
||||||
use crate::graphics::{Display, DisplayRotation};
|
use crate::graphics::{Display, DisplayRotation};
|
||||||
use embedded_graphics::{primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
// test buffer length
|
// test buffer length
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use crate::buffer_len;
|
use crate::buffer_len;
|
||||||
use crate::color::{Color, OctColor, TriColor};
|
use crate::color::{Color, OctColor, TriColor};
|
||||||
use embedded_graphics::{pixelcolor::BinaryColor, prelude::*};
|
use embedded_graphics::pixelcolor::BinaryColor;
|
||||||
|
use embedded_graphics_core::prelude::*;
|
||||||
|
|
||||||
/// Displayrotation
|
/// Displayrotation
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
|
@ -29,7 +30,7 @@ impl Default for DisplayRotation {
|
||||||
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
||||||
/// - Rotations
|
/// - Rotations
|
||||||
/// - Clearing
|
/// - Clearing
|
||||||
pub trait Display: DrawTarget<BinaryColor> {
|
pub trait Display: DrawTarget<Color = BinaryColor> {
|
||||||
/// Clears the buffer of the display with the chosen background color
|
/// Clears the buffer of the display with the chosen background color
|
||||||
fn clear_buffer(&mut self, background_color: Color) {
|
fn clear_buffer(&mut self, background_color: Color) {
|
||||||
for elem in self.get_mut_buffer().iter_mut() {
|
for elem in self.get_mut_buffer().iter_mut() {
|
||||||
|
|
@ -91,7 +92,7 @@ pub trait Display: DrawTarget<BinaryColor> {
|
||||||
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
||||||
/// - Rotations
|
/// - Rotations
|
||||||
/// - Clearing
|
/// - Clearing
|
||||||
pub trait TriDisplay: DrawTarget<TriColor> {
|
pub trait TriDisplay: DrawTarget<Color = TriColor> {
|
||||||
/// Clears the buffer of the display with the chosen background color
|
/// Clears the buffer of the display with the chosen background color
|
||||||
fn clear_buffer(&mut self, background_color: TriColor) {
|
fn clear_buffer(&mut self, background_color: TriColor) {
|
||||||
for elem in self.get_mut_buffer().iter_mut() {
|
for elem in self.get_mut_buffer().iter_mut() {
|
||||||
|
|
@ -174,7 +175,7 @@ pub trait TriDisplay: DrawTarget<TriColor> {
|
||||||
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
/// - Drawing (With the help of DrawTarget/Embedded Graphics)
|
||||||
/// - Rotations
|
/// - Rotations
|
||||||
/// - Clearing
|
/// - Clearing
|
||||||
pub trait OctDisplay: DrawTarget<OctColor> {
|
pub trait OctDisplay: DrawTarget<Color = OctColor> {
|
||||||
/// Clears the buffer of the display with the chosen background color
|
/// Clears the buffer of the display with the chosen background color
|
||||||
fn clear_buffer(&mut self, background_color: OctColor) {
|
fn clear_buffer(&mut self, background_color: OctColor) {
|
||||||
for elem in self.get_mut_buffer().iter_mut() {
|
for elem in self.get_mut_buffer().iter_mut() {
|
||||||
|
|
@ -240,8 +241,7 @@ pub trait OctDisplay: DrawTarget<OctColor> {
|
||||||
/// # use epd_waveshare::graphics::VarDisplay;
|
/// # use epd_waveshare::graphics::VarDisplay;
|
||||||
/// # use epd_waveshare::color::Black;
|
/// # use epd_waveshare::color::Black;
|
||||||
/// # use embedded_graphics::prelude::*;
|
/// # use embedded_graphics::prelude::*;
|
||||||
/// # use embedded_graphics::primitives::{Circle, Line};
|
/// # use embedded_graphics::primitives::{Circle, Line, PrimitiveStyle};
|
||||||
/// # use embedded_graphics::style::PrimitiveStyle;
|
|
||||||
/// let width = 128;
|
/// let width = 128;
|
||||||
/// let height = 296;
|
/// let height = 296;
|
||||||
///
|
///
|
||||||
|
|
@ -277,13 +277,22 @@ impl<'a> VarDisplay<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DrawTarget<BinaryColor> for VarDisplay<'a> {
|
impl<'a> DrawTarget for VarDisplay<'a> {
|
||||||
|
type Color = BinaryColor;
|
||||||
type Error = core::convert::Infallible;
|
type Error = core::convert::Infallible;
|
||||||
|
|
||||||
fn draw_pixel(&mut self, pixel: Pixel<BinaryColor>) -> Result<(), Self::Error> {
|
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
||||||
self.draw_helper(self.width, self.height, pixel)
|
where
|
||||||
|
I: IntoIterator<Item = Pixel<Self::Color>>,
|
||||||
|
{
|
||||||
|
for pixel in pixels {
|
||||||
|
self.draw_helper(self.width, self.height, pixel)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> OriginDimensions for VarDisplay<'a> {
|
||||||
fn size(&self) -> Size {
|
fn size(&self) -> Size {
|
||||||
Size::new(self.width, self.height)
|
Size::new(self.width, self.height)
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +388,10 @@ mod tests {
|
||||||
use super::{buffer_len, find_position, outside_display, Display, DisplayRotation, VarDisplay};
|
use super::{buffer_len, find_position, outside_display, Display, DisplayRotation, VarDisplay};
|
||||||
use crate::color::Black;
|
use crate::color::Black;
|
||||||
use crate::color::Color;
|
use crate::color::Color;
|
||||||
use embedded_graphics::{prelude::*, primitives::Line, style::PrimitiveStyle};
|
use embedded_graphics::{
|
||||||
|
prelude::*,
|
||||||
|
primitives::{Line, PrimitiveStyle},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn buffer_clear() {
|
fn buffer_clear() {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
//!# use embedded_hal_mock::*;
|
//!# use embedded_hal_mock::*;
|
||||||
//!# fn main() -> Result<(), MockError> {
|
//!# fn main() -> Result<(), MockError> {
|
||||||
//!use embedded_graphics::{
|
//!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::{epd1in54::*, prelude::*};
|
//!use epd_waveshare::{epd1in54::*, prelude::*};
|
||||||
//!#
|
//!#
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
//!let mut display = Display1in54::default();
|
//!let mut display = Display1in54::default();
|
||||||
//!
|
//!
|
||||||
//!// Use embedded graphics for drawing a line
|
//!// Use embedded graphics for drawing a line
|
||||||
|
//!
|
||||||
//!let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
//!let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
||||||
//! .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
//! .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
||||||
//! .draw(&mut display);
|
//! .draw(&mut display);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ where
|
||||||
///# use embedded_hal_mock::*;
|
///# use embedded_hal_mock::*;
|
||||||
///# fn main() -> Result<(), MockError> {
|
///# fn main() -> Result<(), MockError> {
|
||||||
///use embedded_graphics::{
|
///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::{epd4in2::*, prelude::*};
|
///use epd_waveshare::{epd4in2::*, prelude::*};
|
||||||
///#
|
///#
|
||||||
|
|
@ -112,6 +112,7 @@ where
|
||||||
///let mut display = Display4in2::default();
|
///let mut display = Display4in2::default();
|
||||||
///
|
///
|
||||||
///// Use embedded graphics for drawing a line
|
///// Use embedded graphics for drawing a line
|
||||||
|
///
|
||||||
///let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
///let _ = Line::new(Point::new(0, 120), Point::new(0, 295))
|
||||||
/// .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
/// .into_styled(PrimitiveStyle::with_stroke(Black, 1))
|
||||||
/// .draw(&mut display);
|
/// .draw(&mut display);
|
||||||
|
|
@ -248,7 +249,7 @@ where
|
||||||
///# use embedded_hal_mock::*;
|
///# use embedded_hal_mock::*;
|
||||||
///# fn main() -> Result<(), MockError> {
|
///# fn main() -> Result<(), MockError> {
|
||||||
///# use embedded_graphics::{
|
///# 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::{epd4in2::*, prelude::*};
|
///# use epd_waveshare::{epd4in2::*, prelude::*};
|
||||||
///# use epd_waveshare::graphics::VarDisplay;
|
///# use epd_waveshare::graphics::VarDisplay;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue