diff --git a/esphome/components/waveshare_epaper/display.py b/esphome/components/waveshare_epaper/display.py index 44120ebbc5..fe5b51290e 100644 --- a/esphome/components/waveshare_epaper/display.py +++ b/esphome/components/waveshare_epaper/display.py @@ -50,6 +50,9 @@ WaveshareEPaper7P5InBV2 = waveshare_epaper_ns.class_( WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_( "WaveshareEPaper7P5InV2", WaveshareEPaper ) +WaveshareEPaper7P5InHDB = waveshare_epaper_ns.class_( + "WaveshareEPaper7P5InHDB", WaveshareEPaper +) WaveshareEPaper2P13InDKE = waveshare_epaper_ns.class_( "WaveshareEPaper2P13InDKE", WaveshareEPaper ) @@ -76,6 +79,7 @@ MODELS = { "7.50in-bv2": ("b", WaveshareEPaper7P5InBV2), "7.50in-bc": ("b", WaveshareEPaper7P5InBC), "7.50inv2": ("b", WaveshareEPaper7P5InV2), + "7.50in-hd-b": ("b", WaveshareEPaper7P5InHDB), "2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE), } diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 71e3b22e7d..59b3e90b03 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -1241,6 +1241,107 @@ void WaveshareEPaper7P5InBC::dump_config() { LOG_UPDATE_INTERVAL(this); } +void WaveshareEPaper7P5InHDB::initialize() { + this->command(0x12); // SWRESET + + this->wait_until_idle_(); // waiting for the electronic paper IC to release the idle signal + + this->command(0x46); // Auto Write RAM + this->data(0xF7); + + this->wait_until_idle_(); // waiting for the electronic paper IC to release the idle signal + + this->command(0x47); // Auto Write RAM + this->data(0xF7); + + this->wait_until_idle_(); // waiting for the electronic paper IC to release the idle signal + + this->command(0x0C); // Soft start setting + this->data(0xAE); + this->data(0xC7); + this->data(0xC3); + this->data(0xC0); + this->data(0x40); + + this->command(0x01); // Set MUX as 527 + this->data(0xAF); + this->data(0x02); + this->data(0x01); + + this->command(0x11); // Data entry mode + this->data(0x01); + + this->command(0x44); + this->data(0x00); // RAM x address start at 0 + this->data(0x00); + this->data(0x6F); // RAM x address end at 36Fh -> 879 + this->data(0x03); + + this->command(0x45); + this->data(0xAF); // RAM y address start at 20Fh; + this->data(0x02); + this->data(0x00); // RAM y address end at 00h; + this->data(0x00); + + this->command(0x3C); // VBD + this->data(0x01); // LUT1, for white + + this->command(0x18); + this->data(0X80); + + this->command(0x22); + this->data(0XB1); // Load Temperature and waveform setting. + + this->command(0x20); + + this->wait_until_idle_(); // waiting for the electronic paper IC to release the idle signal + + this->command(0x4E); + this->data(0x00); + this->data(0x00); + + this->command(0x4F); + this->data(0xAF); + this->data(0x02); +} + +void HOT WaveshareEPaper7P5InHDB::display() { + this->command(0x4F); + this->data(0xAf); + this->data(0x02); + + // BLACK + this->command(0x24); + this->start_data_(); + this->write_array(this->buffer_, this->get_buffer_length_()); + this->end_data_(); + + // RED + this->command(0x26); + this->start_data_(); + for (size_t i = 0; i < this->get_buffer_length_(); i++) + this->write_byte(0x00); + this->end_data_(); + + this->command(0x22); + this->data(0xC7); + this->command(0x20); + delay(100); // NOLINT +} + +int WaveshareEPaper7P5InHDB::get_width_internal() { return 880; } + +int WaveshareEPaper7P5InHDB::get_height_internal() { return 528; } + +void WaveshareEPaper7P5InHDB::dump_config() { + LOG_DISPLAY("", "Waveshare E-Paper", this); + ESP_LOGCONFIG(TAG, " Model: 7.5in-HD-b"); + 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); +} + static const uint8_t LUT_SIZE_TTGO_DKE_PART = 153; static const uint8_t PART_UPDATE_LUT_TTGO_DKE[LUT_SIZE_TTGO_DKE_PART] = { diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index 96bd2fc782..41b93978ab 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -350,6 +350,26 @@ class WaveshareEPaper7P5InV2 : public WaveshareEPaper { int get_height_internal() override; }; +class WaveshareEPaper7P5InHDB : public WaveshareEPaper { + public: + void initialize() override; + + void display() override; + + void dump_config() override; + + void deep_sleep() override { + // deep sleep + this->command(0x10); + this->data(0x01); + } + + protected: + int get_width_internal() override; + + int get_height_internal() override; +}; + class WaveshareEPaper2P13InDKE : public WaveshareEPaper { public: void initialize() override;