commit
181010f366
|
|
@ -8,10 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- Added QuickRefresh Trait and implemented it for EPD4in2 in #62 (thanks to @David-OConnor)
|
||||||
|
- Added Epd 2in7 (B) support in #60 (thanks to @pjsier)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Use specific ParseColorError instead of ()
|
- Use specific ParseColorError instead of ()
|
||||||
|
- EPD4in2: Don't set the resolution (and some more) over and over again (#48)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,15 @@ where
|
||||||
// 3A 100HZ 29 150Hz 39 200HZ 31 171HZ DEFAULT: 3c 50Hz
|
// 3A 100HZ 29 150Hz 39 200HZ 31 171HZ DEFAULT: 3c 50Hz
|
||||||
self.cmd_with_data(spi, Command::PLL_CONTROL, &[0x3A])?;
|
self.cmd_with_data(spi, Command::PLL_CONTROL, &[0x3A])?;
|
||||||
|
|
||||||
|
self.send_resolution(spi)?;
|
||||||
|
|
||||||
|
self.interface
|
||||||
|
.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?;
|
||||||
|
|
||||||
|
//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.set_lut(spi, None)?;
|
self.set_lut(spi, None)?;
|
||||||
|
|
||||||
self.wait_until_idle();
|
self.wait_until_idle();
|
||||||
|
|
@ -202,15 +211,6 @@ where
|
||||||
self.wait_until_idle();
|
self.wait_until_idle();
|
||||||
let color_value = self.color.get_byte_value();
|
let color_value = self.color.get_byte_value();
|
||||||
|
|
||||||
self.send_resolution(spi)?;
|
|
||||||
|
|
||||||
self.interface
|
|
||||||
.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?;
|
|
||||||
|
|
||||||
//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.interface
|
self.interface
|
||||||
.cmd(spi, Command::DATA_START_TRANSMISSION_1)?;
|
.cmd(spi, Command::DATA_START_TRANSMISSION_1)?;
|
||||||
self.interface
|
self.interface
|
||||||
|
|
@ -450,14 +450,6 @@ where
|
||||||
fn update_old_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
|
fn update_old_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
|
||||||
self.wait_until_idle();
|
self.wait_until_idle();
|
||||||
|
|
||||||
// todo: Eval if you need these 3 res setting items.
|
|
||||||
self.send_resolution(spi)?;
|
|
||||||
self.interface
|
|
||||||
.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?;
|
|
||||||
//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.interface
|
self.interface
|
||||||
.cmd(spi, Command::DATA_START_TRANSMISSION_1)?;
|
.cmd(spi, Command::DATA_START_TRANSMISSION_1)?;
|
||||||
|
|
||||||
|
|
@ -490,14 +482,6 @@ where
|
||||||
) -> Result<(), SPI::Error> {
|
) -> Result<(), SPI::Error> {
|
||||||
self.wait_until_idle();
|
self.wait_until_idle();
|
||||||
|
|
||||||
// todo: Eval if you need these 3 res setting items.
|
|
||||||
self.send_resolution(spi)?;
|
|
||||||
self.interface
|
|
||||||
.cmd_with_data(spi, Command::VCM_DC_SETTING, &[0x12])?;
|
|
||||||
//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])?;
|
|
||||||
|
|
||||||
if buffer.len() as u32 != width / 8 * height {
|
if buffer.len() as u32 != width / 8 * height {
|
||||||
//TODO: panic!! or sth like that
|
//TODO: panic!! or sth like that
|
||||||
//return Err("Wrong buffersize");
|
//return Err("Wrong buffersize");
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,43 @@ where
|
||||||
/// and how they will change. This isn't required when using full refreshes.
|
/// and how they will change. This isn't required when using full refreshes.
|
||||||
///
|
///
|
||||||
/// (todo: Example ommitted due to CI failures.)
|
/// (todo: Example ommitted due to CI failures.)
|
||||||
|
/// Example:
|
||||||
|
///```rust, no_run
|
||||||
|
///# use embedded_hal_mock::*;
|
||||||
|
///# fn main() -> Result<(), MockError> {
|
||||||
|
///# use embedded_graphics::{
|
||||||
|
///# pixelcolor::BinaryColor::On as Black, prelude::*, primitives::Line, style::PrimitiveStyle,
|
||||||
|
///# };
|
||||||
|
///# use epd_waveshare::{epd4in2::*, prelude::*};
|
||||||
|
///# use epd_waveshare::graphics::VarDisplay;
|
||||||
|
///#
|
||||||
|
///# let expectations = [];
|
||||||
|
///# let mut spi = spi::Mock::new(&expectations);
|
||||||
|
///# let expectations = [];
|
||||||
|
///# let cs_pin = pin::Mock::new(&expectations);
|
||||||
|
///# let busy_in = pin::Mock::new(&expectations);
|
||||||
|
///# let dc = pin::Mock::new(&expectations);
|
||||||
|
///# let rst = pin::Mock::new(&expectations);
|
||||||
|
///# let mut delay = delay::MockNoop::new();
|
||||||
|
///#
|
||||||
|
///# // Setup EPD
|
||||||
|
///# let mut epd = EPD4in2::new(&mut spi, cs_pin, busy_in, dc, rst, &mut delay)?;
|
||||||
|
///let (x, y, frame_width, frame_height) = (20, 40, 80,80);
|
||||||
|
///
|
||||||
|
///let mut buffer = [DEFAULT_BACKGROUND_COLOR.get_byte_value(); 80 / 8 * 80];
|
||||||
|
///let mut display = VarDisplay::new(frame_width, frame_height, &mut buffer);
|
||||||
|
///
|
||||||
|
///epd.update_partial_old_frame(&mut spi, display.buffer(), x, y, frame_width, frame_height)
|
||||||
|
/// .ok();
|
||||||
|
///
|
||||||
|
///display.clear_buffer(Color::White);
|
||||||
|
///// Execute drawing commands here.
|
||||||
|
///
|
||||||
|
///epd.update_partial_new_frame(&mut spi, display.buffer(), x, y, frame_width, frame_height)
|
||||||
|
/// .ok();
|
||||||
|
///# Ok(())
|
||||||
|
///# }
|
||||||
|
///```
|
||||||
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST>
|
pub trait QuickRefresh<SPI, CS, BUSY, DC, RST>
|
||||||
where
|
where
|
||||||
SPI: Write<u8>,
|
SPI: Write<u8>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue