Browse Source

v0.3.2 - some timing fixes (#29)

* Fixed some missing wait_until_idle calls
* prepared release of 0.3.2
* cargo fmt

This is known to fail on travis because it uses the deprecated old digital v1 embedded hal pins
embedded-hal-1.0 v0.3.2
Chris 7 years ago committed by GitHub
parent
commit
7b4a7f0578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      CHANGELOG.md
  2. 2
      Cargo.toml
  3. 32
      src/epd1in54/mod.rs
  4. 25
      src/epd2in9/mod.rs
  5. 26
      src/epd4in2/mod.rs

10
CHANGELOG.md

@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
<!-- ## [v0.3.1] - 2019-04-04 --> <!-- ## [v0.3.2] - 2019-04-04 -->
## [v0.3.2] - 2019-06-17
### Fixed
- Added some more missing wait_until_idle calls
## [v0.3.1] - 2019-04-06 ## [v0.3.1] - 2019-04-06
@ -61,6 +66,7 @@ Initial release with Changelog
- Renamed to `epd-waveshare` - Renamed to `epd-waveshare`
[Unreleased]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.1...HEAD [Unreleased]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.2...HEAD
[v0.3.2]: https://github.com/Caemor/eink-waveshare-rs/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/eink-waveshare-rs/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/eink-waveshare-rs/compare/v0.2.0...v0.3.0

2
Cargo.toml

@ -9,7 +9,7 @@ license = "ISC"
name = "epd-waveshare" name = "epd-waveshare"
readme = "README.md" readme = "README.md"
repository = "https://github.com/Caemor/epd-waveshare.git" repository = "https://github.com/Caemor/epd-waveshare.git"
version = "0.3.1" version = "0.3.2"
edition = "2018" edition = "2018"
[badges] [badges]

32
src/epd1in54/mod.rs

@ -125,7 +125,10 @@ where
self.interface self.interface
.cmd_with_data(spi, Command::DATA_ENTRY_MODE_SETTING, &[0x03])?; .cmd_with_data(spi, Command::DATA_ENTRY_MODE_SETTING, &[0x03])?;
self.set_lut(spi, None) self.set_lut(spi, None)?;
self.wait_until_idle();
Ok(())
} }
} }
@ -188,7 +191,10 @@ where
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
self.use_full_frame(spi)?; self.use_full_frame(spi)?;
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_RAM, buffer) .cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
self.wait_until_idle();
Ok(())
} }
//TODO: update description: last 3 bits will be ignored for width and x_pos //TODO: update description: last 3 bits will be ignored for width and x_pos
@ -205,7 +211,10 @@ where
self.set_ram_counter(spi, x, y)?; self.set_ram_counter(spi, x, y)?;
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_RAM, buffer) .cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
self.wait_until_idle();
Ok(())
} }
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@ -230,7 +239,11 @@ where
let color = self.background_color.get_byte_value(); let color = self.background_color.get_byte_value();
self.interface.cmd(spi, Command::WRITE_RAM)?; self.interface.cmd(spi, Command::WRITE_RAM)?;
self.interface.data_x_times(spi, color, WIDTH / 8 * HEIGHT) self.interface
.data_x_times(spi, color, WIDTH / 8 * HEIGHT)?;
self.wait_until_idle();
Ok(())
} }
fn set_background_color(&mut self, background_color: Color) { fn set_background_color(&mut self, background_color: Color) {
@ -309,7 +322,10 @@ where
end_y as u8, end_y as u8,
(end_y >> 8) as u8, (end_y >> 8) as u8,
], ],
) )?;
self.wait_until_idle();
Ok(())
} }
pub(crate) fn set_ram_counter( pub(crate) fn set_ram_counter(
@ -336,8 +352,12 @@ where
fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
assert!(buffer.len() == 30); assert!(buffer.len() == 30);
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer) .cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)?;
self.wait_until_idle();
Ok(())
} }
} }

