mirror of
https://github.com/esphome/esphome.git
synced 2025-02-12 16:08:19 +00:00
Add waveshare 2.9inch e-Paper HAT (D) (#7906)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
parent
abdf215d3a
commit
b667ceaced
@ -55,6 +55,9 @@ GDEW029T5 = waveshare_epaper_ns.class_("GDEW029T5", WaveshareEPaper)
|
||||
WaveshareEPaper2P9InDKE = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper2P9InDKE", WaveshareEPaper
|
||||
)
|
||||
WaveshareEPaper2P9InD = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper2P9InD", WaveshareEPaper
|
||||
)
|
||||
WaveshareEPaper4P2In = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper4P2In", WaveshareEPaper
|
||||
)
|
||||
@ -128,6 +131,7 @@ MODELS = {
|
||||
"2.90in-b": ("b", WaveshareEPaper2P9InB),
|
||||
"2.90in-bv3": ("b", WaveshareEPaper2P9InBV3),
|
||||
"2.90inv2-r2": ("c", WaveshareEPaper2P9InV2R2),
|
||||
"2.90in-d": ("b", WaveshareEPaper2P9InD),
|
||||
"2.90in-dke": ("c", WaveshareEPaper2P9InDKE),
|
||||
"4.20in": ("b", WaveshareEPaper4P2In),
|
||||
"4.20in-bv2": ("b", WaveshareEPaper4P2InBV2),
|
||||
|
@ -1211,6 +1211,93 @@ void WaveshareEPaper2P9InB::dump_config() {
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
// ========================================================
|
||||
// Waveshare 2.9-inch E-Paper (Type D)
|
||||
// Waveshare WIKI: https://www.waveshare.com/wiki/Pico-ePaper-2.9-D
|
||||
// Datasheet: https://www.waveshare.com/w/upload/b/b5/2.9inch_e-Paper_(D)_Specification.pdf
|
||||
// ========================================================
|
||||
|
||||
void WaveshareEPaper2P9InD::initialize() {
|
||||
// EPD hardware init start
|
||||
this->reset_();
|
||||
|
||||
// Booster Soft Start
|
||||
this->command(0x06); // Command: BTST
|
||||
this->data(0x17); // Soft start configuration Phase A
|
||||
this->data(0x17); // Soft start configuration Phase B
|
||||
this->data(0x17); // Soft start configuration Phase C
|
||||
|
||||
// Power Setting
|
||||
this->command(0x01); // Command: PWR
|
||||
this->data(0x03); // Intern DC/DC for VDH/VDL and VGH/VGL
|
||||
this->data(0x00); // Default configuration VCOM_HV and VGHL_LV
|
||||
this->data(0x2b); // VDH = 10.8 V
|
||||
this->data(0x2b); // VDL = -10.8 V
|
||||
|
||||
// Power ON
|
||||
this->command(0x04); // Command: PON
|
||||
this->wait_until_idle_();
|
||||
|
||||
// Panel settings
|
||||
this->command(0x00); // Command: PSR
|
||||
this->data(0x1F); // LUT from OTP, black and white mode, default scan
|
||||
|
||||
// PLL Control
|
||||
this->command(0x30); // Command: PLL
|
||||
this->data(0x3A); // Default PLL frequency
|
||||
|
||||
// Resolution settings
|
||||
this->command(0x61); // Command: TRES
|
||||
this->data(0x80); // Width: 128
|
||||
this->data(0x01); // Height MSB: 296
|
||||
this->data(0x28); // Height LSB: 296
|
||||
|
||||
// VCOM and data interval settings
|
||||
this->command(0x50); // Command: CDI
|
||||
this->data(0x77);
|
||||
|
||||
// VCOM_DC settings
|
||||
this->command(0x82); // Command: VDCS
|
||||
this->data(0x12); // Dafault VCOM_DC
|
||||
}
|
||||
|
||||
void WaveshareEPaper2P9InD::display() {
|
||||
// Start transmitting old data (clearing buffer)
|
||||
this->command(0x10); // Command: DTM1 (OLD frame data)
|
||||
this->start_data_();
|
||||
this->write_array(this->buffer_, this->get_buffer_length_());
|
||||
this->end_data_();
|
||||
|
||||
// Start transmitting new data (updated content)
|
||||
this->command(0x13); // Command: DTM2 (NEW frame data)
|
||||
this->start_data_();
|
||||
this->write_array(this->buffer_, this->get_buffer_length_());
|
||||
this->end_data_();
|
||||
|
||||
// Refresh Display
|
||||
this->command(0x12); // Command: DRF
|
||||
this->wait_until_idle_();
|
||||
|
||||
// Enter Power Off
|
||||
this->command(0x02); // Command: POF
|
||||
this->wait_until_idle_();
|
||||
|
||||
// Enter Deep Sleep
|
||||
this->command(0x07); // Command: DSLP
|
||||
this->data(0xA5);
|
||||
}
|
||||
|
||||
int WaveshareEPaper2P9InD::get_width_internal() { return 128; }
|
||||
int WaveshareEPaper2P9InD::get_height_internal() { return 296; }
|
||||
void WaveshareEPaper2P9InD::dump_config() {
|
||||
LOG_DISPLAY("", "Waveshare E-Paper", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: 2.9in (D)");
|
||||
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);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -427,6 +427,26 @@ class WaveshareEPaper2P9InDKE : public WaveshareEPaper {
|
||||
int get_height_internal() override;
|
||||
};
|
||||
|
||||
class WaveshareEPaper2P9InD : public WaveshareEPaper {
|
||||
public:
|
||||
void initialize() override;
|
||||
|
||||
void display() override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
void deep_sleep() override {
|
||||
// COMMAND DEEP SLEEP
|
||||
this->command(0x07);
|
||||
this->data(0xA5);
|
||||
}
|
||||
|
||||
protected:
|
||||
int get_width_internal() override;
|
||||
|
||||
int get_height_internal() override;
|
||||
};
|
||||
|
||||
class WaveshareEPaper4P2In : public WaveshareEPaper {
|
||||
public:
|
||||
void initialize() override;
|
||||
|
@ -714,6 +714,25 @@ display:
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
|
||||
- platform: waveshare_epaper
|
||||
model: 2.90in-d
|
||||
spi_id: spi_waveshare_epaper
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: ${cs_pin}
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: ${dc_pin}
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: ${busy_pin}
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: ${reset_pin}
|
||||
reset_duration: 200ms
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
|
||||
- platform: waveshare_epaper
|
||||
model: 2.90in
|
||||
spi_id: spi_waveshare_epaper
|
||||
|
Loading…
x
Reference in New Issue
Block a user