Add support for V2 of the waveshare 5.83in e-paper display. (#3660)

This commit is contained in:
cooki35 2023-05-01 23:36:20 +02:00 committed by GitHub
parent 1c4af08ed3
commit bd6d6caa8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 129 additions and 0 deletions

View file

@ -39,6 +39,9 @@ WaveshareEPaper4P2InBV2 = waveshare_epaper_ns.class_(
WaveshareEPaper5P8In = waveshare_epaper_ns.class_(
"WaveshareEPaper5P8In", WaveshareEPaper
)
WaveshareEPaper5P8InV2 = waveshare_epaper_ns.class_(
"WaveshareEPaper5P8InV2", WaveshareEPaper
)
WaveshareEPaper7P5In = waveshare_epaper_ns.class_(
"WaveshareEPaper7P5In", WaveshareEPaper
)
@ -80,6 +83,7 @@ MODELS = {
"4.20in": ("b", WaveshareEPaper4P2In),
"4.20in-bv2": ("b", WaveshareEPaper4P2InBV2),
"5.83in": ("b", WaveshareEPaper5P8In),
"5.83inv2": ("b", WaveshareEPaper5P8InV2),
"7.50in": ("b", WaveshareEPaper7P5In),
"7.50in-bv2": ("b", WaveshareEPaper7P5InBV2),
"7.50in-bc": ("b", WaveshareEPaper7P5InBC),

View file

@ -1037,6 +1037,88 @@ void WaveshareEPaper5P8In::dump_config() {
LOG_PIN(" Busy Pin: ", this->busy_pin_);
LOG_UPDATE_INTERVAL(this);
}
// ========================================================
// 5.83in V2
// Datasheet/Specification/Reference:
// - https://www.waveshare.com/w/upload/3/37/5.83inch_e-Paper_V2_Specification.pdf
// - https://github.com/waveshare/e-Paper/blob/master/Arduino/epd5in83_V2/epd5in83_V2.cpp
// ========================================================
void WaveshareEPaper5P8InV2::initialize() {
// COMMAND POWER SETTING
this->command(0x01);
this->data(0x07);
this->data(0x07);
this->data(0x3f);
this->data(0x3f);
// COMMAND POWER ON
this->command(0x04);
delay(10);
this->wait_until_idle_();
// PANNEL SETTING
this->command(0x00);
this->data(0x1F);
// COMMAND RESOLUTION SETTING
this->command(0x61);
this->data(0x02);
this->data(0x88);
this->data(0x01);
this->data(0xE0);
this->command(0x15);
this->data(0x00);
// COMMAND TCON SETTING
this->command(0x60);
this->data(0x22);
// Do we need this?
// COMMAND PLL CONTROL
this->command(0x30);
this->data(0x3C); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
}
void HOT WaveshareEPaper5P8InV2::display() {
// Reuse the code from WaveshareEPaper4P2In::display()
// COMMAND VCM DC SETTING REGISTER
this->command(0x82);
this->data(0x12);
// COMMAND VCOM AND DATA INTERVAL SETTING
this->command(0x50);
this->data(0x97);
// COMMAND DATA START TRANSMISSION 1
this->command(0x10);
delay(2);
this->start_data_();
this->write_array(this->buffer_, this->get_buffer_length_());
this->end_data_();
delay(2);
// COMMAND DATA START TRANSMISSION 2
this->command(0x13);
delay(2);
this->start_data_();
this->write_array(this->buffer_, this->get_buffer_length_());
this->end_data_();
// COMMAND DISPLAY REFRESH
this->command(0x12);
}
int WaveshareEPaper5P8InV2::get_width_internal() { return 648; }
int WaveshareEPaper5P8InV2::get_height_internal() { return 480; }
void WaveshareEPaper5P8InV2::dump_config() {
LOG_DISPLAY("", "Waveshare E-Paper", this);
ESP_LOGCONFIG(TAG, " Model: 5.83inv2");
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 WaveshareEPaper7P5InBV2::initialize() {
// COMMAND POWER SETTING
this->command(0x01);

View file

@ -284,6 +284,49 @@ class WaveshareEPaper5P8In : public WaveshareEPaper {
int get_height_internal() override;
};
class WaveshareEPaper5P8InV2 : public WaveshareEPaper {
public:
void initialize() override;
void display() override;
void dump_config() override;
void deep_sleep() override {
// COMMAND VCOM AND DATA INTERVAL SETTING
this->command(0x50);
this->data(0x17); // border floating
// COMMAND VCM DC SETTING
this->command(0x82);
// COMMAND PANEL SETTING
this->command(0x00);
delay(100); // NOLINT
// COMMAND POWER SETTING
this->command(0x01);
this->data(0x00);
this->data(0x00);
this->data(0x00);
this->data(0x00);
this->data(0x00);
delay(100); // NOLINT
// COMMAND POWER OFF
this->command(0x02);
this->wait_until_idle_();
// COMMAND DEEP SLEEP
this->command(0x07);
this->data(0xA5); // check byte
}
protected:
int get_width_internal() override;
int get_height_internal() override;
};
class WaveshareEPaper7P5In : public WaveshareEPaper {
public:
void initialize() override;