Skip to content

Update refresh rate for 2.9 Inch v2 e-paper #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/epd2in9_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ const LUT_PARTIAL_2IN9: [u8; 159] = [
0x22, 0x0, 0x0, 0x0, 0x22, 0x17, 0x41, 0xB0, 0x32, 0x36,
];


const WS_20_30: [u8; 159] = [
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x10, 0x66, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x8, 0x0, 0x0, 0x0, 0x0, 0x1, 0xA, 0xA, 0x0, 0xA, 0xA, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x14, 0x8, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x44, 0x44, 0x44,
0x44, 0x44, 0x0, 0x0, 0x0, 0x22, 0x17, 0x41, 0x0, 0x32, 0x36,
];

use embedded_hal::{delay::*, digital::*, spi::SpiDevice};

use crate::type_a::command::Command;
Expand Down Expand Up @@ -144,6 +157,18 @@ where
self.set_ram_counter(spi, delay, 0, 0)?;

self.wait_until_idle(spi, delay)?;

// set LUT by host
self.set_lut_helper(spi, delay, &WS_20_30[0..153])?;
self.interface
.cmd_with_data(spi, Command::WriteLutRegisterEnd, &WS_20_30[153..154])?;
self.interface
.cmd_with_data(spi, Command::GateDrivingVoltage, &WS_20_30[154..155])?;
self.interface
.cmd_with_data(spi, Command::SourceDrivingVoltage, &WS_20_30[155..158])?;
self.interface
.cmd_with_data(spi, Command::WriteVcomRegister, &WS_20_30[158..159])?;

Ok(())
}
}
Expand Down Expand Up @@ -235,7 +260,7 @@ where
self.wait_until_idle(spi, delay)?;
// Enable clock signal, Enable Analog, Load temperature value, DISPLAY with DISPLAY Mode 1, Disable Analog, Disable OSC
self.interface
.cmd_with_data(spi, Command::DisplayUpdateControl2, &[0xF7])?;
.cmd_with_data(spi, Command::DisplayUpdateControl2, &[0xC7])?;
self.interface.cmd(spi, Command::MasterActivation)?;
self.wait_until_idle(spi, delay)?;
Ok(())
Expand Down