panel_213c_gdey0213f52.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. // GDEY0213F52, JD79676 controller, 128x250, 4-color (BWRY).
  3. //
  4. // Emitter-derived (tools/gxepd2_harness/emit_descriptor.h) from the vendor
  5. // GxEPD2_213c_GDEY0213F52 driver pulled into third_party/GxEPD2/ from the zGxEPD2 fork.
  6. // The striking thing the capture shows: this driver is *minimal* because the
  7. // JD79676 loads PSR/PWR/BTST/resolution and the full-refresh LUT from on-chip
  8. // OTP. So init is just 0xE9=0x01 then power-on (0x04), there is NO register
  9. // setup and NO window command at all (OTP resolution defaults to 128x250 =
  10. // WIDTH x HEIGHT, and with partial-update off the controller fills the whole
  11. // OTP-default frame), and refresh is a bare 0x12 trigger relying on the OTP
  12. // default CDI. Nothing to hand-transcribe - this is exactly what the emitter
  13. // produced, with only the packed-format fields added below.
  14. //
  15. // Packed 4-color: bits_per_pixel=2, GXEPD2_PALETTE_4C (the vendor's own
  16. // color4() black0/white1/yellow2/red3, validated by the diag Pattern-B pass -
  17. // see CONTRIBUTING.md "Limits"; the F52 uses the same GxEPD2_4C wrapper). blank_code=0x01
  18. // matches the observed 0x55 white clear (code 01 x4). If colors come out wrong
  19. // on hardware the palette/codes are the thing to re-check for JD79676.
  20. //
  21. // Bench-confirmed 2026-10-18: 4 colors, clean lines/gradients, ~15.5s full
  22. // refresh. Needed the engine's new post-reset busy wait (cycle_engine.h) - the
  23. // JD79676 holds BUSY while loading from OTP after reset, which the command
  24. // capture can't see; without it every busy-wait returned in ~8ms and nothing
  25. // refreshed. busy_level LOW (the HIGH experiment hung on idle-HIGH) is correct.
  26. #include "epd_command.h"
  27. namespace esphome::gxepd2 {
  28. inline const uint8_t PANEL_213C_GDEY0213F52_CMD_E9[] = {0x01};
  29. inline const EpdCommand PANEL_213C_GDEY0213F52_INIT[] = {
  30. {0xE9, PANEL_213C_GDEY0213F52_CMD_E9, 1},
  31. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  32. };
  33. inline const uint8_t PANEL_213C_GDEY0213F52_REFRESH_TRIGGER[] = {0x00};
  34. inline const EpdCommand PANEL_213C_GDEY0213F52_REFRESH[] = {
  35. {0x12, PANEL_213C_GDEY0213F52_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  36. /*wait_busy_after=*/true},
  37. };
  38. inline const uint8_t PANEL_213C_GDEY0213F52_POWER_OFF_0_02[] = {0x00};
  39. inline const EpdCommand PANEL_213C_GDEY0213F52_POWER_OFF[] = {
  40. {0x02, PANEL_213C_GDEY0213F52_POWER_OFF_0_02, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true},
  41. };
  42. inline const uint8_t PANEL_213C_GDEY0213F52_HIBERNATE_0_07[] = {0xA5};
  43. inline const EpdCommand PANEL_213C_GDEY0213F52_HIBERNATE[] = {
  44. {0x07, PANEL_213C_GDEY0213F52_HIBERNATE_0_07, 1},
  45. };
  46. inline const EpdPanelDescriptor PANEL_213C_GDEY0213F52 = {
  47. .width = 128,
  48. .height = 250,
  49. .busy_active_level = false, // GxEPD2_EPD(..., /*busy_level=*/LOW, ...) - confirmed: HIGH hangs
  50. .busy_timeout_ms = 30000, // vendor full_refresh_time ~16000ms; err long
  51. .init_sequence = PANEL_213C_GDEY0213F52_INIT,
  52. .init_sequence_len = sizeof(PANEL_213C_GDEY0213F52_INIT) / sizeof(PANEL_213C_GDEY0213F52_INIT[0]),
  53. .window_sequence = {nullptr, nullptr}, // OTP-default full frame; driver sets no window
  54. .window_sequence_len = {0, 0},
  55. .plane_count = 1,
  56. .plane_write_cmd = {0x10, 0x00},
  57. .plane_invert = {false, false}, // unused for packed panels
  58. .bits_per_pixel = 2,
  59. .palette = GXEPD2_PALETTE_4C,
  60. .palette_len = GXEPD2_PALETTE_4C_LEN,
  61. .blank_code = 0x01, // white; matches the observed 0x55 clear (code 01 x4)
  62. .refresh_sequence = PANEL_213C_GDEY0213F52_REFRESH,
  63. .refresh_sequence_len = sizeof(PANEL_213C_GDEY0213F52_REFRESH) / sizeof(PANEL_213C_GDEY0213F52_REFRESH[0]),
  64. .power_off_sequence = PANEL_213C_GDEY0213F52_POWER_OFF,
  65. .power_off_sequence_len = sizeof(PANEL_213C_GDEY0213F52_POWER_OFF) / sizeof(PANEL_213C_GDEY0213F52_POWER_OFF[0]),
  66. .hibernate_sequence = PANEL_213C_GDEY0213F52_HIBERNATE,
  67. .hibernate_sequence_len = sizeof(PANEL_213C_GDEY0213F52_HIBERNATE) / sizeof(PANEL_213C_GDEY0213F52_HIBERNATE[0]),
  68. };
  69. } // namespace esphome::gxepd2