waveshare_epaper: Add 2.90in-dke (#6492)

Co-authored-by: The_Niz <the_niz@nurdspace.nl>
This commit is contained in:
polyfloyd 2024-04-26 10:44:58 +02:00 committed by GitHub
parent 031e26ad98
commit cd91c7050c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 171 additions and 0 deletions

View file

@ -49,6 +49,9 @@ WaveshareEPaper2P9InV2R2 = waveshare_epaper_ns.class_(
"WaveshareEPaper2P9InV2R2", WaveshareEPaper
)
GDEY029T94 = waveshare_epaper_ns.class_("GDEY029T94", WaveshareEPaper)
WaveshareEPaper2P9InDKE = waveshare_epaper_ns.class_(
"WaveshareEPaper2P9InDKE", WaveshareEPaper
)
WaveshareEPaper4P2In = waveshare_epaper_ns.class_(
"WaveshareEPaper4P2In", WaveshareEPaper
)
@ -115,6 +118,7 @@ MODELS = {
"2.90in-b": ("b", WaveshareEPaper2P9InB),
"2.90in-bv3": ("b", WaveshareEPaper2P9InBV3),
"2.90inv2-r2": ("c", WaveshareEPaper2P9InV2R2),
"2.90in-dke": ("c", WaveshareEPaper2P9InDKE),
"4.20in": ("b", WaveshareEPaper4P2In),
"4.20in-bv2": ("b", WaveshareEPaper4P2InBV2),
"5.83in": ("b", WaveshareEPaper5P8In),

View file

@ -1127,6 +1127,131 @@ void WaveshareEPaper2P9InB::dump_config() {
LOG_UPDATE_INTERVAL(this);
}
// DKE 2.9
// https://www.badge.team/docs/badges/sha2017/hardware/#e-ink-display-the-dke-group-depg0290b1
// https://www.badge.team/docs/badges/sha2017/hardware/DEPG0290B01V3.0.pdf
static const uint8_t LUT_SIZE_DKE = 70;
static const uint8_t UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
0xA0, 0x90, 0x50, 0x0, 0x0, 0x0, 0x0, 0x50, 0x90, 0xA0, 0x0, 0x0, 0x0, 0x0, 0xA0, 0x90, 0x50, 0x0,
0x0, 0x0, 0x0, 0x50, 0x90, 0xA0, 0x0, 0x0, 0x0, 0x0, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0xF,
0xF, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x02, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
};
static const uint8_t PART_UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x05, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t FULL_UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
0x90, 0x50, 0xa0, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa0, 0xa0, 0x80, 0x00, 0x90, 0x50, 0xa0, 0x50,
0x50, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa0, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
0x04, 0x00, 0x00, 0x00, 0x0b, 0x04, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00,
0x00, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
void WaveshareEPaper2P9InDKE::initialize() {
// Hardware reset
delay(10);
this->reset_pin_->digital_write(false);
delayMicroseconds(200);
this->reset_pin_->digital_write(true);
delayMicroseconds(200);
// Wait for busy low
this->wait_until_idle_();
// Software reset
this->command(0x12);
// Wait for busy low
this->wait_until_idle_();
// Set Analog Block Control
this->command(0x74);
this->data(0x54);
// Set Digital Block Control
this->command(0x7E);
this->data(0x3B);
// Set display size and driver output control
this->command(0x01);
// this->data(0x27);
// this->data(0x01);
// this->data(0x00);
this->data(this->get_height_internal() - 1);
this->data((this->get_height_internal() - 1) >> 8);
this->data(0x00); // ? GD = 0, SM = 0, TB = 0
// Ram data entry mode
this->command(0x11);
this->data(0x03);
// Set Ram X address
this->command(0x44);
this->data(0x00);
this->data(0x0F);
// Set Ram Y address
this->command(0x45);
this->data(0x00);
this->data(0x00);
this->data(0x27);
this->data(0x01);
// Set border
this->command(0x3C);
// this->data(0x80);
this->data(0x01);
// Set VCOM value
this->command(0x2C);
this->data(0x26);
// Gate voltage setting
this->command(0x03);
this->data(0x17);
// Source voltage setting
this->command(0x04);
this->data(0x41);
this->data(0x00);
this->data(0x32);
// Frame setting 50hz
this->command(0x3A);
this->data(0x30);
this->command(0x3B);
this->data(0x0A);
// Load LUT
this->command(0x32);
for (uint8_t v : FULL_UPDATE_LUT_DKE)
this->data(v);
}
void HOT WaveshareEPaper2P9InDKE::display() {
ESP_LOGI(TAG, "Performing e-paper update.");
// Set Ram X address counter
this->command(0x4e);
this->data(0);
// Set Ram Y address counter
this->command(0x4f);
this->data(0);
this->data(0);
// Load image (128/8*296)
this->command(0x24);
this->start_data_();
this->write_array(this->buffer_, this->get_buffer_length_());
this->end_data_();
// Image update
this->command(0x22);
this->data(0xC7);
this->command(0x20);
// Wait for busy low
this->wait_until_idle_();
// Enter deep sleep mode
this->command(0x10);
this->data(0x01);
}
int WaveshareEPaper2P9InDKE::get_width_internal() { return 128; }
int WaveshareEPaper2P9InDKE::get_height_internal() { return 296; }
void WaveshareEPaper2P9InDKE::dump_config() {
LOG_DISPLAY("", "Waveshare E-Paper", this);
ESP_LOGCONFIG(TAG, " Model: 2.9in DKE");
LOG_PIN(" Reset Pin: ", this->reset_pin_);
LOG_PIN(" DC Pin: ", this->dc_pin_);
LOG_PIN(" Busy Pin: ", this->busy_pin_);
LOG_UPDATE_INTERVAL(this);
}
void WaveshareEPaper2P9InDKE::set_full_update_every(uint32_t full_update_every) {
this->full_update_every_ = full_update_every;
}
// ========================================================
// 2.90in Type B (LUT from OTP)
// Datasheet:

View file

@ -373,6 +373,30 @@ class WaveshareEPaper2P9InV2R2 : public WaveshareEPaper {
void reset_();
};
class WaveshareEPaper2P9InDKE : public WaveshareEPaper {
public:
void initialize() override;
void display() override;
void dump_config() override;
void deep_sleep() override {
// COMMAND DEEP SLEEP
this->command(0x10);
this->data(0x01);
}
void set_full_update_every(uint32_t full_update_every);
protected:
uint32_t full_update_every_{30};
uint32_t at_update_{0};
int get_width_internal() override;
int get_height_internal() override;
};
class WaveshareEPaper4P2In : public WaveshareEPaper {
public:
void initialize() override;

View file

@ -83,6 +83,24 @@ display:
full_update_every: 30
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper
model: 2.90in-dke
spi_id: spi_id_1
cs_pin:
allow_other_uses: true
number: GPIO25
dc_pin:
allow_other_uses: true
number: GPIO26
busy_pin:
allow_other_uses: true
number: GPIO27
reset_pin:
allow_other_uses: true
number: GPIO32
full_update_every: 1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper
model: 2.70in-b
spi_id: spi_id_1