ESPHome 2026.1.4
Loading...
Searching...
No Matches
epaper_waveshare.cpp
Go to the documentation of this file.
1#include "epaper_waveshare.h"
2
3namespace esphome::epaper_spi {
4
5static const char *const TAG = "epaper_spi.waveshare";
6
7void EpaperWaveshare::initialise(bool partial) {
9 if (partial) {
10 this->cmd_data(0x32, this->partial_lut_, this->partial_lut_length_);
11 this->cmd_data(0x3C, {0x80});
12 this->cmd_data(0x22, {0xC0});
13 this->command(0x20);
14 this->next_delay_ = 100;
15 } else {
16 this->cmd_data(0x32, this->lut_, this->lut_length_);
17 this->cmd_data(0x3C, {0x05});
18 }
19 this->send_red_ = true;
20}
21
23 this->x_low_ &= ~7;
24 this->x_high_ += 7;
25 this->x_high_ &= ~7;
26 uint16_t x_start = this->x_low_ / 8;
27 uint16_t x_end = (this->x_high_ - 1) / 8;
28 this->cmd_data(0x44, {(uint8_t) x_start, (uint8_t) (x_end)});
29 this->cmd_data(0x4E, {(uint8_t) x_start});
30 this->cmd_data(0x45, {(uint8_t) this->y_low_, (uint8_t) (this->y_low_ / 256), (uint8_t) (this->y_high_ - 1),
31 (uint8_t) ((this->y_high_ - 1) / 256)});
32 this->cmd_data(0x4F, {(uint8_t) this->y_low_, (uint8_t) (this->y_low_ / 256)});
33 ESP_LOGV(TAG, "Set window X: %u-%u, Y: %u-%u", this->x_low_, this->x_high_, this->y_low_, this->y_high_);
34}
35
37 if (partial) {
38 this->cmd_data(0x22, {0x0F});
39 } else {
40 this->cmd_data(0x22, {0xC7});
41 }
42 this->command(0x20);
43 this->next_delay_ = partial ? 100 : 3000;
44}
45
46void EpaperWaveshare::deep_sleep() { this->cmd_data(0x10, {0x01}); }
47} // namespace esphome::epaper_spi
void command(uint8_t value)
void cmd_data(uint8_t command, const uint8_t *ptr, size_t length)
virtual void initialise(bool partial)
void refresh_screen(bool partial) override
void initialise(bool partial) override