25
src/epd2in9/mod.rs

@ -180,14 +180,20 @@ where
spi: &mut SPI, spi: &mut SPI,
delay: &mut DELAY, delay: &mut DELAY,
) -> Result<(), SPI::Error> { ) -> Result<(), SPI::Error> {
self.init(spi, delay) self.init(spi, delay)?;
self.wait_until_idle();
Ok(())
} }
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
self.use_full_frame(spi)?; self.use_full_frame(spi)?;
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_RAM, buffer) .cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
self.wait_until_idle();
Ok(())
} }
//TODO: update description: last 3 bits will be ignored for width and x_pos //TODO: update description: last 3 bits will be ignored for width and x_pos
@ -204,7 +210,10 @@ where
self.set_ram_counter(spi, x, y)?; self.set_ram_counter(spi, x, y)?;
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_RAM, buffer) .cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
self.wait_until_idle();
Ok(())
} }
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@ -229,7 +238,11 @@ where
let color = self.background_color.get_byte_value(); let color = self.background_color.get_byte_value();
self.interface.cmd(spi, Command::WRITE_RAM)?; self.interface.cmd(spi, Command::WRITE_RAM)?;
self.interface.data_x_times(spi, color, WIDTH / 8 * HEIGHT) self.interface
.data_x_times(spi, color, WIDTH / 8 * HEIGHT)?;
self.wait_until_idle();
Ok(())
} }
fn set_background_color(&mut self, background_color: Color) { fn set_background_color(&mut self, background_color: Color) {
@ -332,7 +345,9 @@ where
fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
assert!(buffer.len() == 30); assert!(buffer.len() == 30);
self.interface self.interface
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer) .cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)?;
self.wait_until_idle();
Ok(())
} }
} }

26
src/epd4in2/mod.rs

@ -128,6 +128,7 @@ where
self.set_lut(spi, None)?; self.set_lut(spi, None)?;
self.wait_until_idle();
Ok(()) Ok(())
} }
} }
@ -200,7 +201,10 @@ where
self.command(spi, Command::POWER_OFF)?; self.command(spi, Command::POWER_OFF)?;
self.wait_until_idle(); self.wait_until_idle();
self.interface self.interface
.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5]) .cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5])?;
self.wait_until_idle();
Ok(())
} }
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> { fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
@ -221,7 +225,10 @@ where
.data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)?; .data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)?;
self.interface self.interface
.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer) .cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)?;
self.wait_until_idle();
Ok(())
} }
fn update_partial_frame( fn update_partial_frame(
@ -265,7 +272,10 @@ where
self.send_data(spi, buffer)?; self.send_data(spi, buffer)?;
self.command(spi, Command::PARTIAL_OUT) self.command(spi, Command::PARTIAL_OUT)?;
self.wait_until_idle();
Ok(())
} }
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> { fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@ -288,7 +298,10 @@ where
self.interface self.interface
.cmd(spi, Command::DATA_START_TRANSMISSION_2)?; .cmd(spi, Command::DATA_START_TRANSMISSION_2)?;
self.interface self.interface
.data_x_times(spi, color_value, WIDTH / 8 * HEIGHT) .data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)?;
self.wait_until_idle();
Ok(())
} }
fn set_background_color(&mut self, color: Color) { fn set_background_color(&mut self, color: Color) {
@ -397,7 +410,10 @@ where
self.cmd_with_data(spi, Command::LUT_WHITE_TO_BLACK, lut_wb)?; self.cmd_with_data(spi, Command::LUT_WHITE_TO_BLACK, lut_wb)?;
// LUT BLACK to BLACK // LUT BLACK to BLACK
self.cmd_with_data(spi, Command::LUT_BLACK_TO_BLACK, lut_bb) self.cmd_with_data(spi, Command::LUT_BLACK_TO_BLACK, lut_bb)?;
self.wait_until_idle();
Ok(())
} }
} }

Loading…
Cancel
Save