Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
caemor authored Oct 30, 2024
2 parents 3367b2b + b45e3ed commit 92ff3a5
Show file tree
Hide file tree
Showing 53 changed files with 4,391 additions and 1,093 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
build:

runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
strategy:
matrix:
rust:
Expand All @@ -19,13 +21,15 @@ jobs:
- name: Check Fmt
run: cargo fmt --all -- --check
- name: Build lib
run: cargo check --all-targets --verbose
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::new_ret_no_self
run: cargo check --lib --verbose
- name: Build examples
continue-on-error: true
run: cargo build --examples --all-targets --verbose
- name: Run tests
run: cargo test --verbose
- name: Build docs
run: cargo doc --all-features
run: cargo doc
- name: Clippy
continue-on-error: true
run: cargo clippy --all-targets -- -D warnings -A clippy::new_ret_no_self

60 changes: 46 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v0.6.0] - 2024-10-28

### Added

- Added support for positive and negatives modes of rendering in TriColor display in #92 (thanks to @akashihi)
- Added Epd 5in83 V2 (B) support in #92 (thanks to @akashihi)
- Added Epd 7in5 (B) V2 and V3 support
- Add support for positive and negatives modes of rendering in TriColor display in #92 (thanks to @akashihi)
- Add Epd 5in83 V2 (B) support in #92 (thanks to @akashihi)
- Add Epd 7in5 (B) V2 and V3 support in #118 (should also work on v3), thanks to @peckpeck
- Add 7.3 Inch HAT (F) support in #191 (thanks to @jetjinser)
- Add support for EPD 2in9 D in #171 (thanks to @wsndshx)
- Add Epd 5in83 V2 support in #159 (thanks to @Carbonhell)
- Add support for Pi hat Pico Epd2in66B (B/W/R) in #147 (thanks to @ReinoutHeeck and @Lite5h4dow)
- Add support for EPD 2in13 v3 in #126 and #138 (thanks to @fmeef)
- Add embedded-graphics traits for color in #132 (thanks to @peckpeck)
- Add support for EPD 3in7 in #129 (thanks to @mangelajo)
- Add convert traits for TriColor
- Add support for GDEH0154D67 (aka epd1in54_v2) in #106 (thanks to @jcard0na)
- Add option to switch between single byte and blockwise data writen to the spi device
- Added tests and fixed sized method when rotated

### Changed

