9namespace waveshare_epaper {
 
   11static const char *
const TAG = 
"waveshare_epaper";
 
   13static const uint8_t LUT_SIZE_WAVESHARE = 30;
 
   15static const uint8_t FULL_UPDATE_LUT[LUT_SIZE_WAVESHARE] = {0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22, 0x66, 0x69,
 
   16                                                            0x69, 0x59, 0x58, 0x99, 0x99, 0x88, 0x00, 0x00, 0x00, 0x00,
 
   17                                                            0xF8, 0xB4, 0x13, 0x51, 0x35, 0x51, 0x51, 0x19, 0x01, 0x00};
 
   19static const uint8_t PARTIAL_UPDATE_LUT[LUT_SIZE_WAVESHARE] = {
 
   20    0x10, 0x18, 0x18, 0x08, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   21    0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   23static const uint8_t LUT_SIZE_TTGO = 70;
 
   25static const uint8_t FULL_UPDATE_LUT_TTGO[LUT_SIZE_TTGO] = {
 
   26    0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,  
 
   27    0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,  
 
   28    0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,  
 
   29    0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00,  
 
   30    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   31    0x03, 0x03, 0x00, 0x00, 0x02,              
 
   32    0x09, 0x09, 0x00, 0x00, 0x02,              
 
   33    0x03, 0x03, 0x00, 0x00, 0x02,              
 
   34    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   35    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   36    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   37    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   40static const uint8_t PARTIAL_UPDATE_LUT_TTGO[LUT_SIZE_TTGO] = {
 
   41    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   42    0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   43    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   44    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   45    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
 
   46    0x0A, 0x00, 0x00, 0x00, 0x00,              
 
   47    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   48    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   49    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   50    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   51    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   52    0x00, 0x00, 0x00, 0x00, 0x00,              
 
   55static const uint8_t LUT_SIZE_TTGO_B73 = 100;
 
   57static const uint8_t FULL_UPDATE_LUT_TTGO_B73[LUT_SIZE_TTGO_B73] = {
 
   58    0xA0, 0x90, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x90, 0xA0, 0x00, 0x00, 0x00, 0x00,
 
   59    0x00, 0x00, 0x00, 0xA0, 0x90, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x90, 0xA0, 0x00,
 
   60    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   62    0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x03, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   63    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   64    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   67static const uint8_t PARTIAL_UPDATE_LUT_TTGO_B73[LUT_SIZE_TTGO_B73] = {
 
   68    0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   69    0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
 
   70    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   72    0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   73    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   74    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   77static const uint8_t LUT_SIZE_TTGO_B1 = 29;
 
   79static const uint8_t FULL_UPDATE_LUT_TTGO_B1[LUT_SIZE_TTGO_B1] = {
 
   80    0x22, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   81    0x00, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x01, 0x00, 0x00, 0x00, 0x00};
 
   83static const uint8_t PARTIAL_UPDATE_LUT_TTGO_B1[LUT_SIZE_TTGO_B1] = {
 
   84    0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   85    0x00, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   89static const uint8_t PARTIAL_UPD_2IN9_LUT_SIZE = 159;
 
   90static const uint8_t PARTIAL_UPD_2IN9_LUT[PARTIAL_UPD_2IN9_LUT_SIZE] =
 
   92    0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   93    0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   94    0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   95    0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   96    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   97    0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
 
   98    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
   99    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  100    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  101    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  102    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  103    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  104    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  105    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  106    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  107    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  108    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  109    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00,
 
  110    0x22, 0x17, 0x41, 0xB0, 0x32, 0x36,
 
  160  const uint32_t start = 
millis();
 
  163      ESP_LOGE(TAG, 
"Timeout while displaying image!");
 
 
  176  const uint8_t 
fill = color.
is_on() ? 0x00 : 0xFF;
 
 
  189  uint32_t small_buffer_length = buffer_length / 
NUM_BUFFERS;
 
  194      ESP_LOGE(TAG, 
"Could not allocate buffer %d for display!", i);
 
  195      for (
auto &buffer : this->
buffers_) {
 
  196        allocator.
deallocate(buffer, small_buffer_length);
 
 
  206  if (color.
red > 127) {
 
  207    if (color.
green > 170) {
 
  208      if (color.
blue > 127) {
 
  213    } 
else if (color.
green > 85) {
 
  219    if (color.
green > 127) {
 
  220      if (color.
blue > 127) {
 
  226      if (color.
blue > 127) {
 
 
  245    ESP_LOGE(TAG, 
"Buffer unavailable!");
 
  248    for (
auto &buffer : this->
buffers_) {
 
  249      for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
 
  253        buffer[buffer_pos + 0] = pixel_color << 5 | pixel_color << 2 | pixel_color >> 1;
 
  254        buffer[buffer_pos + 1] = pixel_color << 7 | pixel_color << 4 | pixel_color << 1 | pixel_color >> 2;
 
  255        buffer[buffer_pos + 2] = pixel_color << 6 | pixel_color << 3 | pixel_color << 0;
 
 
  263    ESP_LOGE(TAG, 
"Buffer unavailable!");
 
  268  uint8_t byte_to_send;
 
  269  for (
auto &buffer : this->
buffers_) {
 
  270    for (uint32_t buffer_pos = 0; buffer_pos < small_buffer_length; buffer_pos += 3) {
 
  271      std::bitset<24> triplet =
 
  272          buffer[buffer_pos + 0] << 16 | buffer[buffer_pos + 1] << 8 | buffer[buffer_pos + 2] << 0;
 
  276      byte_to_send = ((triplet >> 17).to_ulong() & 0b01110000) | ((triplet >> 18).to_ulong() & 0b00000111);
 
  277      this->
data(byte_to_send);
 
  279      byte_to_send = ((triplet >> 11).to_ulong() & 0b01110000) | ((triplet >> 12).to_ulong() & 0b00000111);
 
  280      this->
data(byte_to_send);
 
  282      byte_to_send = ((triplet >> 5).to_ulong() & 0b01110000) | ((triplet >> 6).to_ulong() & 0b00000111);
 
  283      this->
data(byte_to_send);
 
  285      byte_to_send = ((triplet << 1).to_ulong() & 0b01110000) | ((triplet << 0).to_ulong() & 0b00000111);
 
  286      this->
data(byte_to_send);
 
 
  307  const uint8_t subpos = 
x & 0x07;
 
  309  if (!color.
is_on()) {
 
  310    this->
buffer_[pos] |= 0x80 >> subpos;
 
  312    this->
buffer_[pos] &= ~(0x80 >> subpos);
 
 
  336  const uint8_t subpos = 
x & 0x07;
 
  339    this->
buffer_[pos] |= 0x80 >> subpos;
 
  341    this->
buffer_[pos] &= ~(0x80 >> subpos);
 
  345  if (((color.
red > 0) && (color.
green == 0) && (color.
blue == 0))) {
 
  346    this->
buffer_[pos + buf_half_len] |= 0x80 >> subpos;
 
  348    this->
buffer_[pos + buf_half_len] &= ~(0x80 >> subpos);
 
 
  358  uint32_t first_bit_position = pixel_position * 3;
 
  359  uint32_t byte_position = first_bit_position / 8u;
 
  360  uint32_t byte_subposition = first_bit_position % 8u;
 
  361  uint32_t buffer_position = byte_position / small_buffer_length;
 
  362  uint32_t buffer_subposition = byte_position % small_buffer_length;
 
  364  if (byte_subposition <= 5) {
 
  365    this->
buffers_[buffer_position][buffer_subposition] =
 
  366        (this->
buffers_[buffer_position][buffer_subposition] & (0xFF ^ (0b111 << (5 - byte_subposition)))) |
 
  367        (pixel_bits << (5 - byte_subposition));
 
  369    this->
buffers_[buffer_position][buffer_subposition + 0] =
 
  370        (this->
buffers_[buffer_position][buffer_subposition + 0] & (0xFF ^ (0b111 >> (byte_subposition - 5)))) |
 
  371        (pixel_bits >> (byte_subposition - 5));
 
  373    this->
buffers_[buffer_position][buffer_subposition + 1] = (this->
buffers_[buffer_position][buffer_subposition + 1] &
 
  374                                                               (0xFF ^ (0xFF & (0b111 << (13 - byte_subposition))))) |
 
  375                                                              (pixel_bits << (13 - byte_subposition));
 
 
  405        ESP_LOGI(TAG, 
"Set the display to deep sleep");
 
 
  470  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
  473      ESP_LOGCONFIG(TAG, 
"  Model: 1.54in");
 
  476      ESP_LOGCONFIG(TAG, 
"  Model: 1.54inV2");
 
  479      ESP_LOGCONFIG(TAG, 
"  Model: 2.13in");
 
  482      ESP_LOGCONFIG(TAG, 
"  Model: 2.13inV2");
 
  485      ESP_LOGCONFIG(TAG, 
"  Model: 2.13in (TTGO)");
 
  488      ESP_LOGCONFIG(TAG, 
"  Model: 2.13in (TTGO B73)");
 
  491      ESP_LOGCONFIG(TAG, 
"  Model: 2.13in (TTGO B74)");
 
  494      ESP_LOGCONFIG(TAG, 
"  Model: 2.13in (TTGO B1)");
 
  497      ESP_LOGCONFIG(TAG, 
"  Model: 2.9in");
 
  500      ESP_LOGCONFIG(TAG, 
"  Model: 2.9inV2");
 
  505  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
  507  LOG_UPDATE_INTERVAL(
this);
 
 
  511  bool prev_full_update = this->
at_update_ == 1;
 
  514    ESP_LOGI(TAG, 
"Wake up the display");
 
  526    if (full_update != prev_full_update) {
 
  531          this->
write_lut_(full_update ? FULL_UPDATE_LUT_TTGO : PARTIAL_UPDATE_LUT_TTGO, LUT_SIZE_TTGO);
 
  534          this->
write_lut_(full_update ? FULL_UPDATE_LUT_TTGO_B73 : PARTIAL_UPDATE_LUT_TTGO_B73, LUT_SIZE_TTGO_B73);
 
  540          this->
write_lut_(full_update ? FULL_UPDATE_LUT_TTGO_B1 : PARTIAL_UPDATE_LUT_TTGO_B1, LUT_SIZE_TTGO_B1);
 
  543          this->
write_lut_(full_update ? FULL_UPDATE_LUT : PARTIAL_UPDATE_LUT, LUT_SIZE_WAVESHARE);
 
  552    this->
data(full_update ? 0x55 : 0x26);
 
  574      this->
data(full_update ? 0x05 : 0x80);
 
  578      this->
data(full_update ? 0x03 : 0x01);
 
  640        for (
int j = 0; j < wb; j++) {
 
  666      this->
data(full_update ? 0xF7 : 0xFF);
 
  672      this->
data(full_update ? 0xC7 : 0x0C);
 
  687    ESP_LOGI(TAG, 
"Set the display back to deep sleep");
 
 
  744  for (uint8_t i = 0; i < size; i++)
 
 
  771static const uint8_t LUT_VCOM_DC_2_7[44] = {
 
  772    0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x32, 0x32, 0x00, 0x00, 0x02, 0x00,
 
  773    0x0F, 0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  774    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  777static const uint8_t LUT_WHITE_TO_WHITE_2_7[42] = {
 
  778    0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0xA0, 0x0F,
 
  779    0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  780    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  783static const uint8_t LUT_BLACK_TO_WHITE_2_7[42] = {
 
  784    0x50, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0xA0, 0x0F,
 
  785    0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  786    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  789static const uint8_t LUT_WHITE_TO_BLACK_2_7[] = {
 
  790    0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0x50, 0x0F,
 
  791    0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  792    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  795static const uint8_t LUT_BLACK_TO_BLACK_2_7[42] = {
 
  796    0xA0, 0x0F, 0x0F, 0x00, 0x00, 0x05, 0x60, 0x32, 0x32, 0x00, 0x00, 0x02, 0x50, 0x0F,
 
  797    0x0F, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  798    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
  861  for (uint8_t i : LUT_VCOM_DC_2_7)
 
  866  for (uint8_t i : LUT_WHITE_TO_WHITE_2_7)
 
  870  for (uint8_t i : LUT_BLACK_TO_WHITE_2_7)
 
  874  for (uint8_t i : LUT_WHITE_TO_BLACK_2_7)
 
  878  for (uint8_t i : LUT_BLACK_TO_BLACK_2_7)
 
 
  887  for (uint32_t i = 0; i < buf_len; i++) {
 
  895  for (uint32_t i = 0; i < buf_len; i++) {
 
 
  905  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
  906  ESP_LOGCONFIG(TAG, 
"  Model: 2.7in");
 
  908  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
  910  LOG_UPDATE_INTERVAL(
this);
 
 
  958  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
  959  ESP_LOGCONFIG(TAG, 
"  Model: 2.7in V2");
 
  961  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
  963  LOG_UPDATE_INTERVAL(
this);
 
 
 1021  for (uint32_t i = 0; i < buf_len_half; i++) {
 
 1029  for (uint32_t i = buf_len_half; i < buf_len_half * 2u; i++) {
 
 
 1042  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1043  ESP_LOGCONFIG(TAG, 
"  Model: 1.54in V2 B");
 
 1045  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1046  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1047  LOG_UPDATE_INTERVAL(
this);
 
 
 1057static const uint8_t LUT_VCOM_DC_2_7B[44] = {0x00, 0x00, 0x00, 0x1A, 0x1A, 0x00, 0x00, 0x01, 0x00, 0x0A, 0x0A,
 
 1058                                             0x00, 0x00, 0x08, 0x00, 0x0E, 0x01, 0x0E, 0x01, 0x10, 0x00, 0x0A,
 
 1059                                             0x0A, 0x00, 0x00, 0x08, 0x00, 0x04, 0x10, 0x00, 0x00, 0x05, 0x00,
 
 1060                                             0x03, 0x0E, 0x00, 0x00, 0x0A, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01};
 
 1062static const uint8_t LUT_WHITE_TO_WHITE_2_7B[42] = {0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01, 0x40, 0x0A, 0x0A, 0x00, 0x00,
 
 1063                                                    0x08, 0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10, 0x80, 0x0A, 0x0A, 0x00,
 
 1064                                                    0x00, 0x08, 0x00, 0x04, 0x10, 0x00, 0x00, 0x05, 0x00, 0x03, 0x0E,
 
 1065                                                    0x00, 0x00, 0x0A, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01};
 
 1067static const uint8_t LUT_BLACK_TO_WHITE_2_7B[42] = {0xA0, 0x1A, 0x1A, 0x00, 0x00, 0x01, 0x00, 0x0A, 0x0A, 0x00, 0x00,
 
 1068                                                    0x08, 0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10, 0x90, 0x0A, 0x0A, 0x00,
 
 1069                                                    0x00, 0x08, 0xB0, 0x04, 0x10, 0x00, 0x00, 0x05, 0xB0, 0x03, 0x0E,
 
 1070                                                    0x00, 0x00, 0x0A, 0xC0, 0x23, 0x00, 0x00, 0x00, 0x01};
 
 1072static const uint8_t LUT_WHITE_TO_BLACK_2_7B[] = {0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01, 0x20, 0x0A, 0x0A, 0x00, 0x00,
 
 1073                                                  0x08, 0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10, 0x10, 0x0A, 0x0A, 0x00,
 
 1074                                                  0x00, 0x08, 0x00, 0x04, 0x10, 0x00, 0x00, 0x05, 0x00, 0x03, 0x0E,
 
 1075                                                  0x00, 0x00, 0x0A, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01};
 
 1077static const uint8_t LUT_BLACK_TO_BLACK_2_7B[42] = {0x90, 0x1A, 0x1A, 0x00, 0x00, 0x01, 0x40, 0x0A, 0x0A, 0x00, 0x00,
 
 1078                                                    0x08, 0x84, 0x0E, 0x01, 0x0E, 0x01, 0x10, 0x80, 0x0A, 0x0A, 0x00,
 
 1079                                                    0x00, 0x08, 0x00, 0x04, 0x10, 0x00, 0x00, 0x05, 0x00, 0x03, 0x0E,
 
 1080                                                    0x00, 0x00, 0x0A, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01};
 
 1139  for (uint8_t i : LUT_VCOM_DC_2_7B)
 
 1143  for (uint8_t i : LUT_WHITE_TO_WHITE_2_7B)
 
 1147  for (uint8_t i : LUT_BLACK_TO_WHITE_2_7B)
 
 1151  for (uint8_t i : LUT_WHITE_TO_BLACK_2_7B) {
 
 1157  for (uint8_t i : LUT_BLACK_TO_BLACK_2_7B) {
 
 
 1178  for (uint32_t i = 0; i < buf_len_half; i++) {
 
 1187  for (uint32_t i = buf_len_half; i < buf_len_half * 2u; i++) {
 
 
 1203  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1204  ESP_LOGCONFIG(TAG, 
"  Model: 2.7in B");
 
 1206  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1207  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1208  LOG_UPDATE_INTERVAL(
this);
 
 
 1240  this->
data((xend >> 3) & 0xff);
 
 1245  this->
data(yend & 0xff);
 
 1246  this->
data((yend >> 8) & 0xff);
 
 
 1261  for (uint32_t i = 0; i < buf_len; i++) {
 
 1269  for (uint32_t i = 0; i < buf_len; i++) {
 
 
 1282  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1283  ESP_LOGCONFIG(TAG, 
"  Model: 2.7in B V2");
 
 1285  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1286  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1287  LOG_UPDATE_INTERVAL(
this);
 
 
 1361  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1362  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in (B)");
 
 1364  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1365  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1366  LOG_UPDATE_INTERVAL(
this);
 
 
 1448  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1449  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in (D)");
 
 1451  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1452  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1453  LOG_UPDATE_INTERVAL(
this);
 
 
 1459static const uint8_t LUT_SIZE_DKE = 70;
 
 1460static const uint8_t UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
 
 1461    0xA0, 0x90, 0x50, 0x0,  0x0,  0x0,  0x0, 0x50, 0x90, 0xA0, 0x0,  0x0,  0x0,  0x0, 0xA0, 0x90, 0x50, 0x0,
 
 1462    0x0,  0x0,  0x0,  0x50, 0x90, 0xA0, 0x0, 0x0,  0x0,  0x0,  0x00, 0x00, 0x00, 0x0, 0x0,  0x0,  0x0,  0xF,
 
 1463    0xF,  0x0,  0x0,  0x0,  0xF,  0xF,  0x0, 0x0,  0x02, 0xF,  0xF,  0x0,  0x0,  0x0, 0x0,  0x0,  0x0,  0x0,
 
 1464    0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0,  0x0,
 
 1466static const uint8_t PART_UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
 
 1467    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x00, 0x00,
 
 1468    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
 
 1469    0x05, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1470    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 1471static const uint8_t FULL_UPDATE_LUT_DKE[LUT_SIZE_DKE] = {
 
 1472    0x90, 0x50, 0xa0, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa0, 0xa0, 0x80, 0x00, 0x90, 0x50, 0xa0, 0x50,
 
 1473    0x50, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa0, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
 
 1474    0x04, 0x00, 0x00, 0x00, 0x0b, 0x04, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00,
 
 1475    0x00, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 1539  for (uint8_t v : FULL_UPDATE_LUT_DKE)
 
 
 1544  ESP_LOGI(TAG, 
"Performing e-paper update.");
 
 
 1570  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1571  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in DKE");
 
 1573  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1574  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1575  LOG_UPDATE_INTERVAL(
this);
 
 
 1642  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1643  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in (B) V3");
 
 1645  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1646  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1647  LOG_UPDATE_INTERVAL(
this);
 
 
 1698void WaveshareEPaper2P9InV2R2::reset_() {
 
 1710    ESP_LOGE(TAG, 
"fail idle 1");
 
 1749    this->
write_lut_(PARTIAL_UPD_2IN9_LUT, PARTIAL_UPD_2IN9_LUT_SIZE);
 
 1771      ESP_LOGE(TAG, 
"fail idle 2");
 
 
 1810  for (uint8_t i = 0; i < size; i++)
 
 
 1815  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 1816  ESP_LOGCONFIG(TAG, 
"  Model: 2.9inV2R2");
 
 1819  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1820  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1821  LOG_UPDATE_INTERVAL(
this);
 
 
 1901  LOG_DISPLAY(
"", 
"E-Paper (Good Display)", 
this);
 
 1902  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in GDEY029T94");
 
 1904  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 1905  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 1906  LOG_UPDATE_INTERVAL(
this);
 
 
 1919static const uint8_t LUT_20_VCOMDC_29_5[] = {
 
 1920    0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x60, 0x28, 0x28, 0x00, 0x00, 0x01, 0x00, 0x14, 0x00,
 
 1921    0x00, 0x00, 0x01, 0x00, 0x12, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1922    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1925static const uint8_t LUT_21_WW_29_5[] = {
 
 1926    0x40, 0x08, 0x00, 0x00, 0x00, 0x02, 0x90, 0x28, 0x28, 0x00, 0x00, 0x01, 0x40, 0x14,
 
 1927    0x00, 0x00, 0x00, 0x01, 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
 
 1928    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1931static const uint8_t LUT_22_BW_29_5[] = {
 
 1932    0x40, 0x08, 0x00, 0x00, 0x00, 0x02, 0x90, 0x28, 0x28, 0x00, 0x00, 0x01, 0x40, 0x14,
 
 1933    0x00, 0x00, 0x00, 0x01, 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
 
 1934    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1937static const uint8_t LUT_23_WB_29_5[] = {
 
 1938    0x80, 0x08, 0x00, 0x00, 0x00, 0x02, 0x90, 0x28, 0x28, 0x00, 0x00, 0x01, 0x80, 0x14,
 
 1939    0x00, 0x00, 0x00, 0x01, 0x50, 0x12, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
 
 1940    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1943static const uint8_t LUT_24_BB_29_5[] = {
 
 1944    0x80, 0x08, 0x00, 0x00, 0x00, 0x02, 0x90, 0x28, 0x28, 0x00, 0x00, 0x01, 0x80, 0x14,
 
 1945    0x00, 0x00, 0x00, 0x01, 0x50, 0x12, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
 
 1946    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1950static const uint8_t LUT_20_VCOMDC_PARTIAL_29_5[] = {
 
 1951    0x00, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1952    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1953    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1956static const uint8_t LUT_21_WW_PARTIAL_29_5[] = {
 
 1957    0x00, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1958    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1959    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1962static const uint8_t LUT_22_BW_PARTIAL_29_5[] = {
 
 1963    0x80, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1964    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1965    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1968static const uint8_t LUT_23_WB_PARTIAL_29_5[] = {
 
 1969    0x40, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1970    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1971    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1974static const uint8_t LUT_24_BB_PARTIAL_29_5[] = {
 
 1975    0x00, 0x20, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1976    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1977    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 1981  if (!this->power_is_on_) {
 
 1985  this->power_is_on_ = 
true;
 
 
 1991  this->power_is_on_ = 
false;
 
 
 1996  if (this->deep_sleep_between_updates_) {
 
 1999    ESP_LOGD(TAG, 
"go to deep sleep");
 
 2000    this->is_deep_sleep_ = 
true;
 
 
 2008  if (this->deep_sleep_between_updates_ && this->is_deep_sleep_) {
 
 2009    ESP_LOGI(TAG, 
"wake up from deep sleep");
 
 2011    this->is_deep_sleep_ = 
false;
 
 2039  this->
data(0b10111111);
 
 2048  ESP_LOGD(TAG, 
"panel setting done");
 
 
 2054    this->deep_sleep_between_updates_ = 
true;
 
 2059  if (this->old_buffer_ == 
nullptr) {
 
 2060    ESP_LOGE(TAG, 
"Could not allocate old buffer for display!");
 
 2064    this->old_buffer_[i] = 0xFF;
 
 
 2076  this->
write_lut_(LUT_20_VCOMDC_29_5, 
sizeof(LUT_20_VCOMDC_29_5));
 
 2078  this->
write_lut_(LUT_21_WW_29_5, 
sizeof(LUT_21_WW_29_5));
 
 2080  this->
write_lut_(LUT_22_BW_29_5, 
sizeof(LUT_22_BW_29_5));
 
 2082  this->
write_lut_(LUT_23_WB_29_5, 
sizeof(LUT_23_WB_29_5));
 
 2084  this->
write_lut_(LUT_24_BB_29_5, 
sizeof(LUT_24_BB_29_5));
 
 2085  ESP_LOGD(TAG, 
"initialized full update");
 
 
 2096  this->
write_lut_(LUT_20_VCOMDC_PARTIAL_29_5, 
sizeof(LUT_20_VCOMDC_PARTIAL_29_5));
 
 2098  this->
write_lut_(LUT_21_WW_PARTIAL_29_5, 
sizeof(LUT_21_WW_PARTIAL_29_5));
 
 2100  this->
write_lut_(LUT_22_BW_PARTIAL_29_5, 
sizeof(LUT_22_BW_PARTIAL_29_5));
 
 2102  this->
write_lut_(LUT_23_WB_PARTIAL_29_5, 
sizeof(LUT_23_WB_PARTIAL_29_5));
 
 2104  this->
write_lut_(LUT_24_BB_PARTIAL_29_5, 
sizeof(LUT_24_BB_PARTIAL_29_5));
 
 2105  ESP_LOGD(TAG, 
"initialized partial update");
 
 
 2109  bool full_update = this->at_update_ == 0;
 
 2143    this->old_buffer_[i] = this->
buffer_[i];
 
 2154    ESP_LOGD(TAG, 
"full update done");
 
 2157    ESP_LOGD(TAG, 
"partial update done");
 
 2160  this->at_update_ = (this->at_update_ + 1) % this->full_update_every_;
 
 
 2168  for (uint8_t i = 0; i < size; i++)
 
 
 2178  LOG_DISPLAY(
"", 
"Waveshare E-Paper (Good Display)", 
this);
 
 2179  ESP_LOGCONFIG(TAG, 
"  Model: 2.9in Greyscale GDEW029T5");
 
 2181  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2182  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2183  ESP_LOGCONFIG(TAG, 
"  Full Update Every: %" PRIu32, this->full_update_every_);
 
 2184  LOG_UPDATE_INTERVAL(
this);
 
 
 2201  this->init_internal_();
 
 2204  if (this->lastbuff_ != 
nullptr) {
 
 
 2210void GDEW0154M09::reset_() {
 
 2220void GDEW0154M09::init_internal_() {
 
 2231  const uint8_t panel_setting_1 = 0b11011111;
 
 2238  const uint8_t panel_setting_2 = 0b01110;
 
 2240  const uint8_t wf_t0154_cz_b3_list[] = {
 
 2242      CMD_PSR_PANEL_SETTING, 2, panel_setting_1, panel_setting_2,
 
 2243      CMD_UNDOCUMENTED_0x4D, 1, 0x55,
 
 2244      CMD_UNDOCUMENTED_0xAA, 1, 0x0f,
 
 2245      CMD_UNDOCUMENTED_0xE9, 1, 0x02,
 
 2246      CMD_UNDOCUMENTED_0xB6, 1, 0x11,
 
 2247      CMD_UNDOCUMENTED_0xF3, 1, 0x0a,
 
 2248      CMD_TRES_RESOLUTION_SETTING, 3, 0xc8, 0x00, 0xc8,
 
 2249      CMD_TCON_TCONSETTING, 1, 0x00,
 
 2250      CMD_CDI_VCOM_DATA_INTERVAL, 1, 0xd7,
 
 2251      CMD_PWS_POWER_SAVING, 1, 0x00,
 
 2256  this->write_init_list_(wf_t0154_cz_b3_list);
 
 2261void GDEW0154M09::write_init_list_(
const uint8_t *list) {
 
 2262  uint8_t list_limit = list[0];
 
 2263  uint8_t *start_ptr = ((uint8_t *) list + 1);
 
 2264  for (uint8_t i = 0; i < list_limit; i++) {
 
 2265    this->
command(*(start_ptr + 0));
 
 2266    for (uint8_t dnum = 0; dnum < *(start_ptr + 1); dnum++) {
 
 2267      this->
data(*(start_ptr + 2 + dnum));
 
 2269    start_ptr += (*(start_ptr + 1) + 2);
 
 2273void GDEW0154M09::clear_() {
 
 2275  for (uint8_t j = 0; j < 2; j++) {
 
 2276    this->
command(CMD_DTM1_DATA_START_TRANS);
 
 2277    for (uint32_t count = 0; count < pixsize; count++) {
 
 2280    this->
command(CMD_DTM2_DATA_START_TRANS2);
 
 2281    for (uint32_t count = 0; count < pixsize; count++) {
 
 2284    this->
command(CMD_DISPLAY_REFRESH);
 
 2291  this->init_internal_();
 
 2293  this->
command(CMD_DTM1_DATA_START_TRANS);
 
 2297  this->
command(CMD_DTM2_DATA_START_TRANS2);  
 
 2301  this->
command(CMD_DISPLAY_REFRESH);
 
 
 2309  this->
command(CMD_POF_POWER_OFF);
 
 2312  this->
command(CMD_DSLP_DEEP_SLEEP);
 
 2313  this->
data(DATA_DSLP_DEEP_SLEEP);
 
 
 2319  LOG_DISPLAY(
"", 
"M5Stack CoreInk E-Paper (Good Display)", 
this);
 
 2320  ESP_LOGCONFIG(TAG, 
"  Model: 1.54in Greyscale GDEW0154M09");
 
 2322  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2323  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2324  LOG_UPDATE_INTERVAL(
this);
 
 
 2341  this->init_display_();
 
 2342  ESP_LOGD(TAG, 
"Initialization complete, set the display to deep sleep");
 
 
 2355void GDEY042T81::reset_() {
 
 2364void GDEY042T81::init_display_() {
 
 2410void GDEY042T81::update_full_() {
 
 2431void GDEY042T81::update_part_() {
 
 2444  ESP_LOGD(TAG, 
"Wake up the display");
 
 2445  this->init_display_();
 
 2449    ESP_LOGE(TAG, 
"Failed to perform update, display is busy");
 
 2455    ESP_LOGD(TAG, 
"Full update");
 
 2463    this->update_full_();
 
 2469    ESP_LOGD(TAG, 
"Update");
 
 2482    this->update_full_();
 
 2491    ESP_LOGD(TAG, 
"Partial update");
 
 2495      ESP_LOGE(TAG, 
"Failed to perform partial update, display is busy");
 
 2505    this->update_part_();
 
 2510  ESP_LOGD(TAG, 
"Set the display back to deep sleep");
 
 
 2518  LOG_DISPLAY(
"", 
"GoodDisplay E-Paper", 
this);
 
 2519  ESP_LOGCONFIG(TAG, 
"  Model: 4.2in B/W GDEY042T81");
 
 2522  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2523  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2524  LOG_UPDATE_INTERVAL(
this);
 
 
 2527static const uint8_t LUT_VCOM_DC_4_2[] = {
 
 2528    0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x17, 0x17, 0x00, 0x00, 0x02, 0x00, 0x0A, 0x01,
 
 2529    0x00, 0x00, 0x01, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2530    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2532static const uint8_t LUT_WHITE_TO_WHITE_4_2[] = {
 
 2533    0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x40, 0x0A,
 
 2534    0x01, 0x00, 0x00, 0x01, 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
 
 2535    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2537static const uint8_t LUT_BLACK_TO_WHITE_4_2[] = {
 
 2538    0x40, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x40, 0x0A,
 
 2539    0x01, 0x00, 0x00, 0x01, 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
 
 2540    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2543static const uint8_t LUT_BLACK_TO_BLACK_4_2[] = {
 
 2544    0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x80, 0x0A,
 
 2545    0x01, 0x00, 0x00, 0x01, 0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
 
 2546    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2549static const uint8_t LUT_WHITE_TO_BLACK_4_2[] = {
 
 2550    0x80, 0x17, 0x00, 0x00, 0x00, 0x02, 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, 0x80, 0x0A,
 
 2551    0x01, 0x00, 0x00, 0x01, 0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
 
 2552    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 2587  for (uint8_t i : LUT_VCOM_DC_4_2)
 
 2591  for (uint8_t i : LUT_WHITE_TO_WHITE_4_2)
 
 2595  for (uint8_t i : LUT_BLACK_TO_WHITE_4_2)
 
 2599  for (uint8_t i : LUT_WHITE_TO_BLACK_4_2)
 
 2603  for (uint8_t i : LUT_BLACK_TO_BLACK_4_2)
 
 
 2641  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 2642  ESP_LOGCONFIG(TAG, 
"  Model: 4.2in");
 
 2644  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2645  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2646  LOG_UPDATE_INTERVAL(
this);
 
 
 2697  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 2698  ESP_LOGCONFIG(TAG, 
"  Model: 4.2in (B V2)");
 
 2700  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2701  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2702  LOG_UPDATE_INTERVAL(
this);
 
 
 2733  for (uint32_t i = 0; i < buf_len; ++i) {
 
 2739  for (uint32_t i = 0; i < buf_len; ++i) {
 
 
 2755  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 2756  ESP_LOGCONFIG(TAG, 
"  Model: 4.2in (B V2) BWR-Mode");
 
 2758  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2759  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2760  LOG_UPDATE_INTERVAL(
this);
 
 
 2821    uint8_t temp1 = this->
buffer_[i];
 
 2822    for (uint8_t j = 0; j < 8; j++) {
 
 
 2852  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 2853  ESP_LOGCONFIG(TAG, 
"  Model: 5.83in");
 
 2855  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2856  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2857  LOG_UPDATE_INTERVAL(
this);
 
 
 2933  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 2934  ESP_LOGCONFIG(TAG, 
"  Model: 5.83inv2");
 
 2936  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 2937  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 2938  LOG_UPDATE_INTERVAL(
this);
 
 
 2958  if (this->old_buffer_ == 
nullptr) {
 
 2959    ESP_LOGE(TAG, 
"Could not allocate old buffer for display!");
 
 
 2971void GDEY0583T81::power_on_() {
 
 2972  if (!this->power_is_on_) {
 
 2976  this->power_is_on_ = 
true;
 
 2977  this->is_deep_sleep_ = 
false;
 
 2980void GDEY0583T81::power_off_() {
 
 2983  this->power_is_on_ = 
false;
 
 2987  if (this->is_deep_sleep_) {
 
 3001  this->is_deep_sleep_ = 
true;
 
 
 3004void GDEY0583T81::reset_() {
 
 3014void GDEY0583T81::init_full_() {
 
 3015  this->init_display_();
 
 3033void GDEY0583T81::init_partial_() {
 
 3034  this->init_display_();
 
 3045void GDEY0583T81::init_display_() {
 
 3074  bool full_update = this->at_update_ == 0;
 
 3078    this->init_partial_();
 
 3122    this->old_buffer_[i] = this->
buffer_[i];
 
 3131    ESP_LOGD(TAG, 
"Full update done");
 
 3135    ESP_LOGD(TAG, 
"Partial update done, next full update after %" PRIu32 
" cycles",
 
 3136             this->full_update_every_ - this->at_update_ - 1);
 
 3139  this->at_update_ = (this->at_update_ + 1) % this->full_update_every_;
 
 
 3149  LOG_DISPLAY(
"", 
"GoodDisplay E-Paper", 
this);
 
 3150  ESP_LOGCONFIG(TAG, 
"  Model: 5.83in B/W GDEY0583T81");
 
 3151  ESP_LOGCONFIG(TAG, 
"  Full Update Every: %" PRIu32, this->full_update_every_);
 
 3153  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3154  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3155  LOG_UPDATE_INTERVAL(
this);
 
 
 3226  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3227  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in-bv2");
 
 3229  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3230  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3231  LOG_UPDATE_INTERVAL(
this);
 
 
 3240  const uint32_t start = 
millis();
 
 3244      ESP_LOGI(TAG, 
"Timeout while displaying image!");
 
 
 3309  uint8_t lut_vcom_7_i_n5_v2[] = {
 
 3310      0x0, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0xF, 0x1, 0xF, 0x1, 0x2, 0x0, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 3311      0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 3314  uint8_t lut_ww_7_i_n5_v2[] = {
 
 3315      0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 3316      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 3319  uint8_t lut_bw_7_i_n5_v2[] = {
 
 3320      0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 3321      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 3324  uint8_t lut_wb_7_i_n5_v2[] = {
 
 3325      0x80, 0xF, 0xF, 0x0, 0x0, 0x3, 0x84, 0xF, 0x1, 0xF, 0x1, 0x4, 0x40, 0xF, 0xF, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0,
 
 3326      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 3329  uint8_t lut_bb_7_i_n5_v2[] = {
 
 3330      0x80, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x40, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 3331      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 3336  for (count = 0; count < 42; count++)
 
 3337    this->
data(lut_vcom_7_i_n5_v2[count]);
 
 3340  for (count = 0; count < 42; count++)
 
 3341    this->
data(lut_ww_7_i_n5_v2[count]);
 
 3344  for (count = 0; count < 42; count++)
 
 3345    this->
data(lut_bw_7_i_n5_v2[count]);
 
 3348  for (count = 0; count < 42; count++)
 
 3349    this->
data(lut_wb_7_i_n5_v2[count]);
 
 3352  for (count = 0; count < 42; count++)
 
 3353    this->
data(lut_bb_7_i_n5_v2[count]);
 
 
 3360  for (uint32_t i = 0; i < buf_len; i++) {
 
 3366  for (uint32_t i = 0; i < buf_len; i++) {
 
 
 3378  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3379  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in-bv3");
 
 3381  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3382  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3383  LOG_UPDATE_INTERVAL(
this);
 
 
 3392  const uint32_t start = 
millis();
 
 3396      ESP_LOGI(TAG, 
"Timeout while displaying image!");
 
 
 3460  for (uint32_t i = 0; i < buf_len; i++) {
 
 3466  for (uint32_t i = 0; i < buf_len; i++) {
 
 
 3478  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3479  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in-bv3 BWR-Mode");
 
 3481  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3482  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3483  LOG_UPDATE_INTERVAL(
this);
 
 
 3533    uint8_t temp1 = this->
buffer_[i];
 
 3534    for (uint8_t j = 0; j < 8; j++) {
 
 
 3561  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3562  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in");
 
 3564  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3565  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3566  LOG_UPDATE_INTERVAL(
this);
 
 
 3571namespace cmddata_5P65InF {
 
 3580static const uint8_t R00_CMD_PSR[] = {0x00, 0xEF, 0x08};
 
 3584static const uint8_t R01_CMD_PWR[] = {0x01, 0x07, 0x00, 0x00, 0x00};
 
 3587static const uint8_t R02_CMD_POF[] = {0x02};
 
 3591static const uint8_t R03_CMD_PFS[] = {0x03, 0x00};
 
 3594static const uint8_t R04_CMD_PON[] = {0x04};
 
 3597static const uint8_t R06_CMD_BTST[] = {0x06, 0xC7, 0xC7, 0x1D};
 
 3602static const uint8_t R07_CMD_DSLP[] = {0x07, 0xA5};
 
 3606static const uint8_t R10_CMD_DTM1[] = {0x10};
 
 3609static const uint8_t R11_CMD_DSP[] = {0x11};
 
 3612static const uint8_t R12_CMD_DRF[] = {0x12};
 
 3615static const uint8_t R13_CMD_IPC[] = {0x13, 0x00};
 
 3619static const uint8_t R30_CMD_PLL[] = {0x30, 0x3C};
 
 3623static const uint8_t R41_CMD_TSE[] = {0x41, 0x00};
 
 3628static const uint8_t R50_CMD_CDI[] = {0x50, 0x37};
 
 3633static const uint8_t R60_CMD_TCON[] = {0x60, 0x22};
 
 3638static const uint8_t R61_CMD_TRES[] = {0x61, 0x02, 0x58, 0x01, 0xC0};
 
 3641static const uint8_t RE3_CMD_PWS[] = {0xE3, 0xAA};
 
 
 3645  if (this->
buffers_[0] == 
nullptr) {
 
 3646    ESP_LOGE(TAG, 
"Buffer unavailable!");
 
 3654  using namespace cmddata_5P65InF;
 
 3656  this->
cmd_data(R00_CMD_PSR, 
sizeof(R00_CMD_PSR));
 
 3657  this->
cmd_data(R01_CMD_PWR, 
sizeof(R01_CMD_PWR));
 
 3658  this->
cmd_data(R03_CMD_PFS, 
sizeof(R03_CMD_PFS));
 
 3659  this->
cmd_data(R06_CMD_BTST, 
sizeof(R06_CMD_BTST));
 
 3660  this->
cmd_data(R30_CMD_PLL, 
sizeof(R30_CMD_PLL));
 
 3661  this->
cmd_data(R41_CMD_TSE, 
sizeof(R41_CMD_TSE));
 
 3662  this->
cmd_data(R50_CMD_CDI, 
sizeof(R50_CMD_CDI));
 
 3663  this->
cmd_data(R60_CMD_TCON, 
sizeof(R60_CMD_TCON));
 
 3664  this->
cmd_data(R61_CMD_TRES, 
sizeof(R61_CMD_TRES));
 
 3665  this->
cmd_data(RE3_CMD_PWS, 
sizeof(RE3_CMD_PWS));
 
 3668  this->
cmd_data(R50_CMD_CDI, 
sizeof(R50_CMD_CDI));
 
 3670  ESP_LOGI(TAG, 
"Display initialized successfully");
 
 
 3675  ESP_LOGI(TAG, 
"Initialise the display");
 
 3678  using namespace cmddata_5P65InF;
 
 3681  ESP_LOGI(TAG, 
"Sending data to the display");
 
 3682  this->
cmd_data(R61_CMD_TRES, 
sizeof(R61_CMD_TRES));
 
 3683  this->
cmd_data(R10_CMD_DTM1, 
sizeof(R10_CMD_DTM1));
 
 3687  ESP_LOGI(TAG, 
"Power on the display");
 
 3688  this->
cmd_data(R04_CMD_PON, 
sizeof(R04_CMD_PON));
 
 3692  ESP_LOGI(TAG, 
"Refresh the display");
 
 3693  this->
cmd_data(R12_CMD_DRF, 
sizeof(R12_CMD_DRF));
 
 3697  ESP_LOGI(TAG, 
"Power off the display");
 
 3698  this->
cmd_data(R02_CMD_POF, 
sizeof(R02_CMD_POF));
 
 3702    ESP_LOGI(TAG, 
"Set the display to deep sleep");
 
 3703    this->
cmd_data(R07_CMD_DSLP, 
sizeof(R07_CMD_DSLP));
 
 
 3712  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3713  ESP_LOGCONFIG(TAG, 
"  Model: 5.65in-F");
 
 3715  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3716  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3717  LOG_UPDATE_INTERVAL(
this);
 
 
 3725  const uint32_t start = 
millis();
 
 3728      ESP_LOGE(TAG, 
"Timeout while displaying image!");
 
 
 3738  if (this->
buffers_[0] == 
nullptr) {
 
 3739    ESP_LOGE(TAG, 
"Buffer unavailable!");
 
 3838  ESP_LOGI(TAG, 
"Display initialized successfully");
 
 
 3842  ESP_LOGI(TAG, 
"Initialise the display");
 
 3846  ESP_LOGI(TAG, 
"Sending data to the display");
 
 3851  ESP_LOGI(TAG, 
"Power on the display");
 
 3856  ESP_LOGI(TAG, 
"Refresh the display");
 
 3862  ESP_LOGI(TAG, 
"Power off the display");
 
 3868    ESP_LOGI(TAG, 
"Set the display to deep sleep");
 
 
 3877  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 3878  ESP_LOGCONFIG(TAG, 
"  Model: 7.3in-F");
 
 3880  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 3881  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 3882  LOG_UPDATE_INTERVAL(
this);
 
 
 3889  const uint32_t start = 
millis();
 
 3892      ESP_LOGE(TAG, 
"Timeout while displaying image!");
 
 
 3906  const uint32_t start = 
millis();
 
 3910      ESP_LOGE(TAG, 
"Timeout while displaying image!");
 
 
 3965  ESP_LOGI(TAG, 
"Power on the display and hat");
 
 3977  for (uint32_t i = 0; i < buf_len; i++) {
 
 3989  ESP_LOGV(TAG, 
"Before command(0x02) (>> power off)");
 
 3992  ESP_LOGV(TAG, 
"After command(0x02) (>> power off)");
 
 
 3999  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4000  ESP_LOGCONFIG(TAG, 
"  Model: 7.5inV2rev2");
 
 4002  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4003  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4004  LOG_UPDATE_INTERVAL(
this);
 
 
 4013  const uint32_t start = 
millis();
 
 4017      ESP_LOGI(TAG, 
"Timeout while displaying image!");
 
 
 4083  uint8_t lut_vcom_7_i_n5_v2[] = {
 
 4084      0x0, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0xF, 0x1, 0xF, 0x1, 0x2, 0x0, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 4085      0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 4088  uint8_t lut_ww_7_i_n5_v2[] = {
 
 4089      0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 4090      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 4093  uint8_t lut_bw_7_i_n5_v2[] = {
 
 4094      0x10, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x20, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 4095      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 4098  uint8_t lut_wb_7_i_n5_v2[] = {
 
 4099      0x80, 0xF, 0xF, 0x0, 0x0, 0x3, 0x84, 0xF, 0x1, 0xF, 0x1, 0x4, 0x40, 0xF, 0xF, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0,
 
 4100      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 4103  uint8_t lut_bb_7_i_n5_v2[] = {
 
 4104      0x80, 0xF, 0xF, 0x0, 0x0, 0x1, 0x84, 0xF, 0x1, 0xF, 0x1, 0x2, 0x40, 0xF, 0xF, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
 
 4105      0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 
 4110  for (count = 0; count < 42; count++)
 
 4111    this->
data(lut_vcom_7_i_n5_v2[count]);
 
 4114  for (count = 0; count < 42; count++)
 
 4115    this->
data(lut_ww_7_i_n5_v2[count]);
 
 4118  for (count = 0; count < 42; count++)
 
 4119    this->
data(lut_bw_7_i_n5_v2[count]);
 
 4122  for (count = 0; count < 42; count++)
 
 4123    this->
data(lut_wb_7_i_n5_v2[count]);
 
 4126  for (count = 0; count < 42; count++)
 
 4127    this->
data(lut_bb_7_i_n5_v2[count]);
 
 
 4131  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4132  ESP_LOGCONFIG(TAG, 
"  Model: 7.5inV2");
 
 4134  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4135  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4136  LOG_UPDATE_INTERVAL(
this);
 
 
 4145  const uint32_t start = 
millis();
 
 4149      ESP_LOGE(TAG, 
"Timeout while displaying image!");
 
 
 4158void WaveshareEPaper7P5InV2P::reset_() {
 
 4169void WaveshareEPaper7P5InV2P::turn_on_display_() {
 
 4235  ESP_LOGI(TAG, 
"Power on the display and hat");
 
 4243    for (uint32_t i = 0; i < buf_len; i++) {
 
 4247    this->turn_on_display_();
 
 4267    for (uint32_t i = 0; i < buf_len; i++) {
 
 4276    for (uint32_t i = 0; i < buf_len; i++) {
 
 4283    this->turn_on_display_();
 
 4308    for (uint32_t i = 0; i < buf_len; i++) {
 
 4315    this->turn_on_display_();
 
 4318  ESP_LOGV(TAG, 
"Before command(0x02) (>> power off)");
 
 4321  ESP_LOGV(TAG, 
"After command(0x02) (>> power off)");
 
 
 4330  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4331  ESP_LOGCONFIG(TAG, 
"  Model: 7.50inv2p");
 
 4334  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4335  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4336  LOG_UPDATE_INTERVAL(
this);
 
 
 4401    uint8_t eight_pixels = this->
buffer_[i];
 
 4403    for (uint8_t j = 0; j < 8; j += 2) {
 
 4407      uint8_t left_nibble = (eight_pixels & 0x80) ? 0x30 : 0x00;
 
 4409      uint8_t right_nibble = (eight_pixels & 0x80) ? 0x03 : 0x00;
 
 4411      this->
write_byte(left_nibble | right_nibble);
 
 
 4430  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4431  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in-bc");
 
 4433  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4434  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4435  LOG_UPDATE_INTERVAL(
this);
 
 
 4531  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4532  ESP_LOGCONFIG(TAG, 
"  Model: 7.5in-HD-b");
 
 4534  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4535  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4536  LOG_UPDATE_INTERVAL(
this);
 
 
 4539static const uint8_t LUT_SIZE_TTGO_DKE_PART = 153;
 
 4541static const uint8_t PART_UPDATE_LUT_TTGO_DKE[LUT_SIZE_TTGO_DKE_PART] = {
 
 4542    0x0, 0x40, 0x0, 0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4543    0x0, 0x0,  0x0, 0x0, 0x40, 0x40, 0x0,  0x0,  0x0,  0x0,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x80, 0x0, 0x0,
 
 4544    0x0, 0x0,  0x0, 0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4545    0xF, 0x0,  0x0, 0x0, 0x0,  0x0,  0x0,  0x4,  0x0,  0x0,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4546    0x0, 0x0,  0x0, 0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4547    0x0, 0x0,  0x0, 0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x0,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4548    0x0, 0x0,  0x1, 0x0, 0x0,  0x0,  0x0,  0x0,  0x0,  0x1,  0x0, 0x0, 0x0,  0x0,  0x0, 0x0, 0x0, 0x0,  0x0, 0x0,
 
 4549    0x0, 0x0,  0x0, 0x0, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
 
 4559    ESP_LOGI(TAG, 
"Performing partial e-paper update.");
 
 4561    ESP_LOGI(TAG, 
"Performing full e-paper update.");
 
 4598    this->
write_array(PART_UPDATE_LUT_TTGO_DKE, 
sizeof(PART_UPDATE_LUT_TTGO_DKE));
 
 4650  ESP_LOGI(TAG, 
"Completed e-paper update.");
 
 
 4657  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4658  ESP_LOGCONFIG(TAG, 
"  Model: 2.13inDKE");
 
 4659  LOG_PIN(
"  CS Pin: ", this->
cs_);
 
 4661  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4662  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4663  LOG_UPDATE_INTERVAL(
this);
 
 
 4701  this->
data(0 & 0xFF);
 
 4702  this->
data((0 >> 8) & 0x03);
 
 4707  this->
data(0 & 0xFF);
 
 4708  this->
data((0 >> 8) & 0x03);
 
 4721  this->
data(0 & 0xFF);
 
 4722  this->
data((0 >> 8) & 0x03);
 
 4725  this->
data(0 & 0xFF);
 
 4726  this->
data((0 >> 8) & 0x03);
 
 
 4745  LOG_DISPLAY(
"", 
"Waveshare E-Paper", 
this);
 
 4746  ESP_LOGCONFIG(TAG, 
"  Model: 13.3inK");
 
 4748  LOG_PIN(
"  DC Pin: ", this->
dc_pin_);
 
 4749  LOG_PIN(
"  Busy Pin: ", this->
busy_pin_);
 
 4750  LOG_UPDATE_INTERVAL(
this);
 
 
void feed_wdt(uint32_t time=0)
 
void status_set_warning(const char *message=nullptr)
 
void status_clear_warning()
 
virtual void digital_write(bool value)=0
 
virtual bool digital_read()=0
 
An STL allocator that uses SPI or internal RAM.
 
void deallocate(T *p, size_t n)
 
int get_width() override
Get the width of the image in pixels with rotation applied.
 
void init_internal_(uint32_t buffer_length)
 
int get_height() override
Get the height of the image in pixels with rotation applied.
 
void clear()
Clear the entire screen by filling it with OFF pixels.
 
virtual int get_width_internal()=0
 
virtual int get_height_internal()=0
 
void filled_rectangle(int x1, int y1, int width, int height, Color color=COLOR_ON)
Fill a rectangle with the top left point at [x1,y1] and the bottom right point at [x1+width,...
 
void spi_setup() override
 
void write_byte(uint8_t data)
 
void write_array(const uint8_t *data, size_t length)
 
void deep_sleep() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void initialize() override
 
void dump_config() override
 
void set_full_update_every(uint32_t full_update_every)
 
void deep_sleep() override
 
int get_height_internal() override
 
void write_lut_(const uint8_t *lut, uint8_t size)
 
int get_width_internal() override
 
void dump_config() override
 
void initialize() override
 
int get_height_internal() override
 
void dump_config() override
 
int get_width_internal() override
 
void initialize() override
 
void set_full_update_every(uint32_t full_update_every)
 
int get_height_internal() override
 
uint32_t idle_timeout_() override
 
uint32_t full_update_every_
 
void dump_config() override
 
void initialize() override
 
void deep_sleep() override
 
int get_width_internal() override
 
int get_width_internal() override
 
void dump_config() override
 
void initialize() override
 
uint32_t idle_timeout_() override
 
void deep_sleep() override
 
void set_full_update_every(uint32_t full_update_every)
 
int get_height_internal() override
 
void initialize() override
 
uint32_t idle_timeout_() override
 
void dump_config() override
 
int get_height_internal() override
 
int get_width_internal() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void deep_sleep() override
 
void initialize() override
 
void dump_config() override
 
uint32_t full_update_every_
 
int get_width_internal() override
 
void set_full_update_every(uint32_t full_update_every)
 
uint32_t idle_timeout_() override
 
int get_height_internal() override
 
void dump_config() override
 
void initialize() override
 
int get_width_internal() override
 
void deep_sleep() override
 
void dump_config() override
 
void initialize() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_height_internal() override
 
void initialize() override
 
void initialize() override
 
void dump_config() override
 
int get_width_internal() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_height_internal() override
 
void initialize() override
 
int get_height_internal() override
 
void initialize() override
 
void dump_config() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_height_internal() override
 
void initialize() override
 
int get_width_internal() override
 
int get_height_internal() override
 
void dump_config() override
 
int get_width_internal() override
 
void initialize() override
 
void dump_config() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void initialize() override
 
void set_full_update_every(uint32_t full_update_every)
 
uint32_t full_update_every_
 
int get_width_controller() override
 
int get_height_internal() override
 
void initialize() override
 
uint32_t full_update_every_
 
WaveshareEPaper2P9InV2R2()
 
int get_width_internal() override
 
void write_lut_(const uint8_t *lut, uint8_t size)
 
void dump_config() override
 
void set_full_update_every(uint32_t full_update_every)
 
void deep_sleep() override
 
int get_width_internal() override
 
void dump_config() override
 
void initialize() override
 
int get_height_internal() override
 
void initialize() override
 
void dump_config() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void initialize() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_width_internal() override
 
void initialize() override
 
void dump_config() override
 
uint32_t idle_timeout_() override
 
int get_height_internal() override
 
bool deep_sleep_between_updates_
 
bool wait_until_(WaitForState state)
 
int get_height_internal() override
 
int get_width_internal() override
 
void initialize() override
 
void dump_config() override
 
int get_width_internal() override
 
int get_height_internal() override
 
void initialize() override
 
void dump_config() override
 
void init_internal_7c_(uint32_t buffer_length)
 
void draw_absolute_pixel_internal(int x, int y, Color color) override
 
uint8_t * buffers_[NUM_BUFFERS]
 
uint8_t color_to_hex(Color color)
 
void fill(Color color) override
 
uint32_t get_buffer_length_() override
 
static const int NUM_BUFFERS
 
void initialize() override
 
bool deep_sleep_between_updates_
 
int get_height_internal() override
 
void dump_config() override
 
uint32_t idle_timeout_() override
 
int get_width_internal() override
 
void dump_config() override
 
void initialize() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void dump_config() override
 
void deep_sleep() override
 
void initialize() override
 
int get_height_internal() override
 
int get_width_internal() override
 
void deep_sleep() override
 
void initialize() override
 
void dump_config() override
 
int get_width_internal() override
 
int get_height_internal() override
 
void deep_sleep() override
 
int get_height_internal() override
 
void dump_config() override
 
void initialize() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_height_internal() override
 
void initialize() override
 
int get_width_internal() override
 
void dump_config() override
 
int get_height_internal() override
 
void initialize() override
 
int get_width_internal() override
 
int get_width_internal() override
 
uint32_t idle_timeout_() override
 
int get_height_internal() override
 
void initialize() override
 
void dump_config() override
 
void dump_config() override
 
int get_width_internal() override
 
int get_height_internal() override
 
void initialize() override
 
uint32_t idle_timeout_() override
 
void set_full_update_every(uint32_t full_update_every)
 
uint32_t full_update_every_
 
void dump_config() override
 
void initialize() override
 
uint32_t get_buffer_length_() override
 
void draw_absolute_pixel_internal(int x, int y, Color color) override
 
void fill(Color color) override
 
float get_setup_priority() const override
 
void command(uint8_t value)
 
virtual void initialize()=0
 
void on_safe_shutdown() override
 
void cmd_data(const uint8_t *data, size_t length)
 
virtual uint32_t idle_timeout_()
 
virtual int get_width_controller()
 
virtual void deep_sleep()=0
 
virtual uint32_t get_buffer_length_()=0
 
uint32_t get_buffer_length_() override
 
void fill(Color color) override
 
void draw_absolute_pixel_internal(int x, int y, Color color) override
 
int get_width_controller() override
 
void set_full_update_every(uint32_t full_update_every)
 
WaveshareEPaperTypeA(WaveshareEPaperTypeAModel model)
 
void write_lut_(const uint8_t *lut, uint8_t size)
 
uint32_t idle_timeout_() override
 
void dump_config() override
 
bool deep_sleep_between_updates_
 
int get_height_internal() override
 
void initialize() override
 
void deep_sleep() override
 
WaveshareEPaperTypeAModel model_
 
uint32_t full_update_every_
 
int get_width_internal() override
 
const float PROCESSOR
For components that use data from sensors like displays.
 
WaveshareEPaperTypeAModel
 
@ WAVESHARE_EPAPER_2_9_IN
 
@ WAVESHARE_EPAPER_2_13_IN_V2
 
@ TTGO_EPAPER_2_13_IN_B73
 
@ TTGO_EPAPER_2_13_IN_B74
 
@ WAVESHARE_EPAPER_2_13_IN
 
@ WAVESHARE_EPAPER_2_9_IN_V2
 
@ WAVESHARE_EPAPER_1_54_IN
 
@ WAVESHARE_EPAPER_1_54_IN_V2
 
Providing packet encoding functions for exchanging data with a remote host.
 
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
 
void IRAM_ATTR HOT delay(uint32_t ms)
 
uint32_t IRAM_ATTR HOT millis()
 
Application App
Global storage of Application pointer - only one Application can exist.
 
bool is_on() ESPHOME_ALWAYS_INLINE