Browse Source

Merge pull request #16 from Caemor/add_embedded_graphics

Add embedded graphics supports
embedded-hal-1.0
Chris 7 years ago committed by GitHub
parent
commit
ad76027709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      Cargo.toml
  2. 33
      README.md
  3. 4
      examples/embedded_linux_epd1in54/Cargo.toml
  4. 116
      examples/embedded_linux_epd1in54/src/main.rs
  5. 14
      examples/embedded_linux_epd2in9/Cargo.toml
  6. 201
      examples/embedded_linux_epd2in9/src/main.rs
  7. 6
      examples/embedded_linux_epd4in2/Cargo.toml
  8. 197
      examples/embedded_linux_epd4in2/src/main.rs
  9. 7
      examples/stm32f3discovery/src/main.rs
  10. 97
      src/color.rs
  11. 759
      src/drawing/font.rs
  12. 622
      src/drawing/mod.rs
  13. 136
      src/epd1in54/graphics.rs
  14. 80
      src/epd1in54/mod.rs
  15. 45
      src/epd2in9/graphics.rs
  16. 78
      src/epd2in9/mod.rs
  17. 6
      src/epd4in2/constants.rs
  18. 139
      src/epd4in2/graphics.rs
  19. 45
      src/epd4in2/mod.rs
  20. 239
      src/graphics.rs
  21. 2
      src/interface.rs
  22. 35
      src/lib.rs
  23. 28
      src/traits.rs
  24. 14
      src/type_a/constants.rs
  25. 16
      src/type_a/mod.rs

7
Cargo.toml

@ -20,15 +20,16 @@ travis-ci = { repository = "Caemor/eink-waveshare-rs" }
[features]
default = ["epd1in54", "epd2in9", "epd4in2", "graphics"]
graphics = []
graphics = ["embedded-graphics"]
epd1in54 = []
epd2in9 = []
epd4in2 = []
# Activates the fast LUT for EPD4in2
epd4in2_fast_update = []
[dependencies]
[dependencies.embedded-graphics]
optional = true
version = "0.4.3"
[dependencies.embedded-hal]
features = ["unproven"]

33
README.md

