mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 07:24:54 +01:00
[waveshare_epaper] Add support for 13.3in-k (#6443)
This commit is contained in:
parent
c723fd1f80
commit
a64106e48c
3 changed files with 111 additions and 0 deletions
|
@ -94,6 +94,9 @@ WaveshareEPaper2P13InV2 = waveshare_epaper_ns.class_(
|
|||
WaveshareEPaper2P13InV3 = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper2P13InV3", WaveshareEPaper
|
||||
)
|
||||
WaveshareEPaper13P3InK = waveshare_epaper_ns.class_(
|
||||
"WaveshareEPaper13P3InK", WaveshareEPaper
|
||||
)
|
||||
GDEW0154M09 = waveshare_epaper_ns.class_("GDEW0154M09", WaveshareEPaper)
|
||||
|
||||
WaveshareEPaperTypeAModel = waveshare_epaper_ns.enum("WaveshareEPaperTypeAModel")
|
||||
|
@ -133,6 +136,7 @@ MODELS = {
|
|||
"2.13in-ttgo-dke": ("c", WaveshareEPaper2P13InDKE),
|
||||
"2.13inv3": ("c", WaveshareEPaper2P13InV3),
|
||||
"1.54in-m5coreink-m09": ("c", GDEW0154M09),
|
||||
"13.3in-k": ("b", WaveshareEPaper13P3InK),
|
||||
}
|
||||
|
||||
RESET_PIN_REQUIRED_MODELS = ("2.13inv2", "2.13in-ttgo-b74")
|
||||
|
|
|
@ -2963,5 +2963,88 @@ void WaveshareEPaper2P13InDKE::set_full_update_every(uint32_t full_update_every)
|
|||
this->full_update_every_ = full_update_every;
|
||||
}
|
||||
|
||||
// ========================================================
|
||||
// 13.3in (K version)
|
||||
// Datasheet/Specification/Reference:
|
||||
// - https://files.waveshare.com/wiki/13.3inch-e-Paper-HAT-(K)/13.3-inch-e-Paper-(K)-user-manual.pdf
|
||||
// - https://github.com/waveshareteam/e-Paper/tree/master/Arduino/epd13in3k
|
||||
// ========================================================
|
||||
|
||||
// using default wait_until_idle_() function
|
||||
void WaveshareEPaper13P3InK::initialize() {
|
||||
this->wait_until_idle_();
|
||||
this->command(0x12); // SWRESET
|
||||
this->wait_until_idle_();
|
||||
|
||||
this->command(0x0c); // set soft start
|
||||
this->data(0xae);
|
||||
this->data(0xc7);
|
||||
this->data(0xc3);
|
||||
this->data(0xc0);
|
||||
this->data(0x80);
|
||||
|
||||
this->command(0x01); // driver output control
|
||||
this->data((get_height_internal() - 1) % 256); // Y
|
||||
this->data((get_height_internal() - 1) / 256); // Y
|
||||
this->data(0x00);
|
||||
|
||||
this->command(0x11); // data entry mode
|
||||
this->data(0x03);
|
||||
|
||||
// SET WINDOWS
|
||||
// XRAM_START_AND_END_POSITION
|
||||
this->command(0x44);
|
||||
this->data(0 & 0xFF);
|
||||
this->data((0 >> 8) & 0x03);
|
||||
this->data((get_width_internal() - 1) & 0xFF);
|
||||
this->data(((get_width_internal() - 1) >> 8) & 0x03);
|
||||
// YRAM_START_AND_END_POSITION
|
||||
this->command(0x45);
|
||||
this->data(0 & 0xFF);
|
||||
this->data((0 >> 8) & 0x03);
|
||||
this->data((get_height_internal() - 1) & 0xFF);
|
||||
this->data(((get_height_internal() - 1) >> 8) & 0x03);
|
||||
|
||||
this->command(0x3C); // Border setting
|
||||
this->data(0x01);
|
||||
|
||||
this->command(0x18); // use the internal temperature sensor
|
||||
this->data(0x80);
|
||||
|
||||
// SET CURSOR
|
||||
// XRAM_ADDRESS
|
||||
this->command(0x4E);
|
||||
this->data(0 & 0xFF);
|
||||
this->data((0 >> 8) & 0x03);
|
||||
// YRAM_ADDRESS
|
||||
this->command(0x4F);
|
||||
this->data(0 & 0xFF);
|
||||
this->data((0 >> 8) & 0x03);
|
||||
}
|
||||
void HOT WaveshareEPaper13P3InK::display() {
|
||||
// do single full update
|
||||
this->command(0x24);
|
||||
this->start_data_();
|
||||
this->write_array(this->buffer_, this->get_buffer_length_());
|
||||
this->end_data_();
|
||||
|
||||
// COMMAND DISPLAY REFRESH
|
||||
this->command(0x22);
|
||||
this->data(0xF7);
|
||||
this->command(0x20);
|
||||
}
|
||||
|
||||
int WaveshareEPaper13P3InK::get_width_internal() { return 960; }
|
||||
int WaveshareEPaper13P3InK::get_height_internal() { return 680; }
|
||||
uint32_t WaveshareEPaper13P3InK::idle_timeout_() { return 10000; }
|
||||
void WaveshareEPaper13P3InK::dump_config() {
|
||||
LOG_DISPLAY("", "Waveshare E-Paper", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: 13.3inK");
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace waveshare_epaper
|
||||
} // namespace esphome
|
||||
|
|
|
@ -163,6 +163,7 @@ enum WaveshareEPaperTypeBModel {
|
|||
WAVESHARE_EPAPER_7_5_IN,
|
||||
WAVESHARE_EPAPER_7_5_INV2,
|
||||
WAVESHARE_EPAPER_7_5_IN_B_V2,
|
||||
WAVESHARE_EPAPER_13_3_IN_K,
|
||||
};
|
||||
|
||||
class WaveshareEPaper2P7In : public WaveshareEPaper {
|
||||
|
@ -769,5 +770,28 @@ class WaveshareEPaper2P13InV3 : public WaveshareEPaper {
|
|||
bool is_busy_{false};
|
||||
void write_lut_(const uint8_t *lut);
|
||||
};
|
||||
|
||||
class WaveshareEPaper13P3InK : 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);
|
||||
}
|
||||
|
||||
protected:
|
||||
int get_width_internal() override;
|
||||
|
||||
int get_height_internal() override;
|
||||
|
||||
uint32_t idle_timeout_() override;
|
||||
};
|
||||
|
||||
} // namespace waveshare_epaper
|
||||
} // namespace esphome
|
||||
|
|
Loading…
Reference in a new issue