- Made Examples and Linux embedded hal optional (linux only) and therefore allowed building on other hosts (#101, #94)
- Update to eh-1.0, eh-mock 0.10 , leh 0.4.0
- Documentation tweaks
- Updated and improved Examples and Readme multiple times (thanks to @shymega and many others)
- Updated refresh rate for 2.9in v2 display to make it much faster thanks to @andber1 in #150 (and #185)
- Removed epd7in5_v3 in favour of edp7in5b_v2 since they work the same way in #177
- Migrated to Rust 2021 in #133 (thanks to @peckpeck)
- Migrate `DelayMs<u8>` to `DelayUs<u32>` to allow shorter and longer sleeps in #131 (thanks to @peckpeck)
- Improved delay handling by allowing busy or sleep loops in wait_for_idle in #125 thanks to @peckpeck
- Make Display more generic in #123 and #121 (thanks to @peckpeck)

### Fixed

- Overflow error for all displays thanks to @tippfehlr in @186
- Fix build when feature graphics is not enabled in #176 (thanks to @vhdirk)
- Optimize overflow in the calculation of `NUM_DISPLAY_BYTES` on small architectures in #173 (thanks to @Idicarlo)
- Fixed init code for epd1in54 thanks to @fakusb in #156
- Fix off-by-one bug for `set_pixel` in #148 thanks to @ReinoutHeeck
- Fix 7in5(HD) by allowing blockwise data to be written in #141 (see issues and discussions in #70, #83, #142)
- Fix enter deep sleep for epd1in54 v2 in #139 (thanks to @jcard0na)
- Fixed buffer length in display struct in #128 (thanks to @peckpeck)
- LUT Fixes for EPD 2in9 v2 in #103 (thanks to @mike-kfed)
- Fix pins for epd2in13_v2 example in #91 Universal e-Paper Raw Panel Driver HAT (thanks to @ole-treichel)
- Fix Color Bitmask calculation for OctColor in #190 (thanks to @jetjinser)

## [v0.5.0] - 2021-11-28

### Added
Expand All @@ -31,7 +63,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added Color conversion methods in #87 & #88 (thanks to @crzysdrs)
- Provide full QuickRefresh interface for 4.2 inch display in #81 (thanks to @sirhcel)


### Changed

- Updated embedded-graphics to 0.7 and switch to e-g-core #78 (@Irbalt) & #85 (@jamwaffles)
Expand All @@ -42,7 +73,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Write data over SPI 1 byte at a time due to #82 (thanks to @belak)
- Enable drawing in three colors for epd2in13bc in #76 (thanks to @Irbalt)


## [v0.4.0] - 2020-04-06

### Added
Expand Down Expand Up @@ -130,12 +160,14 @@ Initial release with Changelog
- Lots of internal changes
- Renamed to `epd-waveshare`

[Unreleased]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.4.0...HEAD
[v0.6.0]: https://github.com/Caemor/epd-waveshare/compare/v0.5.0...v0.6.0

[v0.5.0]: https://github.com/Caemor/epd-waveshare/compare/v0.4.0...v0.5.0

[v0.4.0]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.2...v0.4.0
[v0.4.0]: https://github.com/Caemor/epd-waveshare/compare/v0.3.2...v0.4.0

[v0.3.2]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.1...v0.3.2
[v0.3.2]: https://github.com/Caemor/epd-waveshare/compare/v0.3.1...v0.3.2

[v0.3.1]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.0...v0.3.1
[v0.3.1]: https://github.com/Caemor/epd-waveshare/compare/v0.3.0...v0.3.1

[v0.3.0]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.2.0...v0.3.0
[v0.3.0]: https://github.com/Caemor/epd-waveshare/compare/v0.2.0...v0.3.0
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@ license = "ISC"
name = "epd-waveshare"
readme = "README.md"
repository = "https://github.com/Caemor/epd-waveshare.git"
version = "0.5.0"
version = "0.6.0"
edition = "2021"

[badges]
# travis-ci = { repository = "caemor/epd-waveshare" }

[dependencies]
embedded-graphics-core = { version = "0.3.2", optional = true}
embedded-hal = {version = "0.2.4", features = ["unproven"]}
embedded-graphics-core = { version = "0.4", optional = true }
embedded-hal = "1.0.0"
bit_field = "0.10.1"

[dev-dependencies]
embedded-graphics = "0.7.1"

embedded-hal-mock = "0.8"
embedded-graphics = "0.8"
embedded-hal-mock = { version = "0.11", default-features = false, features = [
"eh1",
] }

[target.'cfg(unix)'.dev-dependencies]
linux-embedded-hal = "0.3"
linux-embedded-hal = "0.4.0"

[[example]]
name = "epd1in54_no_graphics"
Expand All @@ -50,9 +48,11 @@ required-features = ["linux-dev"]

[features]
# Remove the linux-dev feature to build the tests on non unix systems
default = ["graphics", "linux-dev"]
default = ["graphics", "linux-dev", "epd2in13_v3"]

graphics = ["embedded-graphics-core"]
epd2in13_v2 = []
epd2in13_v3 = []
linux-dev = []

# Offers an alternative fast full lut for type_a displays, but the refreshed screen isnt as clean looking
Expand Down
51 changes: 30 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,31 @@ There are multiple examples in the examples folder. Use `cargo run --example exa

```Rust
// Setup the epd
let mut epd = Epd4in2::new( & mut spi, cs, busy, dc, rst, & mut delay) ?;
let mut epd4in2 =
Epd4in2::new(&mut spi, busy, dc, rst, &mut delay, None).expect("eink initalize error");

// Setup the graphics
let mut display = Display4in2::default ();

// Draw some text
display.draw(
let _ = Text::new("Hello Rust!", Point::new(x, y))
.into_styled(text_style!(
font = Font12x16,
text_color = Black,
background_color = White
))
.draw(display);
);

// Transfer the frame data to the epd and display it
epd.update_and_display_frame( & mut spi, & display.buffer()) ?;
let mut display = Display4in2::default();

// Build the style
let style = MonoTextStyleBuilder::new()
.font(&embedded_graphics::mono_font::ascii::FONT_6X10)
.text_color(Color::White)
.background_color(Color::Black)
.build();
let text_style = TextStyleBuilder::new().baseline(Baseline::Top).build();

// Draw some text at a certain point using the specified text style
let _ = Text::with_text_style("It's working-WoB!", Point::new(175, 250), style, text_style)
.draw(&mut display);

// Show display on e-paper
epd4in2.update_and_display_frame(&mut spi, display.buffer(), &mut delay).expect("display error");

// Going to sleep
epd4in2.sleep(&mut spi, &mut delay)
```
> Check the complete example [here](./examples/epd4in2.rs).
## (Supported) Devices

Expand All @@ -50,18 +56,21 @@ epd.update_and_display_frame( & mut spi, & display.buffer()) ?;
| [7.5 Inch B/W HD (A)](https://www.waveshare.com/product/displays/e-paper/epaper-1/7.5inch-hd-e-paper-hat.htm) | Black, White |||||
| [7.5 Inch B/W V2 (A)](https://www.waveshare.com/product/7.5inch-e-paper-hat.htm) [[1](#1-75-inch-bw-v2-a)] | Black, White |||||
| [7.5 Inch B/W (A)](https://www.waveshare.com/product/7.5inch-e-paper-hat.htm) | Black, White |||||
| [7.3 Inch HAT (F)](https://www.waveshare.com/product/7.3inch-e-paper-hat-f.htm) | Black, White, Red, Green, Blue, Yellow, Orange |||||
| [5.83 Inch B/W/R (b)](https://www.waveshare.com/5.83inch-e-Paper-B.htm) | Black, White, Red || Not officially |||
| [5.65 Inch 7 Color (F)](https://www.waveshare.com/5.65inch-e-paper-module-f.htm) | Black, White, Red, Green, Blue, Yellow, Orange |||||
| [4.2 Inch B/W (A)](https://www.waveshare.com/product/4.2inch-e-paper-module.htm) | Black, White || Not officially [[2](#2-42-inch-e-ink-blackwhite---partial-refresh)] |||
| [1.54 Inch B/W (A)](https://www.waveshare.com/1.54inch-e-Paper-Module.htm) | Black, White |||||
| [2.13 Inch B/W (A) V2](https://www.waveshare.com/product/2.13inch-e-paper-hat.htm) | Black, White |||||
| [2.13 Inch B/W/R (B/C) V2](https://www.waveshare.com/product/raspberry-pi/displays/e-paper/2.13inch-e-paper-hat-b.htm) | Black, White, Red |||||
| [2.9 Inch B/W/R (B/C)](https://www.waveshare.com/product/displays/e-paper/epaper-2/2.9inch-e-paper-module-b.htm) | Black, White, Red |||||
| [2.9 Inch B/W (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White |||||
| [2.9 Inch B/W V2 (A)](https://www.waveshare.com/product/2.9inch-e-paper-module.htm) | Black, White |||||
| [1.54 Inch B/W/R (B)](https://www.waveshare.com/product/modules/oleds-lcds/e-paper/1.54inch-e-paper-module-b.htm) | Black, White, Red |||||
| [1.54 Inch B/W/Y (C)](https://www.waveshare.com/1.54inch-e-paper-c.htm) | Black, White, Yellow |||||
| [2.9 Inch B/W/R (B/C)](https://www.waveshare.com/product/displays/e-paper/epaper-2/2.9inch-e-paper-module-b.htm) | Black, White, Red |||||
| [5.65 Inch 7 Color (F)](https://www.waveshare.com/5.65inch-e-paper-module-f.htm) | Black, White, Red, Green, Blue, Yellow, Orange |||||
| [2.7 Inch 3 Color (B)](https://www.waveshare.com/2.7inch-e-paper-b.htm) | Black, White, Red |||||
| [2.7 Inch B/W V2](https://www.waveshare.com/2.7inch-e-paper.htm) | Black, White || (✔) |||
| [2.66 Inch 3 Color (B)](https://www.waveshare.com/wiki/Pico-ePaper-2.66-B) | Black, White, Red |||||
| [1.54 Inch B/W/Y (C) (Discontinued)](https://www.waveshare.com/1.54inch-e-paper-module-c.htm) | Black, White, Yellow |||||
| [1.54 Inch B/W/R (B)](https://www.waveshare.com/1.54inch-e-Paper-B.htm) | Black, White, Red |||||
| [1.54 Inch B/W (A)](https://www.waveshare.com/1.54inch-e-Paper-Module.htm) | Black, White |||||

### [1]: 7.5 Inch B/W V2 (A)

Expand Down
Binary file added examples/assets/ferris.raw
Binary file not shown.
20 changes: 10 additions & 10 deletions examples/epd1in54_no_graphics.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#![deny(warnings)]

use embedded_hal::prelude::*;
use embedded_hal::delay::DelayNs;
use epd_waveshare::{epd1in54::Epd1in54, prelude::*};
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Delay, Pin, Spidev,
Delay, SPIError, SpidevDevice, SysfsPin,
};

// 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

fn main() -> Result<(), std::io::Error> {
fn main() -> Result<(), SPIError> {
// Configure SPI
// SPI settings are from eink-waveshare-rs documenation
let mut spi = Spidev::open("/dev/spidev0.0")?;
let mut spi = SpidevDevice::open("/dev/spidev0.0")?;
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(4_000_000)
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<(), std::io::Error> {
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
let cs_pin = SysfsPin::new(26); //BCM7 CE0
cs_pin.export().expect("cs_pin export");
while !cs_pin.is_exported() {}
cs_pin
Expand All @@ -33,21 +33,21 @@ fn main() -> Result<(), std::io::Error> {
cs_pin.set_value(1).expect("cs_pin Value set to 1");

// Configure Busy Input Pin
let busy = Pin::new(5); //pin 29
let busy = SysfsPin::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");

// Configure Data/Command OutputPin
let dc = Pin::new(6); //pin 31 //bcm6
let dc = SysfsPin::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
let rst = SysfsPin::new(16); //pin 36 //bcm16
rst.export().expect("rst export");
while !rst.is_exported() {}
rst.set_direction(Direction::Out).expect("rst Direction");
Expand All @@ -58,7 +58,7 @@ fn main() -> Result<(), std::io::Error> {

// Setup of the needed pins is finished here
// Now the "real" usage of the eink-waveshare-rs crate begins
let mut epd = Epd1in54::new(&mut spi, cs_pin, busy, dc, rst, &mut delay, Some(5))?;
let mut epd = Epd1in54::new(&mut spi, busy, dc, rst, &mut delay, Some(5))?;

// Clear the full screen
epd.clear_frame(&mut spi, &mut delay)?;
Expand Down Expand Up @@ -98,7 +98,7 @@ fn main() -> Result<(), std::io::Error> {

// Display updated frame
epd.display_frame(&mut spi, &mut delay)?;
delay.delay_ms(5000u16);
delay.delay_ms(5000);

// Set the EPD to sleep
epd.sleep(&mut spi, &mut delay)?;
Expand Down
Loading

0 comments on commit 92ff3a5

Please sign in to comment.