@ -2,27 +2,29 @@
This library contains a driver for E-Paper Modules from Waveshare.
Support for more than the 4.2in EPD (especially the smaller and faster ones) is in the work.
The 2.9in (A) and 1.54 (A) variant should both work but aren't tested yet.
It uses the [embedded graphics](https://crates.io/crates/embedded-graphics) library for the optional graphics support.
## (Supported) Devices
| Device (with Link) | Colors | Flexible Display | Partial Refresh | Supported | Tested |
| :---: | --- | :---: | :---: | :---: | :---: |
| [4.2 Inch B/W (A)](https://www.waveshare.com/product/4.2inch-e-paper-module.htm) | Black, White | ✕ | Not officially [[1](#42-inch-e-ink-blackwhite)] | ✔ | ✔ |
| [1.54 Inch B/W (A)](https://www.waveshare.com/1.54inch-e-Paper-Module.htm) | Black, White | ✕ | ✔ | ✔ | |
| [1.54 Inch B/W (A)](https://www.waveshare.com/1.54inch-e-Paper-Module.htm) | Black, White | ✕ | ✔ | ✔ | |
| [2.13 Inch B/W (A)](https://www.waveshare.com/product/2.13inch-e-paper-hat.htm) | Black, White | ✕ | ✔ | | |
| [2.9 Inch B/W (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White | ✕ | ✔ | ✔ | |
| [2.9 Inch B/W (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White | ✕ | ✔ | ✔ | ✔ [[2](#2-29-inch-e-ink-blackwhite---tests)] |
### 4.2 Inch E-Ink Black/White
### [1]: 4.2 Inch E-Ink Black/White - Partial Refresh
Out of the Box the original driver from Waveshare only supports full updates.
- [1]: Be careful with the quick refresh updates: <br>
That means: Be careful with the quick refresh updates: <br>
It's possible with this driver but might lead to ghosting / burn-in effects therefore it's hidden behind a feature.
### [2]: 2.9 Inch E-Ink Black/White - Tests
Since my 2.9 Inch Display has some blurring issues I am not absolutly sure if everything was working correctly as it should :-)
### Interface
| Interface | Description |
@ -60,24 +62,7 @@ They are also called A and B, but you shouldn't get confused and mix it with the
## TODO's
- [ ] add more examples (e.g. for f3)
- [ ] improve the partial drawing/check the timings/timing improvements/....
- [ ] for later: add support for the smaller waveshare epds
- [ ] License: Stay with ISC (=MIT) or go to the Apache+MIT Dual License as used in many other projects?
## Graphics/Drawing
Supports:
- Lines
- Squares
- Circles
- Pixels
- Chars
- Strings
Chars and Strings work with a 8x8-Font.
Support for bigger sized/independent Fonts is in work.
## Examples

4
examples/embedded_linux_epd1in54/Cargo.toml

@ -7,8 +7,10 @@ authors = ["Christoph Groß <christoph-gross@mailbox.org>"]
#eink_waveshare_rs = { git = "https://github.com/Caemor/eink-waveshare-rs"}
#eink_waveshare_rs = { path = "../../"}
eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd1in54"]}
eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd1in54", "graphics"]}
linux-embedded-hal = "0.2.0"
embedded-graphics = "0.4.3"
embedded-hal = { version = "0.2.1", features = ["unproven"] }

116
examples/embedded_linux_epd1in54/src/main.rs

@ -6,10 +6,12 @@ extern crate eink_waveshare_rs;
use eink_waveshare_rs::{
EPD1in54,
//drawing::{Graphics},
color::Color,
WaveshareDisplay,
epd1in54::{
EPD1in54,
Buffer1in54,
},
graphics::{Display, DisplayRotation},
prelude::*,
};
use lin_hal::spidev::{self, SpidevOptions};
@ -17,6 +19,16 @@ use lin_hal::{Pin, Spidev};
use lin_hal::sysfs_gpio::Direction;
use lin_hal::Delay;
extern crate embedded_graphics;
use embedded_graphics::coord::Coord;
use embedded_graphics::fonts::{Font6x8};
use embedded_graphics::prelude::*;
//use embedded_graphics::primitives::{Circle, Line};
use embedded_graphics::Drawing;
extern crate embedded_hal;
use embedded_hal::prelude::*;
// activate spi, gpio in raspi-config
// needs to be run with sudo because of some sysfs_gpio permission problems and follow-up timing problems
// see https://github.com/rust-embedded/rust-sysfs-gpio/issues/5 and follow-up issues
@ -25,7 +37,6 @@ use lin_hal::Delay;
// DigitalIn Hack as long as it's not in the linux_embedded_hal
// from https://github.com/rudihorn/max31865/blob/extra_examples/examples/rpi.rs
// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore)
extern crate embedded_hal;
use embedded_hal::digital::{InputPin};
//TODO: Remove when linux_embedded_hal implements InputPin
@ -55,13 +66,8 @@ impl<'a> InputPin for HackInputPin<'a> {
}
}
/*
*
* BE CAREFUL: this wasn't tested yet, and the pins are also not choosen correctly (just some random ones atm)
*
*/
//TODO: Test this implemenation
//BE CAREFUL: this wasn't tested yet
fn main() {
run().unwrap();
@ -119,31 +125,71 @@ fn run() -> Result<(), std::io::Error> {
epd.clear_frame(&mut spi).expect("clear frame 1");
epd.display_frame(&mut spi).expect("disp 1");
// Speeddemo
let small_buffer = [Color::Black.get_byte_value(); 32];//16x16
let number_of_runs = 1;
for i in 0..number_of_runs {
let offset = i * 8 % 150;
epd.update_partial_frame(&mut spi, &small_buffer, 25 + offset, 25 + offset, 16, 16).expect("partial frame");
epd.display_frame(&mut spi).expect("disp 2");
}
// Clear the full screen
epd.clear_frame(&mut spi).expect("clear frame 2");
epd.display_frame(&mut spi).expect("disp 3");
// Draw some squares
let small_buffer = [Color::Black.get_byte_value(); 3200]; //160x160
epd.update_partial_frame(&mut spi, &small_buffer, 20, 20, 160, 160)?;
let small_buffer = [Color::White.get_byte_value(); 800]; //80x80
epd.update_partial_frame(&mut spi, &small_buffer, 60, 60, 80, 80)?;
let small_buffer = [Color::Black.get_byte_value(); 8]; //8x8
epd.update_partial_frame(&mut spi, &small_buffer, 96, 96, 8, 8).expect("partial frame 2");
println!("Test all the rotations");
let mut buffer = Buffer1in54::default();
let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);
display.set_rotation(DisplayRotation::Rotate0);
display.draw(
Font6x8::render_str("Rotate 0!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Font6x8::render_str("Rotate 90!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate180);
display.draw(
Font6x8::render_str("Rotate 180!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate270);
display.draw(
Font6x8::render_str("Rotate 270!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
// Display updated frame
epd.display_frame(&mut spi).expect("disp 4");
epd.update_frame(&mut spi, &display.buffer()).unwrap();
epd.display_frame(&mut spi).expect("display frame new graphics");
delay.delay_ms(5000u16);
// a quickly moving `Hello World!`
display.set_rotation(DisplayRotation::Rotate0);
epd.set_lut_quick(&mut spi).expect("SET LUT QUICK error");
let limit = 20;
for i in 0..limit {
println!("Moving Hello World. Loop {} from {}", (i+1), limit);
display.draw(
Font6x8::render_str(" Hello World! ")
.with_style(Style {
fill_color: Some(Color::White),
stroke_color: Some(Color::Black),
stroke_width: 0u8, // Has no effect on fonts
})
.translate(Coord::new(5 + i*6, 50))
.into_iter(),
);
epd.update_frame(&mut spi, &display.buffer()).unwrap();
epd.display_frame(&mut spi).expect("display frame new graphics");
}
// Set the EPD to sleep
epd.sleep(&mut spi).expect("sleep");

14
examples/embedded_linux_epd2in9/Cargo.toml

@ -0,0 +1,14 @@
[package]
name = "embedded_linux_eink_example"
version = "0.1.0"
authors = ["Christoph Groß <christoph-gross@mailbox.org>"]
[dependencies]
eink_waveshare_rs = { path = "../../", default-features = false, features = ["epd2in9", "graphics"]}
linux-embedded-hal = "0.2.0"
embedded-graphics = "0.4.3"
embedded-hal = { version = "0.2.1", features = ["unproven"] }

201
examples/embedded_linux_epd2in9/src/main.rs

@ -0,0 +1,201 @@
// the library for the embedded linux device
extern crate linux_embedded_hal as lin_hal;
// the eink library
extern crate eink_waveshare_rs;
use eink_waveshare_rs::{
epd2in9::{
EPD2in9,
Buffer2in9,
},
graphics::{Display, DisplayRotation},
prelude::*,
};
use lin_hal::spidev::{self, SpidevOptions};
use lin_hal::{Pin, Spidev};
use lin_hal::sysfs_gpio::Direction;
use lin_hal::Delay;
extern crate embedded_graphics;
use embedded_graphics::coord::Coord;
use embedded_graphics::fonts::{Font6x8};
use embedded_graphics::prelude::*;
//use embedded_graphics::primitives::{Circle, Line};
use embedded_graphics::Drawing;
extern crate embedded_hal;
use embedded_hal::prelude::*;
// activate spi, gpio in raspi-config
// needs to be run with sudo because of some sysfs_gpio permission problems and follow-up timing problems
// see https://github.com/rust-embedded/rust-sysfs-gpio/issues/5 and follow-up issues
// DigitalIn Hack as long as it's not in the linux_embedded_hal
// from https://github.com/rudihorn/max31865/blob/extra_examples/examples/rpi.rs
// (slightly changed now as OutputPin doesn't provide is_high and is_low anymore)
use embedded_hal::digital::{InputPin};
//TODO: Remove when linux_embedded_hal implements InputPin
struct HackInputPin<'a> {
pin: &'a Pin
}
//TODO: Remove when linux_embedded_hal implements InputPin
impl<'a> HackInputPin<'a> {
fn new(p : &'a Pin) -> HackInputPin {
HackInputPin {
pin: p
}
}
}
//TODO: Remove when linux_embedded_hal implements InputPin
// for now it defaults to is_low if an error appears
// could be handled better!
impl<'a> InputPin for HackInputPin<'a> {
fn is_low(&self) -> bool {
self.pin.get_value().unwrap_or(0) == 0
}
fn is_high(&self) -> bool {
!self.is_low()
}
}
//TODO: Test this implemenation
//BE CAREFUL: this wasn't tested yet
fn main() {
run().unwrap();
}
fn run() -> Result<(), std::io::Error> {
// Configure SPI
// SPI settings are from eink-waveshare-rs documenation
let mut spi = Spidev::open("/dev/spidev0.0").expect("spidev directory");
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(4_000_000)
.mode(spidev::SPI_MODE_0)
.build();
spi.configure(&options).expect("spi configuration");
// Configure Digital I/O Pin to be used as Chip Select for SPI
let cs_pin = Pin::new(26);//BCM7 CE0
cs_pin.export().expect("cs_pin export");
while !cs_pin.is_exported() {}
cs_pin.set_direction(Direction::Out).expect("cs_pin Direction");
cs_pin.set_value(1).expect("cs_pin Value set to 1");
// Configure Busy Input Pin
let busy = Pin::new(5);//pin 29
busy.export().expect("busy export");
while !busy.is_exported() {}
busy.set_direction(Direction::In).expect("busy Direction");
//busy.set_value(1).expect("busy Value set to 1");
let busy_in = HackInputPin::new(&busy);
// Configure Data/Command OutputPin
let dc = Pin::new(6); //pin 31 //bcm6
dc.export().expect("dc export");
while !dc.is_exported() {}
dc.set_direction(Direction::Out).expect("dc Direction");
dc.set_value(1).expect("dc Value set to 1");
// Configure Reset OutputPin
let rst = Pin::new(16); //pin 36 //bcm16
rst.export().expect("rst export");
while !rst.is_exported() {}
rst.set_direction(Direction::Out).expect("rst Direction");
rst.set_value(1).expect("rst Value set to 1");
// Configure Delay
let mut delay = Delay {};
// Setup of the needed pins is finished here
// Now the "real" usage of the eink-waveshare-rs crate begins
let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
// Clear the full screen
epd.clear_frame(&mut spi).expect("clear frame 1");
epd.display_frame(&mut spi).expect("disp 1");
println!("Test all the rotations");
let mut buffer = Buffer2in9::default();
let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);
epd.update_frame(&mut spi, display.buffer()).unwrap();
epd.display_frame(&mut spi);
display.set_rotation(DisplayRotation::Rotate0);
display.draw(
Font6x8::render_str("Rotate 0!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Font6x8::render_str("Rotate 90!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate180);
display.draw(
Font6x8::render_str("Rotate 180!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate270);
display.draw(
Font6x8::render_str("Rotate 270!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
// Display updated frame
epd.update_frame(&mut spi, &display.buffer()).unwrap();
epd.display_frame(&mut spi).expect("display frame new graphics");
delay.delay_ms(5000u16);
// a quickly moving `Hello World!`
display.set_rotation(DisplayRotation::Rotate0);
epd.set_lut_quick(&mut spi).expect("SET LUT QUICK error");
let limit = 20;
for i in 0..limit {
println!("Moving Hello World. Loop {} from {}", (i+1), limit);
display.draw(
Font6x8::render_str(" Hello World! ")
.with_style(Style {
fill_color: Some(Color::White),
stroke_color: Some(Color::Black),
stroke_width: 0u8, // Has no effect on fonts
})
.translate(Coord::new(5 + i*6, 50))
.into_iter(),
);
epd.update_frame(&mut spi, &display.buffer()).unwrap();
epd.display_frame(&mut spi).expect("display frame new graphics");
}
// Set the EPD to sleep
epd.sleep(&mut spi).expect("sleep");
Ok(())
}

6
examples/embedded_linux_epd4in2/Cargo.toml

@ -11,4 +11,10 @@ eink_waveshare_rs = { path = "../../", default-features = false, features = ["ep
linux-embedded-hal = "0.2.0"
embedded-graphics = "0.4.3"
# embedded-graphics = {git = "https://github.com/caemor/embedded-graphics", branch = "master"}
# embedded-graphics = {git = "https://github.com/jamwaffles/embedded-graphics", branch = "master"}
embedded-hal = { version = "0.2.1", features = ["unproven"] }

197
examples/embedded_linux_epd4in2/src/main.rs

@ -6,12 +6,21 @@ extern crate eink_waveshare_rs;
use eink_waveshare_rs::{
EPD4in2,
drawing::{Graphics},
color::Color,
WaveshareDisplay,
epd4in2::{
EPD4in2,
Buffer4in2,
},
graphics::{Display, DisplayRotation},
prelude::*,
};
extern crate embedded_graphics;
use embedded_graphics::coord::Coord;
use embedded_graphics::fonts::{Font6x8, Font12x16};
use embedded_graphics::prelude::*;
use embedded_graphics::primitives::{Circle, Line};
use embedded_graphics::Drawing;
use lin_hal::spidev::{self, SpidevOptions};
use lin_hal::{Pin, Spidev};
use lin_hal::sysfs_gpio::Direction;
@ -43,8 +52,6 @@ impl<'a> HackInputPin<'a> {
}
}
//TODO: make it safer?? or handle the errors better?
// now it defaults to is_low if an error appears
impl<'a> InputPin for HackInputPin<'a> {
fn is_low(&self) -> bool {
self.pin.get_value().unwrap_or(0) == 0
@ -56,13 +63,9 @@ impl<'a> InputPin for HackInputPin<'a> {
}
/*
*
* BE CAREFUL: this wasn't tested yet, and the pins are also not choosen correctly (just some random ones atm)
*
*/
fn main() {
run().map_err(|e| println!("{}", e.to_string()));
run().map_err(|e| println!("{}", e.to_string())).unwrap();
}
@ -114,63 +117,121 @@ fn run() -> Result<(), std::io::Error> {
//fixed currently with the HackInputPin, see further above
let mut epd4in2 = EPD4in2::new(&mut spi, cs, busy_in, dc, rst, &mut delay).expect("eink initalize error");
//let mut buffer = [0u8, epd4in2.get_width() / 8 * epd4in2.get_height()];
let mut buffer = [0u8; 15000];
// draw something
let mut graphics = Graphics::new(400, 300, &mut buffer);
graphics.clear(&Color::White);
graphics.draw_line(0,0,400,300, &Color::Black);
graphics.draw_filled_rectangle(200,200, 230, 230, &Color::Black);
graphics.draw_line(202,202,218,228, &Color::White);
graphics.draw_circle(200, 150, 130, &Color::Black);
graphics.draw_pixel(390, 290, &Color::Black);
graphics.draw_horizontal_line(0, 150, 400, &Color::Black);
graphics.draw_vertical_line(200, 50, 200, &Color::Black);
epd4in2.clear_frame(&mut spi).expect("clear frame error");
epd4in2.update_frame(&mut spi, graphics.get_buffer()).expect("update frame error");
epd4in2.display_frame(&mut spi)?;
delay.delay_ms(3000u16);
epd4in2.clear_frame(&mut spi)?;
//Test fast updating a bit more
let mut small_buffer = [0x00; 128];
let mut circle_graphics = Graphics::new(32,32, &mut small_buffer);
circle_graphics.draw_circle(16,16, 10, &Color::Black);
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 16,16, 32, 32).expect("update frame error");
epd4in2.display_frame(&mut spi)?;
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 128,64, 32, 32).expect("update partial frame error");
epd4in2.display_frame(&mut spi)?;
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 320,24, 32, 32).expect("update partial frame error");
epd4in2.display_frame(&mut spi)?;
epd4in2.update_partial_frame(&mut spi, circle_graphics.get_buffer(), 160,240, 32, 32).expect("update partial frame error");
epd4in2.display_frame(&mut spi)?;
delay.delay_ms(3000u16);
println!("Test all the rotations");
let mut buffer = Buffer4in2::default();
let mut display = Display::new(epd4in2.width(), epd4in2.height(), &mut buffer.buffer);
display.set_rotation(DisplayRotation::Rotate0);
display.draw(
Font6x8::render_str("Rotate 0!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Font6x8::render_str("Rotate 90!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate180);
display.draw(
Font6x8::render_str("Rotate 180!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
display.set_rotation(DisplayRotation::Rotate270);
display.draw(
Font6x8::render_str("Rotate 270!")
.with_stroke(Some(Color::Black))
.with_fill(Some(Color::White))
.translate(Coord::new(5, 50))
.into_iter(),
);
epd4in2.update_frame(&mut spi, &display.buffer()).unwrap();
epd4in2.display_frame(&mut spi).expect("display frame new graphics");
delay.delay_ms(5000u16);
println!("Now test new graphics with default rotation and some special stuff:");
display.clear_buffer(Color::White);
// draw a analog clock
display.draw(
Circle::new(Coord::new(64, 64), 64)
.with_stroke(Some(Color::Black))
.into_iter(),
);
display.draw(
Line::new(Coord::new(64, 64), Coord::new(0, 64))
.with_stroke(Some(Color::Black))
.into_iter(),
);
display.draw(
Line::new(Coord::new(64, 64), Coord::new(80, 80))
.with_stroke(Some(Color::Black))
.into_iter(),
);
// draw white on black background
display.draw(
Font6x8::render_str("It's working-WoB!")
// Using Style here
.with_style(Style {
fill_color: Some(Color::Black),
stroke_color: Some(Color::White),
stroke_width: 0u8, // Has no effect on fonts
})
.translate(Coord::new(175, 250))
.into_iter(),
);
// use bigger/different font
display.draw(
Font12x16::render_str("It's working-BoW!")
// Using Style here
.with_style(Style {
fill_color: Some(Color::White),
stroke_color: Some(Color::Black),
stroke_width: 0u8, // Has no effect on fonts
})
.translate(Coord::new(50, 200))
.into_iter(),
);
//pub fn draw_string_8x8(&self, buffer: &mut[u8], x0: u16, y0: u16, input: &str, color: &Color) {
graphics.draw_string_8x8(16, 16, "hello", &Color::Black);
graphics.draw_char_8x8(250, 250, '#', &Color::Black);
graphics.draw_char_8x8(300, 16, '7', &Color::Black);
epd4in2.update_frame(&mut spi, graphics.get_buffer())?;
epd4in2.display_frame(&mut spi)?;
// a moving `Hello World!`
let limit = 10;
for i in 0..limit {
println!("Moving Hello World. Loop {} from {}", (i+1), limit);
display.draw(
Font6x8::render_str(" Hello World! ")
.with_style(Style {
fill_color: Some(Color::White),
stroke_color: Some(Color::Black),
stroke_width: 0u8, // Has no effect on fonts
})
.translate(Coord::new(5 + i*12, 50))
.into_iter(),
);
epd4in2.update_frame(&mut spi, &display.buffer()).unwrap();
epd4in2.display_frame(&mut spi).expect("display frame new graphics");
delay.delay_ms(1_000u16);
}
delay.delay_ms(3000u16);
println!("Finished tests - going to sleep");
epd4in2.sleep(&mut spi)
}
}

7
examples/stm32f3discovery/src/main.rs

@ -26,11 +26,10 @@ extern crate eink_waveshare_rs;
use eink_waveshare_rs::{
EPD1in54,
epd1in54::EPD1in54,
SPI_MODE,
//drawing::{Graphics},
color::Color,
WaveshareDisplay,
//drawing_old::{Graphics},
prelude::*,
};

97
src/color.rs

@ -1,10 +1,17 @@
/// Only for the B/W Displays atm
//! B/W Color for EPDs
/// Only for the Black/White-Displays
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Color {
/// Black color
Black,
/// White color
White,
}
//TODO: Rename get_bit_value to bit() and get_byte_value to byte() ?
impl Color {
/// Get the color encoding of the color for one bit
pub fn get_bit_value(&self) -> u8 {
@ -22,54 +29,68 @@ impl Color {
}
}
/// Get the color encoding of a specific bit in a byte
///
/// input is the byte where one bit is gonna be selected
/// pos is counted from the left (highest value) from 0 to 7
/// remember: 1 is white, 0 is black
/// Color is the color you want to draw with in the foreground
pub(crate) fn get_color(input: u8, pos: u8, color: &Color) -> Color {
if Color::is_drawable_pixel(input, pos) {
Color::normal_color(color)
} else {
Color::inverse_color(color)
/// Parses from u8 to Color
fn from_u8(val: u8) -> Self {
match val {
0 => Color::Black,
1 => Color::White,
e => panic!("DisplayColor only parses 0 and 1 (Black and White) and not `{}`", e),
}
}
// Inverses the given color from Black to White or from White to Black
fn inverse_color(color: &Color) -> Color {
match color {
/// Returns the inverse of the given color.
///
/// Black returns White and White returns Black
pub fn inverse(&self) -> Color {
match self {
Color::White => Color::Black,
Color::Black => Color::White,
}
}
}
// Gives you a new owned copy of the color
//TODO: just use clone?
fn normal_color(color: &Color) -> Color {
match color {
Color::White => Color::White,
Color::Black => Color::Black,
}
#[cfg(feature = "graphics")]
use embedded_graphics::prelude::*;
#[cfg(feature = "graphics")]
impl PixelColor for Color {}
impl From<u8> for Color {
fn from(value: u8) -> Self {
Color::from_u8(value)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn from_u8() {
assert_eq!(Color::Black, Color::from(0u8));
assert_eq!(Color::White, Color::from(1u8));
}
//position counted from the left (highest value) from 0 to 7
//remember: 1 is white, 0 is black
pub(crate) fn is_drawable_pixel(input: u8, pos: u8) -> bool {
((input >> (7 - pos)) & 1u8) > 0u8
// test all values aside from 0 and 1 which all should panic
#[test]
fn from_u8_panic() {
for val in 2..=u8::max_value() {
extern crate std;
let result = std::panic::catch_unwind(|| Color::from(val));
assert!(result.is_err());
}
}
//TODO: does basically the same as get_color, so remove one of them?
pub(crate) fn convert_color(input: u8, pos: u8, foreground_color: &Color) -> Color {
//match color:
// - white for "nothing to draw"/background drawing
// - black for pixel to draw
//
//foreground color is the color you want to have in the foreground
if Color::is_drawable_pixel(input, pos) {
Color::normal_color(foreground_color)
} else {
Color::inverse_color(foreground_color)
}
#[test]
fn u8_conversion_black() {
assert_eq!(Color::from(Color::Black.get_bit_value()), Color::Black);
assert_eq!(Color::from(0u8).get_bit_value(), 0u8);
}
#[test]
fn u8_conversion_white() {
assert_eq!(Color::from(Color::White.get_bit_value()), Color::White);
assert_eq!(Color::from(1u8).get_bit_value(), 1u8);
}
}

759
src/drawing/font.rs

@ -1,759 +0,0 @@
//width must be multiple of 8
//
//chars are build in the bitmap like this example of a width 16, height 2 font:
//12
//34
// first char is the first ascii letter you want
#[allow(dead_code)]
pub struct Font<'a> {
width: u8,
height: u8,
first_char: u8,
last_char: u8,
bitmap: &'a [u8],
widthmap: &'a [u8],
}
impl<'a> Font<'a> {
/// Panics if either Bitmap or Widthmap of the Font are to small for the amount and size of chars
pub fn new(
width: u8,
height: u8,
first_char: u8,
last_char: u8,
bitmap: &'a [u8],
widthmap: &'a [u8],
) -> Font<'a> {
//Assertion so it shouldn't be able to panic later
let length_of_char = width as usize / 8 * height as usize;
let amount_of_chars = last_char as usize - first_char as usize + 1;
assert!(bitmap.len() >= amount_of_chars * length_of_char);
assert!(widthmap.len() >= amount_of_chars);
Font {
width,
height,
first_char,
last_char,
bitmap,
widthmap,
}
}
fn get_length_of_char(&self) -> usize {
self.width as usize / 8 * self.height as usize
}
fn get_char_pos(&self, input: char) -> usize {
(input as usize - self.first_char as usize)
}
/// Can panic, when end_pos > bitmap.len, should be caught in Font::new already
pub(crate) fn get_char(&'a self, input: char) -> &'a [u8] {
let start_pos = self.get_char_pos(input) * self.get_length_of_char();
let end_pos = start_pos + self.get_length_of_char();
&self.bitmap[start_pos..end_pos]
}
/// Can panic, when get_char_pos > widthmap.len(), should be caught in Font::new already
pub(crate) fn get_char_width(&self, input: char) -> u8 {
self.widthmap[self.get_char_pos(input)]
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn fonts_test() {
// don#t draw this, as it's just a test and not thought for drawing
// because the bitmap has column-bytes here, which is not what we use
// and you will get not get what you expect on your eink-screen
// but that doesn't change the "value" of the test
let bitmap = [
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, // '!'
0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, // '"'
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x00, 0x00, // '#'
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x00, 0x00, // '$'
];
let widthmap = [8, 8, 8, 8];
let font = Font::new(8, 8, '!' as u8, '$' as u8, &bitmap, &widthmap);
let hashtag = [0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x00, 0x00];
assert_eq!(font.get_char('#'), hashtag);
assert_eq!(font.get_char('$')[7], 0x00);
assert_eq!(font.get_char_width('#'), widthmap[2]);
assert_eq!(font.get_char_width('$'), widthmap[3]);
}
#[test]
fn bitmap_8x8_test() {
let and = [0x36, 0x49, 0x55, 0x22, 0x50, 0x00, 0x00, 0x00];
let zero = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
let first_value = [0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00];
let last_value = [0x00, 0x41, 0x36, 0x08, 0x00, 0x00, 0x00, 0x00];
assert_eq!(bitmap_8x8('&'), and);
assert_eq!(bitmap_8x8('ß'), zero);
assert_eq!(bitmap_8x8('°'), zero);
assert_eq!(bitmap_8x8('!'), first_value);
assert_eq!(bitmap_8x8('}'), last_value);
assert_eq!(bitmap_8x8('0')[1], 0x3E);
}
}
//bad font as the order is not the one we want to use
//goes from bottom left -> up -> right
pub(crate) fn bitmap_8x8(input: char) -> [u8; 8] {
// Populate the array with the data from the character array at the right index
match input {
'!' => [0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00],
'"' => [0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00],
'#' => [0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, 0x00, 0x00],
'$' => [0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, 0x00, 0x00],
'%' => [0x23, 0x13, 0x08, 0x64, 0x62, 0x00, 0x00, 0x00],
'&' => [0x36, 0x49, 0x55, 0x22, 0x50, 0x00, 0x00, 0x00],
'\'' => [0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00],
'(' => [0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00],
')' => [0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00],
'*' => [0x08, 0x2A, 0x1C, 0x2A, 0x08, 0x00, 0x00, 0x00],
'+' => [0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00],
',' => [0x00, 0x50, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00],
'-' => [0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00],
'.' => [0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00],
'/' => [0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00],
'0' => [0x1C, 0x3E, 0x61, 0x41, 0x43, 0x3E, 0x1C, 0x00],
'1' => [0x40, 0x42, 0x7F, 0x7F, 0x40, 0x40, 0x00, 0x00],
'2' => [0x62, 0x73, 0x79, 0x59, 0x5D, 0x4F, 0x46, 0x00],
'3' => [0x20, 0x61, 0x49, 0x4D, 0x4F, 0x7B, 0x31, 0x00],
'4' => [0x18, 0x1C, 0x16, 0x13, 0x7F, 0x7F, 0x10, 0x00],
'5' => [0x27, 0x67, 0x45, 0x45, 0x45, 0x7D, 0x38, 0x00],
'6' => [0x3C, 0x7E, 0x4B, 0x49, 0x49, 0x79, 0x30, 0x00],
'7' => [0x03, 0x03, 0x71, 0x79, 0x0D, 0x07, 0x03, 0x00],
'8' => [0x36, 0x7F, 0x49, 0x49, 0x49, 0x7F, 0x36, 0x00],
'9' => [0x06, 0x4F, 0x49, 0x49, 0x69, 0x3F, 0x1E, 0x00],
':' => [0x00, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00],
';' => [0x00, 0x56, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00],
'<' => [0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00],
'=' => [0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00],
'>' => [0x41, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00],
'?' => [0x02, 0x01, 0x51, 0x09, 0x06, 0x00, 0x00, 0x00],
'@' => [0x32, 0x49, 0x79, 0x41, 0x3E, 0x00, 0x00, 0x00],
'A' => [0x7E, 0x11, 0x11, 0x11, 0x7E, 0x00, 0x00, 0x00],
'B' => [0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00],
'C' => [0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, 0x00, 0x00],
'D' => [0x7F, 0x7F, 0x41, 0x41, 0x63, 0x3E, 0x1C, 0x00],
'E' => [0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00, 0x00],
'F' => [0x7F, 0x09, 0x09, 0x01, 0x01, 0x00, 0x00, 0x00],
'G' => [0x3E, 0x41, 0x41, 0x51, 0x32, 0x00, 0x00, 0x00],
'H' => [0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x00],
'I' => [0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, 0x00, 0x00],
'J' => [0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, 0x00, 0x00],
'K' => [0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00],
'L' => [0x7F, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00],
'M' => [0x7F, 0x02, 0x04, 0x02, 0x7F, 0x00, 0x00, 0x00],
'N' => [0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, 0x00, 0x00],
'O' => [0x3E, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x3E, 0x00],
'P' => [0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00],
'Q' => [0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, 0x00, 0x00],
'R' => [0x7F, 0x7F, 0x11, 0x31, 0x79, 0x6F, 0x4E, 0x00],
'S' => [0x46, 0x49, 0x49, 0x49, 0x31, 0x00, 0x00, 0x00],
'T' => [0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, 0x00, 0x00],
'U' => [0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, 0x00, 0x00],
'V' => [0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, 0x00, 0x00],
'W' => [0x7F, 0x7F, 0x38, 0x1C, 0x38, 0x7F, 0x7F, 0x00],
'X' => [0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x00, 0x00],
'Y' => [0x03, 0x04, 0x78, 0x04, 0x03, 0x00, 0x00, 0x00],
'Z' => [0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x00, 0x00],
'[' => [0x00, 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00, 0x00],
'\\' => [0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00],
']' => [0x41, 0x41, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00],
'^' => [0x04, 0x02, 0x01, 0x02, 0x04, 0x00, 0x00, 0x00],
'_' => [0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00],
'`' => [0x00, 0x01, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00],
'a' => [0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x00, 0x00],
'b' => [0x7F, 0x48, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00],
'c' => [0x38, 0x44, 0x44, 0x44, 0x20, 0x00, 0x00, 0x00],
'd' => [0x38, 0x44, 0x44, 0x48, 0x7F, 0x00, 0x00, 0x00],
'e' => [0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x00, 0x00],
'f' => [0x08, 0x7E, 0x09, 0x01, 0x02, 0x00, 0x00, 0x00],
'g' => [0x08, 0x14, 0x54, 0x54, 0x3C, 0x00, 0x00, 0x00],
'h' => [0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00],
'i' => [0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, 0x00, 0x00],
'j' => [0x20, 0x40, 0x44, 0x3D, 0x00, 0x00, 0x00, 0x00],
'k' => [0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00],
'l' => [0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, 0x00, 0x00],
'm' => [0x7C, 0x04, 0x18, 0x04, 0x78, 0x00, 0x00, 0x00],
'n' => [0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00],
'o' => [0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00],
'p' => [0x7C, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00],
'q' => [0x08, 0x14, 0x14, 0x18, 0x7C, 0x00, 0x00, 0x00],
'r' => [0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, 0x00, 0x00],
's' => [0x48, 0x54, 0x54, 0x54, 0x20, 0x00, 0x00, 0x00],
't' => [0x04, 0x3F, 0x44, 0x40, 0x20, 0x00, 0x00, 0x00],
'u' => [0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, 0x00, 0x00],
'v' => [0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, 0x00, 0x00],
'w' => [0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, 0x00, 0x00],
'x' => [0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00],
'y' => [0x0C, 0x50, 0x50, 0x50, 0x3C, 0x00, 0x00, 0x00],
'z' => [0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00, 0x00],
'{' => [0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x00],
'|' => [0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00],
'}' => [0x00, 0x41, 0x36, 0x08, 0x00, 0x00, 0x00, 0x00],
_ => [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
}
}
/*
pub(crate) const VCR_OSD_MONO_Bitmap = [
af afa 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF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0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F,
0xF0, 0xFF, 0x03, 0xF0, 0x3F, 0x03, 0xF0, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFC, 0x0F, 0xC0, 0xFC, 0x0F, 0xC0, 0xFF, 0x0F, 0xF0, 0x0F, 0x00, 0xF0,
0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x03, 0xF0, 0x3F,
0x03, 0xF0, 0x3F, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0,
0x0F, 0x00, 0xF0, 0xFF, 0x0F, 0xF0, 0xFC, 0x0F, 0xC0, 0xFC, 0x0F, 0xC0,
0x0F, 0xC0, 0x30, 0xFC, 0x03, 0x3F, 0xF0, 0xF3, 0xFF, 0x0F, 0xF0, 0xFF,
0xCF, 0x0F, 0xFC, 0xC0, 0x3F, 0x0C, 0x03, 0xF0 ];
// uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
// uint8_t width, height; // Bitmap dimensions in pixels
// uint8_t xAdvance; // Distance to advance cursor (x axis)
//int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
pub(crate) const VCR_OSD_MONO_Glyphs = [ //: [u8; 44] = [
[ 0, 0, 0, 24, 0, 1 ], // 0x20 ' '
[ 0, 4, 28, 24, 8, -29 ], // 0x21 '!'
[ 14, 16, 8, 24, 4, -29 ], // 0x22 '"'
[ 30, 20, 26, 24, 2, -29 ], // 0x23 '#'
[ 95, 20, 28, 24, 2, -29 ], // 0x24 '$'
[ 165, 20, 28, 24, 2, -29 ], // 0x25 '%'
[ 235, 20, 32, 24, 2, -33 ], // 0x26 '&'
[ 315, 6, 8, 24, 8, -29 ], // 0x27 '''
[ 321, 10, 32, 24, 6, -33 ], // 0x28 '('
[ 361, 10, 32, 24, 8, -33 ], // 0x29 ')'
[ 401, 16, 18, 24, 4, -31 ], // 0x2A '*'
[ 437, 20, 20, 24, 2, -25 ], // 0x2B '+'
[ 487, 8, 8, 24, 6, -9 ], // 0x2C ','
[ 495, 16, 4, 24, 4, -17 ], // 0x2D '-'
[ 503, 4, 4, 24, 8, -5 ], // 0x2E '.'
[ 505, 20, 28, 24, 2, -29 ], // 0x2F '/'
[ 575, 20, 28, 24, 2, -29 ], // 0x30 '0'
[ 645, 12, 28, 24, 6, -29 ], // 0x31 '1'
[ 687, 20, 28, 24, 2, -29 ], // 0x32 '2'
[ 757, 20, 28, 24, 2, -29 ], // 0x33 '3'
[ 827, 20, 28, 24, 2, -29 ], // 0x34 '4'
[ 897, 20, 28, 24, 2, -29 ], // 0x35 '5'
[ 967, 20, 28, 24, 2, -29 ], // 0x36 '6'
[ 1037, 20, 28, 24, 2, -29 ], // 0x37 '7'
[ 1107, 20, 28, 24, 2, -29 ], // 0x38 '8'
[ 1177, 20, 28, 24, 2, -29 ], // 0x39 '9'
[ 1247, 4, 20, 24, 8, -25 ], // 0x3A ':'
[ 1257, 8, 24, 24, 4, -25 ], // 0x3B ';'
[ 1281, 16, 30, 24, 4, -31 ], // 0x3C '<'
[ 1341, 20, 12, 24, 2, -21 ], // 0x3D '='
[ 1371, 16, 30, 24, 4, -31 ], // 0x3E '>'
[ 1431, 20, 28, 24, 2, -29 ], // 0x3F '?'
[ 1501, 20, 24, 24, 2, -27 ], // 0x40 '@'
[ 1561, 20, 28, 24, 2, -29 ], // 0x41 'A'
[ 1631, 20, 28, 24, 2, -29 ], // 0x42 'B'
[ 1701, 20, 28, 24, 2, -29 ], // 0x43 'C'
[ 1771, 20, 28, 24, 2, -29 ], // 0x44 'D'
[ 1841, 20, 28, 24, 2, -29 ], // 0x45 'E'
[ 1911, 20, 28, 24, 2, -29 ], // 0x46 'F'
[ 1981, 20, 28, 24, 2, -29 ], // 0x47 'G'
[ 2051, 20, 28, 24, 2, -29 ], // 0x48 'H'
[ 2121, 12, 28, 24, 6, -29 ], // 0x49 'I'
[ 2163, 20, 28, 24, 2, -29 ], // 0x4A 'J'
[ 2233, 20, 28, 24, 2, -29 ], // 0x4B 'K'
[ 2303, 20, 28, 24, 2, -29 ], // 0x4C 'L'
[ 2373, 20, 28, 24, 2, -29 ], // 0x4D 'M'
[ 2443, 20, 28, 24, 2, -29 ], // 0x4E 'N'
[ 2513, 20, 28, 24, 2, -29 ], // 0x4F 'O'
[ 2583, 20, 28, 24, 2, -29 ], // 0x50 'P'
[ 2653, 20, 28, 24, 2, -29 ], // 0x51 'Q'
[ 2723, 20, 28, 24, 2, -29 ], // 0x52 'R'
[ 2793, 20, 28, 24, 2, -29 ], // 0x53 'S'
[ 2863, 20, 28, 24, 2, -29 ], // 0x54 'T'
[ 2933, 20, 28, 24, 2, -29 ], // 0x55 'U'
[ 3003, 20, 28, 24, 2, -29 ], // 0x56 'V'
[ 3073, 20, 28, 24, 2, -29 ], // 0x57 'W'
[ 3143, 20, 28, 24, 2, -29 ], // 0x58 'X'
[ 3213, 20, 28, 24, 2, -29 ], // 0x59 'Y'
[ 3283, 20, 28, 24, 2, -29 ], // 0x5A 'Z'
[ 3353, 12, 32, 24, 8, -33 ], // 0x5B '['
[ 3401, 20, 28, 24, 2, -29 ], // 0x5C '\'
[ 3471, 12, 32, 24, 4, -33 ], // 0x5D ']'
[ 3519, 20, 10, 24, 2, -29 ], // 0x5E '^'
[ 3544, 24, 4, 24, 0, -3 ], // 0x5F '_'
[ 3556, 10, 6, 24, 6, -29 ], // 0x60 '`'
[ 3564, 20, 24, 24, 2, -25 ], // 0x61 'a'
[ 3624, 20, 28, 24, 2, -29 ], // 0x62 'b'
[ 3694, 20, 22, 24, 2, -23 ], // 0x63 'c'
[ 3749, 20, 28, 24, 2, -29 ], // 0x64 'd'
[ 3819, 20, 22, 24, 2, -23 ], // 0x65 'e'
[ 3874, 16, 28, 24, 4, -29 ], // 0x66 'f'
[ 3930, 20, 24, 24, 2, -25 ], // 0x67 'g'
[ 3990, 20, 28, 24, 2, -29 ], // 0x68 'h'
[ 4060, 12, 26, 24, 6, -27 ], // 0x69 'i'
[ 4099, 12, 30, 24, 6, -31 ], // 0x6A 'j'
[ 4144, 20, 28, 24, 2, -29 ], // 0x6B 'k'
[ 4214, 4, 28, 24, 10, -29 ], // 0x6C 'l'
[ 4228, 20, 22, 24, 2, -23 ], // 0x6D 'm'
[ 4283, 20, 22, 24, 2, -23 ], // 0x6E 'n'
[ 4338, 20, 22, 24, 2, -23 ], // 0x6F 'o'
[ 4393, 20, 24, 24, 2, -25 ], // 0x70 'p'
[ 4453, 20, 24, 24, 2, -25 ], // 0x71 'q'
[ 4513, 20, 22, 24, 2, -23 ], // 0x72 'r'
[ 4568, 20, 22, 24, 2, -23 ], // 0x73 's'
[ 4623, 12, 28, 24, 6, -29 ], // 0x74 't'
[ 4665, 20, 22, 24, 2, -23 ], // 0x75 'u'
[ 4720, 20, 22, 24, 2, -23 ], // 0x76 'v'
[ 4775, 20, 22, 24, 2, -23 ], // 0x77 'w'
[ 4830, 20, 22, 24, 2, -23 ], // 0x78 'x'
[ 4885, 20, 24, 24, 2, -25 ], // 0x79 'y'
[ 4945, 20, 22, 24, 2, -23 ], // 0x7A 'z'
[ 5000, 12, 32, 24, 6, -33 ], // 0x7B '['
[ 5048, 4, 32, 24, 10, -33 ], // 0x7C '|'
[ 5064, 12, 32, 24, 6, -33 ], // 0x7D ']'
[ 5112, 20, 8, 24, 2, -19 ] ]; // 0x7E '~'
*/
/*
pub(crate) const LUT_VCOM0_QUICK: [u8; 44] = [
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];*/

622
src/drawing/mod.rs

@ -1,622 +0,0 @@
pub mod font;
use self::font::Font;
use color::Color;
#[derive(Clone, Copy)]
pub enum Displayorientation {
/// No rotation
Rotate0,
/// Rotate by 90 degrees clockwise
Rotate90,
/// Rotate by 180 degrees clockwise
Rotate180,
/// Rotate 270 degrees clockwise
Rotate270,
}
//WARNING: Adapt for bigger sized displays!
// pub struct DisplayDescription {
// width: u16,
// height: u16,
// buffer_size: u16
// }
// impl Display_Description {
// pub fn new(width: u16, height: u16, buffer_size: u16) -> Display_Description {
// }
// }
pub enum Display {
Eink42BlackWhite,
}
impl Display {
/// Gets the Dimensions of a dipslay in the following order:
/// - Width
/// - Height
/// - Neccessary Buffersize
pub fn get_dimensions(&self) -> (u16, u16, u16) {
match self {
Display::Eink42BlackWhite => (400, 300, 15000),
}
}
}
#[allow(dead_code)]
pub struct Graphics<'a> {
width: u16,
height: u16,
rotation: Displayorientation,
buffer: &'a mut [u8], //buffer: Box<u8>//[u8; 15000]
}
impl<'a> Graphics<'a> {
/// width needs to be a multiple of 8!
pub fn new(width: u16, height: u16, buffer: &'a mut [u8]) -> Graphics<'a> {
let len = buffer.len();
assert!(width / 8 * height >= len as u16);
Graphics {
width,
height,
rotation: Displayorientation::Rotate0,
buffer,
}
}
/// Clears/Fills the full buffer with `color`
pub fn clear(&mut self, color: &Color) {
for elem in self.buffer.iter_mut() {
*elem = color.get_byte_value();
}
}
pub fn get_buffer(&'a self) -> &'a [u8] {
self.buffer
}
/// Draw a single Pixel with `color`
///
/// limited to i16::max images (buffer_size) at the moment
pub fn draw_pixel(&mut self, x: u16, y: u16, color: &Color) {
let (idx, bit) = match self.rotation {
Displayorientation::Rotate0 | Displayorientation::Rotate180 => (
(x as usize / 8 + (self.width as usize / 8) * y as usize),
0x80 >> (x % 8),
),
Displayorientation::Rotate90 | Displayorientation::Rotate270 => (
y as usize / 8 * self.width as usize + x as usize,
0x80 >> (y % 8),
),
};
if idx >= self.buffer.len() {
return;
}
match color {
Color::Black => {
self.buffer[idx] &= !bit;
}
Color::White => {
self.buffer[idx] |= bit;
}
}
}
/// Draw a single Pixel with `color`
///
/// limited to i16::max images (buffer_size) at the moment
#[allow(dead_code)]
fn draw_byte(&mut self, x: u16, y: u16, filling: u8, color: &Color) {
let idx = match self.rotation {
Displayorientation::Rotate0 | Displayorientation::Rotate180 => {
x as usize / 8 + (self.width as usize / 8) * y as usize
},
Displayorientation::Rotate90 | Displayorientation::Rotate270 => {
y as usize / 8 + (self.width as usize / 8) * x as usize
},
};
if idx >= self.buffer.len() {
return;
}
match color {
Color::Black => {
self.buffer[idx] = !filling;
},
Color::White => {
self.buffer[idx] = filling;
}
}
}
///TODO: test!
pub fn draw_char(&mut self, x0: u16, y0: u16, input: char, font: &Font, color: &Color) {
self.draw_char_helper(x0, y0, input, font, color);
}
///TODO: test!
/// no autobreak line yet
pub fn draw_string(&mut self, x0: u16, y0: u16, input: &str, font: &Font, color: &Color) {
let mut counter = 0;
for input_char in input.chars() {
self.draw_char(x0 + counter, y0, input_char, font, color);
counter += u16::from(font.get_char_width(input_char));
}
}
//TODO: add support for font_height = 0
//TODO: add support for char offset in y direction to reduce font file size
fn draw_char_helper(&mut self, x0: u16, y0: u16, input: char, font: &Font, color: &Color) {
//width: u8, height: u8, charbuffer: &[u8]
//TODO: font.get_char(input) -> FontChar {width, height, [u8]}
//TODO: font.get_char_offset(input) -> u16
let buff = font.get_char(input);
let char_width = font.get_char_width(input);
let mut row_counter = 0;
let mut width_counter = 0u8;
for &elem in buff.iter() {
for _ in 0..8 {
self.draw_pixel(
x0 + u16::from(width_counter),
y0 + row_counter,
&Color::get_color(elem, width_counter % 8, color),
);
//Widthcounter shows how far we are in x direction
width_counter += 1;
// if we have reached
if width_counter >= char_width {
width_counter = 0;
row_counter += 1;
break;
}
}
}
}
/// Draws a single 8x8 Char somewhere (1 pixel padding included)
pub fn draw_char_8x8(&mut self, x0: u16, y0: u16, input: char, color: &Color) {
let mut counter = 0;
// includes special draw_char instructions as this one is ordered columnwise and not rowwise (first byte == first 8 pixel columnwise)
for &elem in (&font::bitmap_8x8(input)).iter() {
for i in 0..8u8 {
self.draw_pixel(
x0 + counter,
y0 + 7 - u16::from(i),
&Color::convert_color(elem, i, color),
)
}
counter += 1;
}
}
/// Draws Strings with 8x8 Chars (1 pixel padding included)
///
/// Is quite small for the 400x300 E-Ink
///
/// no autobreak line yet
pub fn draw_string_8x8(&mut self, x0: u16, y0: u16, input: &str, color: &Color) {
for (counter, input_char) in input.chars().enumerate() {
self.draw_char_8x8(
x0 + counter as u16 * 8,
y0,
input_char,
color,
);
}
}
// void plotLine(int x0, int y0, int x1, int y1)
// {
// int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
// int dy = -abs(y1-y0), sy = y0<y1 ? 1 : -1;
// int err = dx+dy, e2; /* error value e_xy */
// for(;;){ /* loop */
// setPixel(x0,y0);
// if (x0==x1 && y0==y1) break;
// e2 = 2*err;
// if (e2 >= dy) { err += dy; x0 += sx; } /* e_xy+e_x > 0 */
// if (e2 <= dx) { err += dx; y0 += sy; } /* e_xy+e_y < 0 */
// }
// }
//bresenham algorithm for lines
/// draw line
pub fn draw_line(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, color: &Color) {
let mut x0 = x0 as i16;
let x1 = x1 as i16;
let mut y0 = y0 as i16;
let y1 = y1 as i16;
let dx = i16::abs(x1 - x0);
let sx = if x0 < x1 { 1 } else { -1 };
let dy = -i16::abs(y1 - y0);
let sy = if y0 < y1 { 1 } else { -1 };
let mut err = dx + dy;
loop {
self.draw_pixel(x0 as u16, y0 as u16, color);
if x0 == x1 && y0 == y1 {
break;
}
let e2 = 2 * err;
if e2 >= dy {
err += dy;
x0 += sx;
}
if e2 <= dx {
err += dx;
y0 += sy;
}
}
}
/// Draw a horizontal line
/// TODO: maybe optimize by grouping up the bytes? But is it worth the longer and more complicated function? is it even faster?
pub fn draw_horizontal_line(&mut self, x: u16, y: u16, length: u16, color: &Color) {
for i in 0..length {
self.draw_pixel(x + i, y, color);
}
}
/// Draws a vertical line
pub fn draw_vertical_line(&mut self, x: u16, y: u16, length: u16, color: &Color) {
for i in 0..length {
self.draw_pixel(x, y + i, color);
}
}
/// Draws a rectangle. (x0,y0) is top left corner, (x1,y1) bottom right
pub fn draw_rectangle(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, color: &Color) {
let (min_x, max_x) = if x0 <= x1 { (x0, x1) } else { (x1, x0) };
let (min_y, max_y) = if y0 <= y1 { (y0, y1) } else { (y1, y0) };
let x_len = max_x - min_x;
let y_len = max_y - min_y;
self.draw_horizontal_line(min_x, min_y, x_len, color);
self.draw_horizontal_line(min_x, max_y, x_len, color);
self.draw_vertical_line(min_x, min_y, y_len, color);
self.draw_vertical_line(max_x, min_y, y_len, color);
}
/// Draws a filled rectangle. For more info see draw_rectangle
pub fn draw_filled_rectangle(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, color: &Color) {
let (min_x, max_x) = if x0 <= x1 { (x0, x1) } else { (x1, x0) };
let (min_y, max_y) = if y0 <= y1 { (y0, y1) } else { (y1, y0) };
let x_len = max_x - min_x;
let y_len = max_y - min_y;
for i in 0..y_len {
self.draw_horizontal_line(min_x, min_y + i, x_len, color);
}
}
fn draw_pixel_helper(&mut self, x: i16, y: i16, color: &Color) {
if x >= 0 && y >= 0 {
self.draw_pixel(x as u16, y as u16, color);
}
}
fn draw_circle_helper(&mut self, x0: u16, y0: u16, radius: u16, filled: bool, color: &Color) {
let mut x = radius - 1;
let mut y = 0;
let mut dx = 1;
let mut dy = 1;
let mut err: i16 = dx - 2 * radius as i16;
while x >= y {
if filled {
self.circle_helper_filled_putpixel(x0, y0, x, y, color);
} else {
self.circle_helper_putpixel(x0, y0, x, y, color);
}
if err <= 0 {
y += 1;
err += dy;
dy += 2;
}
if err > 0 {
x -= 1;
dx += 2;
err += dx - 2 * radius as i16;
}
}
}
fn circle_helper_putpixel(&mut self, x0: u16, y0: u16, x: u16, y: u16, color: &Color) {
self.draw_horizontal_line(x0 - x, y0 + y, 2 * x, color);
// self.draw_pixel(buffer, x0 + x, y0 + y, color);
// self.draw_pixel(buffer, x0 - x, y0 + y, color);
self.draw_horizontal_line(x0 - y, y0 + x, 2 * y, color);
// self.draw_pixel(buffer, x0 + y, y0 + x, color);
// self.draw_pixel(buffer, x0 - y, y0 + x, color);
self.draw_horizontal_line(x0 - x, y0 - y, 2 * x, color);
// self.draw_pixel(buffer, x0 - x, y0 - y, color);
// self.draw_pixel(buffer, x0 + x, y0 - y, color);
self.draw_horizontal_line(x0 - y, y0 - y, 2 * y, color);
// self.draw_pixel(buffer, x0 - y, y0 - x, color);
// self.draw_pixel(buffer, x0 + y, y0 - x, color);
}
//TODO: Test
fn circle_helper_filled_putpixel(&mut self, x0: u16, y0: u16, x: u16, y: u16, color: &Color) {
self.draw_pixel(x0 + x, y0 + y, color);
self.draw_pixel(x0 + y, y0 + x, color);
self.draw_pixel(x0 - y, y0 + x, color);
self.draw_pixel(x0 - x, y0 + y, color);
self.draw_pixel(x0 - x, y0 - y, color);
self.draw_pixel(x0 - y, y0 - x, color);
self.draw_pixel(x0 + y, y0 - x, color);
self.draw_pixel(x0 + x, y0 - y, color);
}
///TODO: test if circle looks good
/// Draws a circle
pub fn draw_circle(&mut self, x0: u16, y0: u16, radius: u16, color: &Color) {
self.draw_circle_helper(x0, y0, radius, false, color);
}
///TODO: test if circle looks good
/// Draws a circle
pub fn draw_circle2(&mut self, x: u16, y: u16, radius: u16, color: &Color) {
let radius = radius as i16;
let x_mid = x as i16;
let y_mid = y as i16;
let mut x_pos: i16 = 0 - radius;
let mut y_pos = 0;
let mut err: i16 = 2 - 2 * radius;
loop {
self.draw_pixel_helper(x_mid - x_pos, y_mid + y_pos, color);
self.draw_pixel_helper(x_mid - y_pos, y_mid - x_pos, color);
self.draw_pixel_helper(x_mid + x_pos, y_mid - y_pos, color);
self.draw_pixel_helper(x_mid + y_pos, y_mid + x_pos, color);
let radius = err;
if radius <= y_pos {
y_pos += 1;
err += y_pos * 2 + 1;
}
if radius > x_pos || err > y_pos {
x_pos += 1;
err += x_pos * 2 + 1;
}
if x_pos >= 0 {
break;
}
}
}
///TODO: test!
pub fn draw_filled_circle(&mut self, x0: u16, y0: u16, radius: u16, color: &Color) {
self.draw_circle_helper(x0, y0, radius, true, color);
}
}
/*
############ ############ ############ ############
## ## # ##
## ## # ##
## ###### ##### ##
## ###### ##### ##
## ## # ##
## ## # ##
## ############ ############ ##
*/
#[cfg(test)]
mod graphics {
use super::*;
#[test]
fn test_filled_rectangle() {
let mut buffer = [Color::White.get_byte_value(); 150];
let mut graphics = Graphics::new(40, 30, &mut buffer);
graphics.draw_filled_rectangle(0, 0, 40, 30, &Color::Black);
assert_eq!(graphics.buffer[0], Color::Black.get_byte_value());
for &elem in graphics.buffer.iter() {
assert_eq!(elem, Color::Black.get_byte_value());
}
}
/// draw a 4x4 in the top left corner
#[test]
fn test_filled_rectangle2() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_filled_rectangle(0, 0, 4, 4, &Color::Black);
assert_eq!(graphics.buffer[0], 0x0f);
let mut counter = 0;
for &elem in graphics.buffer.iter() {
counter += 1;
if counter <= 4 {
assert_eq!(elem, 0x0f);
} else {
assert_eq!(elem, Color::White.get_byte_value());
}
}
}
#[test]
fn test_horizontal_line() {
let mut buffer = [Color::White.get_byte_value(); 4];
let mut graphics = Graphics::new(16, 2, &mut buffer);
graphics.draw_horizontal_line(1, 0, 14, &Color::Black);
assert_eq!(graphics.buffer[0], 0x80);
assert_eq!(graphics.buffer[1], 0x01);
assert_eq!(graphics.buffer[2], Color::White.get_byte_value());
assert_eq!(graphics.buffer[3], Color::White.get_byte_value());
}
#[test]
fn test_vertical_line() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_vertical_line(0, 0, 8, &Color::Black);
graphics.draw_vertical_line(5, 0, 8, &Color::Black);
assert_eq!(graphics.buffer[0], 0x7b);
for &elem in graphics.buffer.iter() {
assert_eq!(elem, 0x7bu8);
}
}
//test draw_line for compatibility with draw_vertical_line
#[test]
fn draw_line_1() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_vertical_line(5, 0, 8, &Color::Black);
let mut buffer2 = [Color::White.get_byte_value(); 8];
let mut graphics2 = Graphics::new(8, 8, &mut buffer2);
graphics2.draw_line(5, 0, 5, 8, &Color::Black);
for i in 0..graphics.buffer.len() {
assert_eq!(graphics.buffer[i], graphics2.buffer[i]);
}
}
//test draw_line for compatibility with draw_horizontal_line
#[test]
fn draw_line_2() {
let mut buffer = [Color::White.get_byte_value(); 4];
let mut graphics = Graphics::new(16, 2, &mut buffer);
graphics.draw_horizontal_line(1, 0, 14, &Color::Black);
let mut buffer2 = [Color::White.get_byte_value(); 4];
let mut graphics2 = Graphics::new(16, 2, &mut buffer2);
graphics2.draw_line(1, 0, 14, 0, &Color::Black);
for i in 0..graphics.buffer.len() {
assert_eq!(graphics.buffer[i], graphics2.buffer[i]);
}
}
//test draw_line for diago
#[test]
fn draw_line_3() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_line(0, 0, 16, 16, &Color::Black);
for i in 0..graphics.buffer.len() {
assert_eq!(graphics.buffer[i], !(0x80 >> i % 8));
}
}
#[test]
fn test_pixel() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_pixel(1, 0, &Color::Black);
assert_eq!(graphics.buffer[0], !0x40);
let mut buffer = [Color::White.get_byte_value(); 16];
let mut graphics = Graphics::new(16, 8, &mut buffer);
graphics.draw_pixel(9, 0, &Color::Black);
assert_eq!(graphics.buffer[0], Color::White.get_byte_value());
assert_eq!(graphics.buffer[1], !0x40);
}
#[test]
fn test_byte() {
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_byte(0, 0, 0xff, &Color::Black);
assert_eq!(graphics.buffer[0], Color::Black.get_byte_value());
for i in 1..graphics.buffer.len() {
assert_eq!(graphics.buffer[i], Color::White.get_byte_value());
}
graphics.draw_byte(0, 0, 0x5A, &Color::Black);
assert_eq!(graphics.buffer[0], !0x5A);
}
#[test]
fn test_char_with_8x8_font() {
// Test !
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_char_8x8(0, 0, '!', &Color::Black);
for i in 0..5 {
assert_eq!(graphics.buffer[i], !0x20);
}
assert_eq!(graphics.buffer[5], Color::White.get_byte_value());
assert_eq!(graphics.buffer[6], !0x20);
assert_eq!(graphics.buffer[7], Color::White.get_byte_value());
// Test H
let mut buffer = [Color::White.get_byte_value(); 8];
let mut graphics = Graphics::new(8, 8, &mut buffer);
graphics.draw_char_8x8(0, 0, 'H', &Color::Black);
for i in 0..3 {
assert_eq!(graphics.buffer[i], !0x88);
}
assert_eq!(graphics.buffer[3], !0xF8);
for i in 4..7 {
assert_eq!(graphics.buffer[i], !0x88);
}
assert_eq!(graphics.buffer[7], Color::White.get_byte_value());
}
#[test]
fn test_string_with_8x8_font() {
// Test !H
let mut buffer = [Color::White.get_byte_value(); 16];
let mut graphics = Graphics::new(16, 8, &mut buffer);
graphics.draw_string_8x8(0, 0, "!H", &Color::Black);
for i in 0..5 {
assert_eq!(graphics.buffer[i * 2], !0x20);
}
assert_eq!(graphics.buffer[5 * 2], Color::White.get_byte_value());
assert_eq!(graphics.buffer[6 * 2], !0x20);
assert_eq!(graphics.buffer[7 * 2], Color::White.get_byte_value());
for i in 0..3 {
assert_eq!(graphics.buffer[i * 2 + 1], !0x88);
}
assert_eq!(graphics.buffer[3 * 2 + 1], !0xF8);
for i in 4..7 {
assert_eq!(graphics.buffer[i * 2 + 1], !0x88);
}
assert_eq!(graphics.buffer[7 * 2 + 1], Color::White.get_byte_value());
}
}

136
src/epd1in54/graphics.rs

@ -0,0 +1,136 @@
use epd1in54::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
/// Full size buffer for use with the 1in54 EPD
///
/// Can also be manuall constructed:
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
pub struct Buffer1in54BlackWhite {
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
}
impl Default for Buffer1in54BlackWhite {
fn default() -> Self {
Buffer1in54BlackWhite {
buffer: [
DEFAULT_BACKGROUND_COLOR.get_byte_value();
WIDTH as usize * HEIGHT as usize / 8
]
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use graphics::{DisplayRotation, Display};
use embedded_graphics::coord::Coord;
use embedded_graphics::primitives::Line;
use color::Color;
use embedded_graphics::prelude::*;
// test buffer length
#[test]
fn graphics_size() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
assert_eq!(display.buffer().len(), 5000);
}
// test default background color on all bytes
#[test]
fn graphics_default() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
for &byte in display.buffer() {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_0() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
display.draw(
Line::new(Coord::new(0, 0), Coord::new(7, 0))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_90() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Line::new(Coord::new(0, 192), Coord::new(0, 199))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_180() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
display.set_rotation(DisplayRotation::Rotate180);
display.draw(
Line::new(Coord::new(192, 199), Coord::new(199, 199))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;
std::println!("{:?}", buffer);
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_270() {
let mut display1in54 = Buffer1in54BlackWhite::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display1in54.buffer);
display.set_rotation(DisplayRotation::Rotate270);
display.draw(
Line::new(Coord::new(199, 0), Coord::new(199, 7))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;
std::println!("{:?}", buffer);
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
}

80
src/epd1in54/mod.rs

@ -1,35 +1,52 @@
//! A simple Driver for the Waveshare 1.54" E-Ink Display via SPI
//!
//!
//! # Examples from the 4.2" Display. It should work the same for the 1.54" one.
//!
//!
//! # Example for the 1.54 in E-Ink Display
//!
//! ```ignore
//! let mut epd4in2 = EPD4in2::new(spi, cs, busy, dc, rst, delay).unwrap();
//!
//! let mut buffer = [0u8, epd4in2.get_width() / 8 * epd4in2.get_height()];
//!
//! // draw something into the buffer
//! use eink_waveshare_rs::{
//! epd1in54::{EPD1in54, Buffer1in54},
//! graphics::{Display, DisplayRotation},
//! prelude::*,
//! };
//!
//! // Setup EPD
//! let mut epd = EPD1in54::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
//!
//! epd4in2.display_and_transfer_buffer(buffer, None);
//! // Use display graphics
//! let mut buffer = Buffer1in54::default();
//! let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);
//!
//! // Write some hello world in the screenbuffer
//! display.draw(
//! Font6x8::render_str("Hello World!")
//! .with_stroke(Some(Color::Black))
//! .with_fill(Some(Color::White))
//! .translate(Coord::new(5, 50))
//! .into_iter(),
//! );
//!
//! // wait and look at the image
//!
//! epd4in2.clear_frame(None);
//!
//! epd4in2.sleep();
//! // Display updated frame
//! epd.update_frame(&mut spi, &display.buffer()).unwrap();
//! epd.display_frame(&mut spi).expect("display frame new graphics");
//!
//! // Set the EPD to sleep
//! epd.sleep(&mut spi).expect("sleep");
//! ```
const WIDTH: u16 = 200;
const HEIGHT: u16 = 200;
pub const WIDTH: u32 = 200;
pub const HEIGHT: u32 = 200;
//const DPI: u16 = 184;
const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
use hal::{
blocking::{delay::*, spi::Write},
digital::*,
};
use type_a::{command::Command, LUT_FULL_UPDATE, LUT_PARTIAL_UPDATE};
use type_a::{
command::Command,
constants::{LUT_FULL_UPDATE, LUT_PARTIAL_UPDATE}
};
use color::Color;
@ -37,6 +54,9 @@ use traits::{WaveshareDisplay};
use interface::DisplayInterface;
mod graphics;
pub use epd1in54::graphics::Buffer1in54BlackWhite as Buffer1in54;
/// EPD1in54 driver
///
pub struct EPD1in54<SPI, CS, BUSY, DC, RST> {
@ -104,11 +124,11 @@ where
DC: OutputPin,
RST: OutputPin,
{
fn width(&self) -> u16 {
fn width(&self) -> u32 {
WIDTH
}
fn height(&self) -> u16 {
fn height(&self) -> u32 {
HEIGHT
}
@ -152,10 +172,10 @@ where
&mut self,
spi: &mut SPI,
buffer: &[u8],
x: u16,
y: u16,
width: u16,
height: u16,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), SPI::Error> {
self.set_ram_area(spi, x, y, x + width, y + height)?;
self.set_ram_counter(spi, x, y)?;
@ -222,10 +242,10 @@ where
pub(crate) fn set_ram_area(
&mut self,
spi: &mut SPI,
start_x: u16,
start_y: u16,
end_x: u16,
end_y: u16,
start_x: u32,
start_y: u32,
end_x: u32,
end_y: u32,
) -> Result<(), SPI::Error> {
assert!(start_x < end_x);
assert!(start_y < end_y);
@ -246,7 +266,7 @@ where
)
}
pub(crate) fn set_ram_counter(&mut self, spi: &mut SPI, x: u16, y: u16) -> Result<(), SPI::Error> {
pub(crate) fn set_ram_counter(&mut self, spi: &mut SPI, x: u32, y: u32) -> Result<(), SPI::Error> {
// x is positioned in bytes, so the last 3 bits which show the position inside a byte in the ram
// aren't relevant
self.interface.cmd_with_data(spi, Command::SET_RAM_X_ADDRESS_COUNTER, &[(x >> 3) as u8])?;

45
src/epd2in9/graphics.rs

@ -0,0 +1,45 @@
use epd2in9::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
/// Full size buffer for use with the 2in9 EPD
///
/// Can also be manuall constructed:
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
pub struct Buffer2in9 {
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
}
impl Default for Buffer2in9 {
fn default() -> Self {
Buffer2in9 {
buffer: [
DEFAULT_BACKGROUND_COLOR.get_byte_value();
WIDTH as usize * HEIGHT as usize / 8
]
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use graphics::Display;
// test buffer length
#[test]
fn graphics_size() {
let mut buffer = Buffer2in9::default();
let display = Display::new(WIDTH, HEIGHT, &mut buffer.buffer);
assert_eq!(display.buffer().len(), 4736);
}
// test default background color on all bytes
#[test]
fn graphics_default() {
let mut buffer = Buffer2in9::default();
let display = Display::new(WIDTH, HEIGHT, &mut buffer.buffer);
for &byte in display.buffer() {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
}

78
src/epd2in9/mod.rs

@ -1,34 +1,53 @@
//! A simple Driver for the Waveshare 2.9" E-Ink Display via SPI
//!
//! Untested!
//!
//! # Examples from the 4.2" Display. It should work the same for the 2.9" one.
//!
//! # Example for the 2.9 in E-Ink Display
//!
//! ```ignore
//! let mut epd4in2 = EPD4in2::new(spi, cs, busy, dc, rst, delay).unwrap();
//!
//! let mut buffer = [0u8, epd4in2.get_width() / 8 * epd4in2.get_height()];
//!
//! // draw something into the buffer
//!
//! epd4in2.display_and_transfer_buffer(buffer, None);
//! use eink_waveshare_rs::{
//! epd2in9::{EPD2in9, Buffer2in9},
//! graphics::{Display, DisplayRotation},
//! prelude::*,
//! };
//!
//! // Setup EPD
//! let mut epd = EPD2in9::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
//!
//! // wait and look at the image
//! // Use display graphics
//! let mut buffer = Buffer2in9::default();
//! let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);
//!
//! // Write some hello world in the screenbuffer
//! display.draw(
//! Font6x8::render_str("Hello World!")
//! .with_stroke(Some(Color::Black))
//! .with_fill(Some(Color::White))
//! .translate(Coord::new(5, 50))
//! .into_iter(),
//! );
//!
//! epd4in2.clear_frame(None);
//!
//! epd4in2.sleep();
//! // Display updated frame
//! epd.update_frame(&mut spi, &display.buffer()).unwrap();
//! epd.display_frame(&mut spi).expect("display frame new graphics");
//!
//! // Set the EPD to sleep
//! epd.sleep(&mut spi).expect("sleep");
//! ```
const WIDTH: u16 = 128;
const HEIGHT: u16 = 296;
const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
pub const WIDTH: u32 = 128;
pub const HEIGHT: u32 = 296;
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
use hal::{
blocking::{delay::*, spi::Write},
digital::*,
};
use type_a::{command::Command, LUT_FULL_UPDATE, LUT_PARTIAL_UPDATE};
use type_a::{
command::Command,
constants::{LUT_FULL_UPDATE, LUT_PARTIAL_UPDATE}
};
use color::Color;
@ -36,6 +55,9 @@ use traits::*;
use interface::DisplayInterface;
mod graphics;
pub use epd2in9::graphics::Buffer2in9;
/// EPD2in9 driver
///
pub struct EPD2in9<SPI, CS, BUSY, DC, RST> {
@ -99,11 +121,11 @@ where
DC: OutputPin,
RST: OutputPin,
{
fn width(&self) -> u16 {
fn width(&self) -> u32 {
WIDTH
}
fn height(&self) -> u16 {
fn height(&self) -> u32 {
HEIGHT
}
@ -148,10 +170,10 @@ where
&mut self,
spi: &mut SPI,
buffer: &[u8],
x: u16,
y: u16,
width: u16,
height: u16,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), SPI::Error> {
self.set_ram_area(spi, x, y, x + width, y + height)?;
self.set_ram_counter(spi, x, y)?;
@ -217,10 +239,10 @@ where
pub(crate) fn set_ram_area(
&mut self,
spi: &mut SPI,
start_x: u16,
start_y: u16,
end_x: u16,
end_y: u16,
start_x: u32,
start_y: u32,
end_x: u32,
end_y: u32,
) -> Result<(), SPI::Error> {
assert!(start_x < end_x);
assert!(start_y < end_y);
@ -239,7 +261,7 @@ where
)
}
pub(crate) fn set_ram_counter(&mut self, spi: &mut SPI, x: u16, y: u16) -> Result<(), SPI::Error> {
pub(crate) fn set_ram_counter(&mut self, spi: &mut SPI, x: u32, y: u32) -> Result<(), SPI::Error> {
// x is positioned in bytes, so the last 3 bits which show the position inside a byte in the ram
// aren't relevant
self.interface.cmd_with_data(spi, Command::SET_RAM_X_ADDRESS_COUNTER, &[(x >> 3) as u8])?;

6
src/epd4in2/constants.rs

@ -1,8 +1,8 @@
use color::Color;
pub(crate) const WIDTH: u16 = 400;
pub(crate) const HEIGHT: u16 = 300;
pub(crate) const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
pub const WIDTH: u32 = 400;
pub const HEIGHT: u32 = 300;
pub const DEFAULT_BACKGROUND_COLOR: Color = Color::White;
pub(crate) const LUT_VCOM0: [u8; 44] = [
0x00, 0x17, 0x00, 0x00, 0x00, 0x02,

139
src/epd4in2/graphics.rs

@ -0,0 +1,139 @@
use epd4in2::constants::{DEFAULT_BACKGROUND_COLOR, WIDTH, HEIGHT};
/// Full size buffer for use with the 4in2 EPD
///
/// Can also be manuall constructed:
/// `buffer: [DEFAULT_BACKGROUND_COLOR.get_byte_value(); WIDTH / 8 * HEIGHT]`
pub struct Buffer4in2 {
pub buffer: [u8; WIDTH as usize * HEIGHT as usize / 8],
}
impl Default for Buffer4in2 {
fn default() -> Self {
Buffer4in2 {
buffer: [
DEFAULT_BACKGROUND_COLOR.get_byte_value();
WIDTH as usize * HEIGHT as usize / 8
]
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use epd4in2;
use graphics::{DisplayRotation, Display};
use embedded_graphics::coord::Coord;
use embedded_graphics::primitives::Line;
use color::Color;
use embedded_graphics::prelude::*;
// test buffer length
#[test]
fn graphics_size() {
let mut display4in2 = Buffer4in2::default();
let display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
assert_eq!(display.buffer().len(), 15000);
}
// test default background color on all bytes
#[test]
fn graphics_default() {
let mut display4in2 = Buffer4in2::default();
let display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
use epd4in2;
for &byte in display.buffer() {
assert_eq!(byte, epd4in2::constants::DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_0() {
let mut display4in2 = Buffer4in2::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
display.draw(
Line::new(Coord::new(0, 0), Coord::new(7, 0))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, epd4in2::constants::DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_90() {
let mut display4in2 = Buffer4in2::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Line::new(Coord::new(0, 392), Coord::new(0, 399))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, epd4in2::constants::DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_180() {
let mut display4in2 = Buffer4in2::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
display.set_rotation(DisplayRotation::Rotate180);
display.draw(
Line::new(Coord::new(392, 299), Coord::new(399, 299))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;
std::println!("{:?}", buffer);
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, epd4in2::constants::DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_270() {
let mut display4in2 = Buffer4in2::default();
let mut display = Display::new(WIDTH, HEIGHT, &mut display4in2.buffer);
display.set_rotation(DisplayRotation::Rotate270);
display.draw(
Line::new(Coord::new(299, 0), Coord::new(299, 7))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;
std::println!("{:?}", buffer);
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, epd4in2::constants::DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
}

45
src/epd4in2/mod.rs

@ -55,14 +55,18 @@ use traits::{WaveshareDisplay, InternalWiAdditions};
use interface::DisplayInterface;
//The Lookup Tables for the Display
mod constants;
use self::constants::*;
pub(crate) mod constants; //TODO: Limit to crate::drawing
pub use self::constants::*;
use color::Color;
pub mod command;
pub(crate) mod command;
use self::command::Command;
mod graphics;
pub use self::graphics::Buffer4in2;
/// EPD4in2 driver
///
pub struct EPD4in2<SPI, CS, BUSY, DC, RST> {
@ -158,23 +162,16 @@ where
self.init(spi, delay)
}
//TODO: is such a long delay really needed inbetween?
fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
self.interface.cmd_with_data(spi, Command::VCOM_AND_DATA_INTERVAL_SETTING, &[0x17])?; //border floating
self.command(spi, Command::VCM_DC_SETTING)?; // VCOM to 0V
self.command(spi, Command::PANEL_SETTING)?;
//TODO: Removal of delay. TEST!
//self.delay_ms(100);
self.command(spi, Command::POWER_SETTING)?; //VG&VS to 0V fast
for _ in 0..4 {
self.send_data(spi, &[0x00])?;
}
//TODO: Removal of delay. TEST!
//self.delay_ms(100);
self.command(spi, Command::POWER_OFF)?;
self.wait_until_idle();
self.interface.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5])
@ -187,19 +184,11 @@ where
self.interface.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?;
//TODO: this was a send_command instead of a send_data. check if it's alright and doing what it should do (setting the default values)
//self.send_command_u8(0x97)?; //VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
//VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
self.interface.cmd_with_data(spi, Command::VCOM_AND_DATA_INTERVAL_SETTING, &[0x97])?;
self.command(spi, Command::DATA_START_TRANSMISSION_1)?;
self.send_data(spi, &[color_value; WIDTH as usize / 8 * HEIGHT as usize])?;
//for _ in 0..buffer.len() {
// self.send_data(spi, &[color_value])?;
//}
//TODO: Removal of delay. TEST!
//self.delay_ms(2);
//TODO: compare with using a loop instead of the full buffer
self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_1, &[color_value; WIDTH as usize / 8 * HEIGHT as usize])?;
self.interface.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)
}
@ -208,12 +197,12 @@ where
&mut self,
spi: &mut SPI,
buffer: &[u8],
x: u16,
y: u16,
width: u16,
height: u16,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), SPI::Error> {
if buffer.len() as u16 != width / 8 * height {
if buffer.len() as u32 != width / 8 * height {
//TODO: panic!! or sth like that
//return Err("Wrong buffersize");
}
@ -290,11 +279,11 @@ where
&self.color
}
fn width(&self) -> u16 {
fn width(&self) -> u32 {
WIDTH
}
fn height(&self) -> u16 {
fn height(&self) -> u32 {
HEIGHT
}
}

239
src/graphics.rs

@ -0,0 +1,239 @@
//! Graphics Support for EPDs
use color::Color;
use embedded_graphics::prelude::*;
/// Displayrotation
#[derive(Clone, Copy)]
pub enum DisplayRotation {
/// No rotation
Rotate0,
/// Rotate by 90 degrees clockwise
Rotate90,
/// Rotate by 180 degrees clockwise
Rotate180,
/// Rotate 270 degrees clockwise
Rotate270,
}
impl Default for DisplayRotation {
fn default() -> Self {
DisplayRotation::Rotate0
}
}
pub struct Display<'a> {
width: u32,
height: u32,
rotation: DisplayRotation,
buffer: &'a mut [u8], //buffer: Box<u8>//[u8; 15000]
}
impl<'a> Display<'a> {
pub fn new(width: u32, height: u32, buffer: &'a mut [u8]) -> Display<'a> {
let len = buffer.len() as u32;
assert!(width / 8 * height >= len);
Display {
width,
height,
rotation: DisplayRotation::default(),
buffer,
}
}
pub fn buffer(&self) -> &[u8] {
&self.buffer
}
pub fn clear_buffer(&mut self, background_color: Color) {
for elem in &mut self.buffer.iter_mut() {
*elem = background_color.get_byte_value();
}
}
pub fn set_rotation(&mut self, rotation: DisplayRotation) {
self.rotation = rotation;
}
pub fn rotation(&self) -> DisplayRotation {
self.rotation
}
}
impl<'a> Drawing<Color> for Display<'a> {
fn draw<T>(&mut self, item_pixels: T)
where
T: Iterator<Item = Pixel<Color>>
{
for Pixel(UnsignedCoord(x,y), color) in item_pixels {
if outside_display(x, y, self.width, self.height, self.rotation) {
continue;
}
// Give us index inside the buffer and the bit-position in that u8 which needs to be changed
let (index, bit) = rotation(x, y, self.width, self.height, self.rotation);
let index = index as usize;
// "Draw" the Pixel on that bit
match color {
Color::Black => {
self.buffer[index] &= !bit;
}
Color::White => {
self.buffer[index] |= bit;
}
}
}
}
}
fn outside_display(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRotation) -> bool {
match rotation {
DisplayRotation::Rotate0 | DisplayRotation::Rotate180 => {
if x >= width || y >= height {
return true;
}
},
DisplayRotation::Rotate90 | DisplayRotation::Rotate270 => {
if y >= width || x >= height {
return true;
}
}
}
false
}
fn rotation(x: u32, y: u32, width: u32, height: u32, rotation: DisplayRotation) -> (u32, u8) {
match rotation {
DisplayRotation::Rotate0 => (
x / 8 + (width / 8) * y,
0x80 >> (x % 8),
),
DisplayRotation::Rotate90 => (
(width - 1 - y) / 8 + (width / 8) * x,
0x01 << (y % 8),
),
DisplayRotation::Rotate180 => (
((width / 8) * height - 1) - (x / 8 + (width / 8) * y),
0x01 << (x % 8),
),
DisplayRotation::Rotate270 => (
y / 8 + (height - 1 - x) * (width / 8),
0x80 >> (y % 8),
),
}
}
#[cfg(test)]
mod tests {
use super::{DisplayRotation, outside_display, rotation, Display};
use color::Color;
use embedded_graphics::coord::Coord;
use embedded_graphics::primitives::Line;
use embedded_graphics::prelude::*;
#[test]
fn buffer_clear() {
use epd4in2::constants::{WIDTH, HEIGHT};
let mut buffer = [Color::Black.get_byte_value(); WIDTH as usize / 8 * HEIGHT as usize];
let mut display = Display::new(WIDTH, HEIGHT, &mut buffer);
for &byte in display.buffer.iter() {
assert_eq!(byte, Color::Black.get_byte_value());
}
display.clear_buffer(Color::White);
for &byte in display.buffer.iter() {
assert_eq!(byte, Color::White.get_byte_value());
}
}
#[test]
fn rotation_overflow() {
use epd4in2::constants::{WIDTH, HEIGHT};
let width = WIDTH as u32;
let height = HEIGHT as u32;
test_rotation_overflow(width, height, DisplayRotation::Rotate0);
test_rotation_overflow(width, height, DisplayRotation::Rotate90);
test_rotation_overflow(width, height, DisplayRotation::Rotate180);
test_rotation_overflow(width, height, DisplayRotation::Rotate270);
}
fn test_rotation_overflow(width: u32, height: u32, rotation2: DisplayRotation) {
let max_value = width / 8 * height;
for x in 0..(width + height) { //limit x because it runs too long
for y in 0..(u32::max_value()) {
if outside_display(x, y, width, height, rotation2) {
break;
} else {
let (idx, _) = rotation(x, y, width, height, rotation2);
assert!(idx < max_value);
}
}
}
}
#[test]
fn graphics_rotation_0() {
use epd2in9::{DEFAULT_BACKGROUND_COLOR};
let width = 128;
let height = 296;
let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 128 / 8 * 296];
let mut display = Display::new(width, height, &mut buffer);
display.draw(
Line::new(Coord::new(0, 0), Coord::new(7, 0))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
#[test]
fn graphics_rotation_90() {
use epd2in9::{DEFAULT_BACKGROUND_COLOR};
let width = 128;
let height = 296;
let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 128 / 8 * 296];
let mut display = Display::new(width, height, &mut buffer);
display.set_rotation(DisplayRotation::Rotate90);
display.draw(
Line::new(Coord::new(0, 120), Coord::new(0, 295))
.with_stroke(Some(Color::Black))
.into_iter(),
);
let buffer = display.buffer();
extern crate std;
std::println!("{:?}", buffer);
assert_eq!(buffer[0], Color::Black.get_byte_value());
for &byte in buffer.iter().skip(1) {
assert_eq!(byte, DEFAULT_BACKGROUND_COLOR.get_byte_value());
}
}
}

2
src/interface.rs

@ -84,7 +84,7 @@ where
&mut self,
spi: &mut SPI,
val: u8,
repetitions: u16,
repetitions: u32,
) -> Result<(), SPI::Error> {
// high for data
self.dc.set_high();

35
src/lib.rs

@ -41,17 +41,13 @@
//!
#![no_std]
//TODO: Make more assertions about buffersizes?
extern crate embedded_hal as hal;
use hal::spi::{Mode, Phase, Polarity};
#[cfg(feature = "graphics")]
extern crate embedded_graphics;
#[cfg(feature = "graphics")]
pub mod drawing;
pub mod graphics;
mod traits;
pub use traits::{WaveshareDisplay};
pub mod color;
@ -59,26 +55,27 @@ pub mod color;
mod interface;
#[cfg(feature = "epd4in2")]
mod epd4in2;
#[cfg(feature = "epd4in2")]
pub use epd4in2::EPD4in2;
pub mod epd4in2;
#[cfg(feature = "epd1in54")]
mod epd1in54;
#[cfg(feature = "epd1in54")]
pub use epd1in54::EPD1in54;
pub mod epd1in54;
#[cfg(feature = "epd2in9")]
mod epd2in9;
///2in9 eink
#[cfg(feature = "epd2in9")]
///2in9 eink
pub use epd2in9::EPD2in9;
pub mod epd2in9;
#[cfg(any(feature = "epd1in54", feature = "epd2in9"))]
pub(crate) mod type_a;
//TODO: test spi mode
pub mod prelude {
pub use traits::{WaveshareDisplay};
pub use color::Color;
pub use SPI_MODE;
}
extern crate embedded_hal as hal;
use hal::spi::{Mode, Phase, Polarity};
/// SPI mode -
/// For more infos see [Requirements: SPI](index.html#spi)
pub const SPI_MODE: Mode = Mode {

28
src/traits.rs

@ -3,29 +3,23 @@ use hal::{
blocking::{delay::*, spi::Write},
digital::*,
};
use color::Color;
/// All commands need to have this trait which gives the address of the command
/// which needs to be send via SPI with activated CommandsPin (Data/Command Pin in CommandMode)
pub(crate) trait Command {
fn address(self) -> u8;
}
//TODO: add LUT trait with set_fast_lut and set_manual_lut and set_normal_lut or sth like that?
// for partial updates
// Trait for using various Waveforms from different LUTs
// E.g. for partial updates
trait LUTSupport<ERR> {
fn set_lut(&mut self) -> Result<(), ERR>;
fn set_lut_quick(&mut self) -> Result<(), ERR>;
fn set_lut_manual(&mut self, data: &[u8]) -> Result<(), ERR>;
}
pub(crate) trait InternalWiAdditions<SPI, CS, BUSY, DC, RST>
where
SPI: Write<u8>,
@ -48,6 +42,9 @@ where
}
/// All the functions to interact with the EPDs
///
/// This trait includes all public functions to use the EPDS
pub trait WaveshareDisplay<SPI, CS, BUSY, DC, RST>
where
SPI: Write<u8>,
@ -56,8 +53,6 @@ where
DC: OutputPin,
RST: OutputPin,
{
/// Creates a new driver from a SPI peripheral, CS Pin, Busy InputPin, DC
///
/// This already initialises the device. That means [init()](WaveshareInterface::init()) isn't needed directly afterwards
@ -75,6 +70,7 @@ where
/// and initialising which already contains the reset
fn sleep(&mut self, spi: &mut SPI) -> Result<(), SPI::Error>;
/// Wakes the device up from sleep
fn wake_up<DELAY: DelayMs<u8>>(&mut self, spi: &mut SPI, delay: &mut DELAY) -> Result<(), SPI::Error>;
@ -85,10 +81,10 @@ where
fn background_color(&self) -> &Color;
/// Get the width of the display
fn width(&self) -> u16;
fn width(&self) -> u32;
/// Get the height of the display
fn height(&self) -> u16;
fn height(&self) -> u32;
/// Transmit a full frame to the SRAM of the EPD
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error>;
@ -100,10 +96,10 @@ where
&mut self,
spi: &mut SPI,
buffer: &[u8],
x: u16,
y: u16,
width: u16,
height: u16,
x: u32,
y: u32,
width: u32,
height: u32,
) -> Result<(), SPI::Error>;
/// Displays the frame data from SRAM

14
src/type_a/constants.rs

@ -0,0 +1,14 @@
// Original Waveforms from Waveshare
pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
];
pub(crate) const LUT_PARTIAL_UPDATE: [u8; 30] =[
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];

16
src/type_a/mod.rs

@ -1,16 +1,2 @@
pub(crate) mod command;
// Original Waveforms from Waveshare
pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
0x35, 0x51, 0x51, 0x19, 0x01, 0x00
];
pub(crate) const LUT_PARTIAL_UPDATE: [u8; 30] =[
0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
pub(crate) mod constants;
Loading…
Cancel
Save