mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
Waveshare epaper 7in5 v2alt (#3276)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
6f88f0ea3f
commit
8e3af515c9
3 changed files with 160 additions and 0 deletions
|
@ -50,6 +50,9 @@ WaveshareEPaper7P5InBV2 = waveshare_epaper_ns.class_(
|
|||
WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper7P5InV2", WaveshareEPaper
|
||||
)
|
||||
WaveshareEPaper7P5InV2alt = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper7P5InV2alt", WaveshareEPaper
|
||||
)
|
||||
WaveshareEPaper7P5InHDB = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper7P5InHDB", WaveshareEPaper
|
||||
)
|
||||
|
@ -79,6 +82,7 @@ MODELS = {
|
|||
"7.50in-bv2": ("b", WaveshareEPaper7P5InBV2),
|
||||
"7.50in-bc": ("b", WaveshareEPaper7P5InBC),
|
||||
"7.50inv2": ("b", WaveshareEPaper7P5InV2),
|
||||
"7.50inv2alt": ("b", WaveshareEPaper7P5InV2alt),
|
||||
"7.50in-hd-b": ("b", WaveshareEPaper7P5InHDB),
|
||||
"2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE),
|
||||
}
|
||||
|
|
|
@ -1137,6 +1137,143 @@ void HOT WaveshareEPaper7P5InV2::display() {
|
|||
int WaveshareEPaper7P5InV2::get_width_internal() { return 800; }
|
||||
int WaveshareEPaper7P5InV2::get_height_internal() { return 480; }
|
||||
void WaveshareEPaper7P5InV2::dump_config() {
|
||||
LOG_DISPLAY("", "Waveshare E-Paper", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: 7.5inV2rev2");
|
||||
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);
|
||||
}
|
||||
|
||||
/* 7.50inV2alt */
|
||||
bool WaveshareEPaper7P5InV2alt::wait_until_idle_() {
|
||||
if (this->busy_pin_ == nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const uint32_t start = millis();
|
||||
while (this->busy_pin_->digital_read()) {
|
||||
this->command(0x71);
|
||||
if (millis() - start > this->idle_timeout_()) {
|
||||
ESP_LOGI(TAG, "Timeout while displaying image!");
|
||||
return false;
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaveshareEPaper7P5InV2alt::initialize() {
|
||||
this->reset_();
|
||||
|
||||
// COMMAND POWER SETTING
|
||||
this->command(0x01);
|
||||
|
||||
// 1-0=11: internal power
|
||||
this->data(0x17);
|
||||
|
||||
this->data(0x17); // VGH&VGL
|
||||
this->data(0x3F); // VSH
|
||||
this->data(0x3F); // VSL
|
||||
this->data(0x11); // VSHR
|
||||
|
||||
// VCOM DC Setting
|
||||
this->command(0x82);
|
||||
this->data(0x24); // VCOM
|
||||
|
||||
// Booster Setting
|
||||
this->command(0x06);
|
||||
this->data(0x27);
|
||||
this->data(0x27);
|
||||
this->data(0x2F);
|
||||
this->data(0x17);
|
||||
|
||||
// OSC Setting
|
||||
this->command(0x30);
|
||||
this->data(0x06); // 2-0=100: N=4 ; 5-3=111: M=7 ; 3C=50Hz 3A=100HZ
|
||||
|
||||
// POWER ON
|
||||
this->command(0x04);
|
||||
|
||||
delay(100); // NOLINT
|
||||
this->wait_until_idle_();
|
||||
// COMMAND PANEL SETTING
|
||||
this->command(0x00);
|
||||
this->data(0x3F); // KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
// COMMAND RESOLUTION SETTING
|
||||
this->command(0x61);
|
||||
this->data(0x03); // source 800
|
||||
this->data(0x20);
|
||||
this->data(0x01); // gate 480
|
||||
this->data(0xE0);
|
||||
// COMMAND ...?
|
||||
this->command(0x15);
|
||||
this->data(0x00);
|
||||
// COMMAND VCOM AND DATA INTERVAL SETTING
|
||||
this->command(0x50);
|
||||
this->data(0x10);
|
||||
this->data(0x07);
|
||||
// COMMAND TCON SETTING
|
||||
this->command(0x60);
|
||||
this->data(0x22);
|
||||
// Resolution setting
|
||||
this->command(0x65);
|
||||
this->data(0x00);
|
||||
this->data(0x00); // 800*480
|
||||
this->data(0x00);
|
||||
this->data(0x00);
|
||||
|
||||
this->wait_until_idle_();
|
||||
|
||||
uint8_t lut_vcom_7_i_n5_v2[] = {
|
||||
0x0, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0xF, 0x1, 0xF, 0x1, 0x2, 0x0, 0xF, 0xF, 0x0, 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,
|
||||
};
|
||||
|
||||
uint8_t lut_ww_7_i_n5_v2[] = {
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 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,
|
||||
};
|
||||
|
||||
uint8_t lut_bw_7_i_n5_v2[] = {
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 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,
|
||||
};
|
||||
|
||||
uint8_t lut_wb_7_i_n5_v2[] = {
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x3, 0x84, 0xF, 0x1, 0xF, 0x1, 0x4, 0x40, 0xF, 0xF, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
};
|
||||
|
||||
uint8_t lut_bb_7_i_n5_v2[] = {
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x40, 0xF, 0xF, 0x0, 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,
|
||||
};
|
||||
|
||||
uint8_t count;
|
||||
this->command(0x20); // VCOM
|
||||
for (count = 0; count < 42; count++)
|
||||
this->data(lut_vcom_7_i_n5_v2[count]);
|
||||
|
||||
this->command(0x21); // LUTBW
|
||||
for (count = 0; count < 42; count++)
|
||||
this->data(lut_ww_7_i_n5_v2[count]);
|
||||
|
||||
this->command(0x22); // LUTBW
|
||||
for (count = 0; count < 42; count++)
|
||||
this->data(lut_bw_7_i_n5_v2[count]);
|
||||
|
||||
this->command(0x23); // LUTWB
|
||||
for (count = 0; count < 42; count++)
|
||||
this->data(lut_wb_7_i_n5_v2[count]);
|
||||
|
||||
this->command(0x24); // LUTBB
|
||||
for (count = 0; count < 42; count++)
|
||||
this->data(lut_bb_7_i_n5_v2[count]);
|
||||
}
|
||||
|
||||
void WaveshareEPaper7P5InV2alt::dump_config() {
|
||||
LOG_DISPLAY("", "Waveshare E-Paper", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: 7.5inV2");
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
|
|
|
@ -350,6 +350,25 @@ class WaveshareEPaper7P5InV2 : public WaveshareEPaper {
|
|||
int get_height_internal() override;
|
||||
};
|
||||
|
||||
class WaveshareEPaper7P5InV2alt : public WaveshareEPaper7P5InV2 {
|
||||
public:
|
||||
bool wait_until_idle_();
|
||||
void initialize() override;
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
void reset_() {
|
||||
if (this->reset_pin_ != nullptr) {
|
||||
this->reset_pin_->digital_write(true);
|
||||
delay(200); // NOLINT
|
||||
this->reset_pin_->digital_write(false);
|
||||
delay(2);
|
||||
this->reset_pin_->digital_write(true);
|
||||
delay(20);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class WaveshareEPaper7P5InHDB : public WaveshareEPaper {
|
||||
public:
|
||||
void initialize() override;
|
||||
|
|
Loading…
Reference in a new issue