6 namespace waveshare_epaper {
8 static const char *
const TAG =
"waveshare_2.13v3";
10 static const uint8_t PARTIAL_LUT[] = {
12 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
13 0x0, 0x0, 0x0, 0x0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0,
14 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
15 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
16 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
17 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
18 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
19 0x0, 0x0, 0x0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
22 static const uint8_t FULL_LUT[] = {
24 0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0,
25 0x0, 0x0, 0x0, 0x0, 0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x4A, 0x80, 0x0,
26 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
27 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0,
28 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
29 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
30 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
31 0x0, 0x0, 0x0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
34 static const uint8_t SW_RESET = 0x12;
35 static const uint8_t ACTIVATE = 0x20;
36 static const uint8_t WRITE_BUFFER = 0x24;
37 static const uint8_t WRITE_BASE = 0x26;
39 static const uint8_t DRV_OUT_CTL[] = {0x01, 0x27, 0x01, 0x00};
40 static const uint8_t GATEV[] = {0x03, 0x17};
41 static const uint8_t SRCV[] = {0x04, 0x41, 0x0C, 0x32};
42 static const uint8_t SLEEP[] = {0x10, 0x01};
43 static const uint8_t DATA_ENTRY[] = {0x11, 0x03};
44 static const uint8_t TEMP_SENS[] = {0x18, 0x80};
45 static const uint8_t DISPLAY_UPDATE[] = {0x21, 0x00, 0x80};
46 static const uint8_t UPSEQ[] = {0x22, 0xC0};
47 static const uint8_t ON_FULL[] = {0x22, 0xC7};
48 static const uint8_t ON_PARTIAL[] = {0x22, 0x0F};
49 static const uint8_t VCOM[] = {0x2C, 0x36};
50 static const uint8_t CMD5[] = {0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00};
51 static const uint8_t BORDER_PART[] = {0x3C, 0x80};
52 static const uint8_t BORDER_FULL[] = {0x3C, 0x05};
53 static const uint8_t CMD1[] = {0x3F, 0x22};
54 static const uint8_t RAM_X_START[] = {0x44, 0x00, 121 / 8};
55 static const uint8_t RAM_Y_START[] = {0x45, 0x00, 0x00, 250 - 1, 0};
56 static const uint8_t RAM_X_POS[] = {0x4E, 0x00};
58 #define SEND(x) this->cmd_data(x, sizeof(x)) 62 this->
cmd_data(lut,
sizeof(PARTIAL_LUT));
103 SEND(DISPLAY_UPDATE);
117 buffer[1] = (uint8_t) t;
118 buffer[2] = (uint8_t) (t >> 8);
143 ESP_LOGI(TAG,
"Performing full e-paper update.");
172 LOG_DISPLAY(
"",
"Waveshare E-Paper",
this)
173 ESP_LOGCONFIG(TAG,
" Model: 2.13inV3");
174 LOG_PIN(
" CS Pin: ", this->
cs_)
176 LOG_PIN(
" DC Pin: ", this->
dc_pin_)
178 LOG_UPDATE_INTERVAL(
this)
virtual void digital_write(bool value)=0
void set_window_(int t, int b)
void initialize() override
void write_lut_(const uint8_t *lut)
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
int get_width_internal() override
void dump_config() override
virtual bool digital_read()=0
uint32_t full_update_every_
int get_height_internal() override
void write_array(const uint8_t *data, size_t length)
Implementation of SPI Controller mode.
void command(uint8_t value)
void write_buffer_(uint8_t cmd, int top, int bottom)
void set_full_update_every(uint32_t full_update_every)
uint32_t idle_timeout_() override
void cmd_data(const uint8_t *data, size_t length)
void IRAM_ATTR HOT delay(uint32_t ms)