panel_213c_gdey0213f51.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #pragma once
  2. // Hand-derived from third_party/GxEPD2/src/epd4c/GxEPD2_213c_GDEY0213F51.{h,cpp}
  3. // (GDEY0213F51, JD79661 controller, 128x250 buffer / 122x250 visible,
  4. // 4-color BWRY).
  5. //
  6. // Pixel codes black=0x00, white=0x01, yellow=0x02, red=0x03 (GXEPD2_PALETTE_4C,
  7. // per GxEPD2_4C.h color4()); the vendor's own white clear writes 0x55 (code
  8. // 0x01 x4), confirming white=0x01.
  9. #include "epd_command.h"
  10. namespace esphome::gxepd2 {
  11. inline const uint8_t PANEL_213C_GDEY0213F51_CMD_4D[] = {0x78};
  12. inline const uint8_t PANEL_213C_GDEY0213F51_PSR[] = {0x0F, 0x29};
  13. inline const uint8_t PANEL_213C_GDEY0213F51_PWRR[] = {0x07, 0x00};
  14. inline const uint8_t PANEL_213C_GDEY0213F51_POFS[] = {0x10, 0x54, 0x44};
  15. inline const uint8_t PANEL_213C_GDEY0213F51_BTST[] = {0x05, 0x00, 0x3F, 0x0A, 0x25, 0x12, 0x1A};
  16. inline const uint8_t PANEL_213C_GDEY0213F51_CDI[] = {0x37};
  17. inline const uint8_t PANEL_213C_GDEY0213F51_TCON[] = {0x02, 0x02};
  18. inline const uint8_t PANEL_213C_GDEY0213F51_TRES[] = {0x00, 0x80, 0x00, 0xFA}; // WIDTH=128, HEIGHT=250
  19. inline const uint8_t PANEL_213C_GDEY0213F51_E7[] = {0x1C};
  20. inline const uint8_t PANEL_213C_GDEY0213F51_PWS[] = {0x22};
  21. inline const uint8_t PANEL_213C_GDEY0213F51_LVD[] = {0xD0};
  22. inline const uint8_t PANEL_213C_GDEY0213F51_B5[] = {0x03};
  23. inline const uint8_t PANEL_213C_GDEY0213F51_E9[] = {0x01};
  24. inline const uint8_t PANEL_213C_GDEY0213F51_PLL[] = {0x08};
  25. inline const EpdCommand PANEL_213C_GDEY0213F51_INIT[] = {
  26. {0x4D, PANEL_213C_GDEY0213F51_CMD_4D, 1},
  27. {0x00, PANEL_213C_GDEY0213F51_PSR, 2},
  28. {0x01, PANEL_213C_GDEY0213F51_PWRR, 2},
  29. {0x03, PANEL_213C_GDEY0213F51_POFS, 3},
  30. {0x06, PANEL_213C_GDEY0213F51_BTST, 7},
  31. {0x50, PANEL_213C_GDEY0213F51_CDI, 1},
  32. {0x60, PANEL_213C_GDEY0213F51_TCON, 2},
  33. {0x61, PANEL_213C_GDEY0213F51_TRES, 4},
  34. {0xE7, PANEL_213C_GDEY0213F51_E7, 1},
  35. {0xE3, PANEL_213C_GDEY0213F51_PWS, 1},
  36. {0xB4, PANEL_213C_GDEY0213F51_LVD, 1},
  37. {0xB5, PANEL_213C_GDEY0213F51_B5, 1},
  38. {0xE9, PANEL_213C_GDEY0213F51_E9, 1},
  39. {0x30, PANEL_213C_GDEY0213F51_PLL, 1},
  40. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  41. };
  42. // _setPartialRamArea(0, 0, 128, 250), default partial_mode=true.
  43. inline const uint8_t PANEL_213C_GDEY0213F51_WINDOW[] = {
  44. 0x00, 0x00, // x/256, x%256 = 0
  45. 0x00, 0x7F, // xe/256, xe%256 = 127
  46. 0x00, 0x00, // y/256, y%256 = 0
  47. 0x00, 0xF9, // ye/256, ye%256 = 249
  48. 0x01,
  49. };
  50. inline const EpdCommand PANEL_213C_GDEY0213F51_WINDOW_SEQ[] = {
  51. {0x83, PANEL_213C_GDEY0213F51_WINDOW, 9},
  52. };
  53. // _refresh(false): 0x50=0x37 (white/non-floating border), then 0x12+delay(1)+
  54. // _waitWhileBusy - collapsed into one wait_busy_after.
  55. inline const uint8_t PANEL_213C_GDEY0213F51_CDI_REFRESH[] = {0x37};
  56. inline const uint8_t PANEL_213C_GDEY0213F51_REFRESH_TRIGGER[] = {0x00};
  57. inline const EpdCommand PANEL_213C_GDEY0213F51_REFRESH[] = {
  58. {0x50, PANEL_213C_GDEY0213F51_CDI_REFRESH, 1},
  59. {0x12, PANEL_213C_GDEY0213F51_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  60. /*wait_busy_after=*/true},
  61. };
  62. inline const uint8_t PANEL_213C_GDEY0213F51_POWER_OFF_0_02[] = {0x00};
  63. inline const EpdCommand PANEL_213C_GDEY0213F51_POWER_OFF[] = {
  64. {0x02, PANEL_213C_GDEY0213F51_POWER_OFF_0_02, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true},
  65. };
  66. inline const uint8_t PANEL_213C_GDEY0213F51_HIBERNATE_0_07[] = {0xA5};
  67. inline const EpdCommand PANEL_213C_GDEY0213F51_HIBERNATE[] = {
  68. {0x07, PANEL_213C_GDEY0213F51_HIBERNATE_0_07, 1},
  69. };
  70. inline const EpdPanelDescriptor PANEL_213C_GDEY0213F51 = {
  71. .width = 128,
  72. .height = 250,
  73. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...)
  74. .busy_timeout_ms = 30000, // full_refresh_time is 25000ms
  75. .init_sequence = PANEL_213C_GDEY0213F51_INIT,
  76. .init_sequence_len = sizeof(PANEL_213C_GDEY0213F51_INIT) / sizeof(PANEL_213C_GDEY0213F51_INIT[0]),
  77. .window_sequence = {PANEL_213C_GDEY0213F51_WINDOW_SEQ, nullptr},
  78. .window_sequence_len = {sizeof(PANEL_213C_GDEY0213F51_WINDOW_SEQ) / sizeof(PANEL_213C_GDEY0213F51_WINDOW_SEQ[0]), 0},
  79. .plane_count = 1,
  80. .plane_write_cmd = {0x10, 0x00},
  81. .plane_invert = {false, false},
  82. .bits_per_pixel = 2,
  83. .palette = GXEPD2_PALETTE_4C,
  84. .palette_len = GXEPD2_PALETTE_4C_LEN,
  85. .blank_code = 0x01,
  86. .refresh_sequence = PANEL_213C_GDEY0213F51_REFRESH,
  87. .refresh_sequence_len = sizeof(PANEL_213C_GDEY0213F51_REFRESH) / sizeof(PANEL_213C_GDEY0213F51_REFRESH[0]),
  88. .power_off_sequence = PANEL_213C_GDEY0213F51_POWER_OFF,
  89. .power_off_sequence_len = sizeof(PANEL_213C_GDEY0213F51_POWER_OFF) / sizeof(PANEL_213C_GDEY0213F51_POWER_OFF[0]),
  90. .hibernate_sequence = PANEL_213C_GDEY0213F51_HIBERNATE,
  91. .hibernate_sequence_len = sizeof(PANEL_213C_GDEY0213F51_HIBERNATE) / sizeof(PANEL_213C_GDEY0213F51_HIBERNATE[0]),
  92. };
  93. } // namespace esphome::gxepd2