panel_290c_gdey029f51.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #pragma once
  2. // Hand-derived from third_party/GxEPD2/src/epd4c/GxEPD2_290c_GDEY029F51.{h,cpp}
  3. // (GDEY029F51, JD79667 controller, 128x296, 4-color BWRY panel used here as
  4. // black/white/red via the black+color buffer interface). First panel on a
  5. // completely different command set from the SSD1680/1677/UC8179 mono
  6. // panels (0x00 PSR, 0x01 PWRR, 0x03 POFS, 0x06 BTST, 0x50 CDI, 0x60 TCON,
  7. // 0x61 TRES, 0x83 window-set, refresh via 0x50+0x12) and, more importantly,
  8. // a fundamentally different pixel format: 2 bits/pixel, 4 pixels/byte
  9. // (black=0x00, white=0x01, yellow=0x02, red=0x03 per GxEPD2_4C.h color4()),
  10. // not 1-bit-per-pixel planes - see EpdPanelDescriptor::bits_per_pixel /
  11. // palette and GxEPD2Display's draw_packed_() for the buffer-side half.
  12. #include "epd_command.h"
  13. namespace esphome::gxepd2 {
  14. inline const uint8_t PANEL_290C_GDEY029F51_CMD_4D[] = {0x78};
  15. inline const uint8_t PANEL_290C_GDEY029F51_PSR[] = {0x0F, 0x29};
  16. inline const uint8_t PANEL_290C_GDEY029F51_PWRR[] = {0x07, 0x00};
  17. inline const uint8_t PANEL_290C_GDEY029F51_POFS[] = {0x10, 0x54, 0x44};
  18. inline const uint8_t PANEL_290C_GDEY029F51_BTST[] = {0x05, 0x00, 0x3F, 0x0A, 0x25, 0x12, 0x1A};
  19. inline const uint8_t PANEL_290C_GDEY029F51_CDI[] = {0x37};
  20. inline const uint8_t PANEL_290C_GDEY029F51_TCON[] = {0x02, 0x02};
  21. inline const uint8_t PANEL_290C_GDEY029F51_TRES[] = {0x00, 0x80, 0x01, 0x28}; // WIDTH=128, HEIGHT=296
  22. inline const uint8_t PANEL_290C_GDEY029F51_E7[] = {0x1C};
  23. inline const uint8_t PANEL_290C_GDEY029F51_PWS[] = {0x22};
  24. inline const uint8_t PANEL_290C_GDEY029F51_LVD[] = {0xD0};
  25. inline const uint8_t PANEL_290C_GDEY029F51_B5[] = {0x03};
  26. inline const uint8_t PANEL_290C_GDEY029F51_E9[] = {0x01};
  27. inline const uint8_t PANEL_290C_GDEY029F51_PLL[] = {0x08};
  28. inline const EpdCommand PANEL_290C_GDEY029F51_INIT[] = {
  29. {0x4D, PANEL_290C_GDEY029F51_CMD_4D, 1},
  30. {0x00, PANEL_290C_GDEY029F51_PSR, 2},
  31. {0x01, PANEL_290C_GDEY029F51_PWRR, 2},
  32. {0x03, PANEL_290C_GDEY029F51_POFS, 3},
  33. {0x06, PANEL_290C_GDEY029F51_BTST, 7},
  34. {0x50, PANEL_290C_GDEY029F51_CDI, 1},
  35. {0x60, PANEL_290C_GDEY029F51_TCON, 2},
  36. {0x61, PANEL_290C_GDEY029F51_TRES, 4},
  37. {0xE7, PANEL_290C_GDEY029F51_E7, 1},
  38. {0xE3, PANEL_290C_GDEY029F51_PWS, 1},
  39. {0xB4, PANEL_290C_GDEY029F51_LVD, 1},
  40. {0xB5, PANEL_290C_GDEY029F51_B5, 1},
  41. {0xE9, PANEL_290C_GDEY029F51_E9, 1},
  42. {0x30, PANEL_290C_GDEY029F51_PLL, 1},
  43. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  44. };
  45. // _setPartialRamArea(0, 0, 128, 296), default partial_mode=true.
  46. inline const uint8_t PANEL_290C_GDEY029F51_WINDOW[] = {
  47. 0x00, 0x00, // x/256, x%256 = 0
  48. 0x00, 0x7F, // xe/256, xe%256 = 127
  49. 0x00, 0x00, // y/256, y%256 = 0
  50. 0x01, 0x27, // ye/256, ye%256 = 295
  51. 0x01,
  52. };
  53. inline const EpdCommand PANEL_290C_GDEY029F51_WINDOW_SEQ[] = {
  54. {0x83, PANEL_290C_GDEY029F51_WINDOW, 9},
  55. };
  56. // _refresh(false): 0x50=0x37 (white/non-floating border, not partial),
  57. // then 0x12+delay(1)+_waitWhileBusy - collapsed into one wait_busy_after.
  58. inline const uint8_t PANEL_290C_GDEY029F51_CDI_REFRESH[] = {0x37};
  59. inline const uint8_t PANEL_290C_GDEY029F51_REFRESH_TRIGGER[] = {0x00};
  60. inline const EpdCommand PANEL_290C_GDEY029F51_REFRESH[] = {
  61. {0x50, PANEL_290C_GDEY029F51_CDI_REFRESH, 1},
  62. {0x12, PANEL_290C_GDEY029F51_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  63. /*wait_busy_after=*/true},
  64. };
  65. inline const uint8_t PANEL_290C_GDEY029F51_POWER_OFF_0_02[] = {0x00};
  66. inline const EpdCommand PANEL_290C_GDEY029F51_POWER_OFF[] = {
  67. {0x02, PANEL_290C_GDEY029F51_POWER_OFF_0_02, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true},
  68. };
  69. inline const uint8_t PANEL_290C_GDEY029F51_HIBERNATE_0_07[] = {0xA5};
  70. inline const EpdCommand PANEL_290C_GDEY029F51_HIBERNATE[] = {
  71. {0x07, PANEL_290C_GDEY029F51_HIBERNATE_0_07, 1},
  72. };
  73. inline const EpdPanelDescriptor PANEL_290C_GDEY029F51 = {
  74. .width = 128,
  75. .height = 296,
  76. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...)
  77. .busy_timeout_ms = 30000, // full_refresh_time is 25000ms
  78. .init_sequence = PANEL_290C_GDEY029F51_INIT,
  79. .init_sequence_len = sizeof(PANEL_290C_GDEY029F51_INIT) / sizeof(PANEL_290C_GDEY029F51_INIT[0]),
  80. .window_sequence = {PANEL_290C_GDEY029F51_WINDOW_SEQ, nullptr},
  81. .window_sequence_len = {sizeof(PANEL_290C_GDEY029F51_WINDOW_SEQ) / sizeof(PANEL_290C_GDEY029F51_WINDOW_SEQ[0]), 0},
  82. .plane_count = 1,
  83. .plane_write_cmd = {0x10, 0x00},
  84. .plane_invert = {false, false},
  85. .bits_per_pixel = 2,
  86. .palette = GXEPD2_PALETTE_4C,
  87. .palette_len = GXEPD2_PALETTE_4C_LEN,
  88. .blank_code = 0x01,
  89. .refresh_sequence = PANEL_290C_GDEY029F51_REFRESH,
  90. .refresh_sequence_len = sizeof(PANEL_290C_GDEY029F51_REFRESH) / sizeof(PANEL_290C_GDEY029F51_REFRESH[0]),
  91. .power_off_sequence = PANEL_290C_GDEY029F51_POWER_OFF,
  92. .power_off_sequence_len = sizeof(PANEL_290C_GDEY029F51_POWER_OFF) / sizeof(PANEL_290C_GDEY029F51_POWER_OFF[0]),
  93. .hibernate_sequence = PANEL_290C_GDEY029F51_HIBERNATE,
  94. .hibernate_sequence_len = sizeof(PANEL_290C_GDEY029F51_HIBERNATE) / sizeof(PANEL_290C_GDEY029F51_HIBERNATE[0]),
  95. };
  96. } // namespace esphome::gxepd2