Skip to content

Commit

Permalink
Merge branch 'main' into add-heap-allocation-support
Browse files Browse the repository at this point in the history
  • Loading branch information
caemor authored Nov 4, 2024
2 parents eb625aa + e113bea commit 9245b5c
Show file tree
Hide file tree
Showing 60 changed files with 5,790 additions and 405 deletions.
2 changes: 2 additions & 0 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 Down
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
14 changes: 4 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +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.4", optional = true }
embedded-hal = { version = "1.0.0-rc.1" }
embedded-hal = "1.0.0"
bit_field = "0.10.1"

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

embedded-hal-mock = { git = "https://github.com/newAM/embedded-hal-mock", branch = "eh1-rc.1", default-features = false, features = [
embedded-hal-mock = { version = "0.11", default-features = false, features = [
"eh1",
] }
# embedded-hal-mock = "0.9"

[target.'cfg(unix)'.dev-dependencies]
# linux-embedded-hal = "0.3"
linux-embedded-hal = { git = "https://github.com/rust-embedded/linux-embedded-hal" }
linux-embedded-hal = "0.4.0"

[[example]]
name = "epd1in54_no_graphics"
Expand Down
41 changes: 25 additions & 16 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,6 +56,7 @@ 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)] |||
Expand All @@ -59,6 +66,8 @@ epd.update_and_display_frame( & mut spi, & display.buffer()) ?;
| [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 |||||
| [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 |||||
Expand Down
Binary file added examples/assets/ferris.raw
Binary file not shown.
6 changes: 3 additions & 3 deletions examples/epd1in54_no_graphics.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![deny(warnings)]

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

// activate spi, gpio in raspi-config
Expand All @@ -15,7 +15,7 @@ use linux_embedded_hal::{
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 Down
6 changes: 3 additions & 3 deletions examples/epd2in13_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use embedded_graphics::{
primitives::{Circle, Line, PrimitiveStyle},
text::{Baseline, Text, TextStyleBuilder},
};
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use epd_waveshare::{
color::*,
epd2in13_v2::{Display2in13, Epd2in13},
Expand All @@ -16,7 +16,7 @@ use epd_waveshare::{
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Delay, SPIError, Spidev, SysfsPin,
Delay, SPIError, SpidevDevice, SysfsPin,
};

// The pins in this example are for the Universal e-Paper Raw Panel Driver HAT
Expand All @@ -27,7 +27,7 @@ use linux_embedded_hal::{
fn main() -> Result<(), SPIError> {
// Configure SPI
// Settings are taken from
let mut spi = Spidev::open("/dev/spidev0.0").expect("spidev directory");
let mut spi = SpidevDevice::open("/dev/spidev0.0").expect("spidev directory");
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(4_000_000)
Expand Down
6 changes: 3 additions & 3 deletions examples/epd2in13bc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use embedded_graphics::{
primitives::{Circle, Line, PrimitiveStyle},
text::{Baseline, Text, TextStyleBuilder},
};
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use epd_waveshare::{
color::*,
epd2in13bc::{Display2in13bc, Epd2in13bc},
Expand All @@ -16,7 +16,7 @@ use epd_waveshare::{
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Delay, SPIError, Spidev, SysfsPin,
Delay, SPIError, SpidevDevice, SysfsPin,
};

// activate spi, gpio in raspi-config
Expand Down Expand Up @@ -61,7 +61,7 @@ fn main() -> Result<(), SPIError> {

// Configure SPI
// Settings are taken from
let mut spi = Spidev::open("/dev/spidev0.0").expect("spidev directory");
let mut spi = SpidevDevice::open("/dev/spidev0.0").expect("spidev directory");
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(10_000_000)
Expand Down
6 changes: 3 additions & 3 deletions examples/epd4in2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use embedded_graphics::{
primitives::{Circle, Line, PrimitiveStyleBuilder},
text::{Baseline, Text, TextStyleBuilder},
};
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use epd_waveshare::{
color::*,
epd4in2::{Display4in2, Epd4in2},
Expand All @@ -16,7 +16,7 @@ use epd_waveshare::{
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Delay, SPIError, Spidev, SysfsPin,
Delay, SPIError, SpidevDevice, SysfsPin,
};

// activate spi, gpio in raspi-config
Expand All @@ -26,7 +26,7 @@ use linux_embedded_hal::{
fn main() -> Result<(), SPIError> {
// Configure SPI
// Settings are taken from
let mut spi = Spidev::open("/dev/spidev0.0").expect("spidev directory");
let mut spi = SpidevDevice::open("/dev/spidev0.0").expect("spidev directory");
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(4_000_000)
Expand Down
7 changes: 3 additions & 4 deletions examples/epd4in2_variable_size.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#![deny(warnings)]
#![deny(warnings)]

use embedded_graphics::{
mono_font::MonoTextStyleBuilder,
prelude::*,
primitives::{Circle, Line, PrimitiveStyleBuilder},
text::{Baseline, Text, TextStyleBuilder},
};
use embedded_hal::delay::DelayUs;
use embedded_hal::delay::DelayNs;
use epd_waveshare::{
color::*,
epd4in2::{self, Epd4in2},
Expand All @@ -17,7 +16,7 @@ use epd_waveshare::{
use linux_embedded_hal::{
spidev::{self, SpidevOptions},
sysfs_gpio::Direction,
Delay, SPIError, Spidev, SysfsPin,
Delay, SPIError, SpidevDevice, SysfsPin,
};

// activate spi, gpio in raspi-config
Expand All @@ -27,7 +26,7 @@ use linux_embedded_hal::{
fn main() -> Result<(), SPIError> {
// Configure SPI
// Settings are taken from
let mut spi = Spidev::open("/dev/spidev0.0").expect("spidev directory");
let mut spi = SpidevDevice::open("/dev/spidev0.0").expect("spidev directory");
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(4_000_000)
Expand Down
Loading

0 comments on commit 9245b5c

Please sign in to comment.