panel_213c_gdey0213f52.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. // GDEY0213F52, JD79676 controller, 128x250, 4-color (BWRY). The V2 revision of
  3. // the GDEY0213F51 (JD79661) on a different controller - this is the part the
  4. // bench F52 panels actually are (see the F51-vs-F52 control-diff memory).
  5. //
  6. // Emitter-derived (tools/gxepd2_harness/emit_descriptor.h) from the vendor
  7. // GxEPD2_213c_GDEY0213F52 driver pulled into vendor/ from the zGxEPD2 fork.
  8. // The striking thing the capture shows: this driver is *minimal* because the
  9. // JD79676 loads PSR/PWR/BTST/resolution and the full-refresh LUT from on-chip
  10. // OTP. So init is just 0xE9=0x01 then power-on (0x04), there is NO register
  11. // setup and NO window command at all (OTP resolution defaults to 128x250 =
  12. // WIDTH x HEIGHT, and with partial-update off the controller fills the whole
  13. // OTP-default frame), and refresh is a bare 0x12 trigger relying on the OTP
  14. // default CDI. Nothing to hand-transcribe - this is exactly what the emitter
  15. // produced, with only the packed-format fields added below.
  16. //
  17. // Packed 4-color: bits_per_pixel=2, GXEPD2_PALETTE_4C (the vendor's own
  18. // color4() black0/white1/yellow2/red3, validated by the diag Pattern-B pass -
  19. // see DESIGN.md §12; the F52 uses the same GxEPD2_4C wrapper). blank_code=0x01
  20. // matches the observed 0x55 white clear (code 01 x4). If colors come out wrong
  21. // on hardware the palette/codes are the thing to re-check for JD79676.
  22. //
  23. // NOT yet bench-confirmed at import time.
  24. #include "epd_command.h"
  25. namespace esphome::gxepd2 {
  26. inline const uint8_t PANEL_213C_GDEY0213F52_CMD_E9[] = {0x01};
  27. inline const EpdCommand PANEL_213C_GDEY0213F52_INIT[] = {
  28. {0xE9, PANEL_213C_GDEY0213F52_CMD_E9, 1},
  29. {0x04, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // power on
  30. };
  31. inline const uint8_t PANEL_213C_GDEY0213F52_REFRESH_TRIGGER[] = {0x00};
  32. inline const EpdCommand PANEL_213C_GDEY0213F52_REFRESH[] = {
  33. {0x12, PANEL_213C_GDEY0213F52_REFRESH_TRIGGER, 1, /*delay_before_ms=*/0, /*delay_after_ms=*/0,
  34. /*wait_busy_after=*/true},
  35. };
  36. inline const EpdPanelDescriptor PANEL_213C_GDEY0213F52 = {
  37. .width = 128,
  38. .height = 250,
  39. // Vendor driver passes busy_level=LOW, but on the bench F52 that made every
  40. // busy-wait (power-on, refresh) return in ~8ms and the panel never refreshed
  41. // (charge pump not up before the plane write + 0x12). Real BUSY is active
  42. // HIGH here - a hardware fact the command capture can't see. Set HIGH so the
  43. // engine actually waits out the ~16s refresh.
  44. .busy_active_level = true,
  45. .busy_timeout_ms = 30000, // vendor full_refresh_time ~16000ms; err long
  46. .init_sequence = PANEL_213C_GDEY0213F52_INIT,
  47. .init_sequence_len = sizeof(PANEL_213C_GDEY0213F52_INIT) / sizeof(PANEL_213C_GDEY0213F52_INIT[0]),
  48. .window_sequence = {nullptr, nullptr}, // OTP-default full frame; driver sets no window
  49. .window_sequence_len = {0, 0},
  50. .plane_count = 1,
  51. .plane_write_cmd = {0x10, 0x00},
  52. .plane_invert = {false, false}, // unused for packed panels
  53. .bits_per_pixel = 2,
  54. .palette = GXEPD2_PALETTE_4C,
  55. .palette_len = GXEPD2_PALETTE_4C_LEN,
  56. .blank_code = 0x01, // white; matches the observed 0x55 clear (code 01 x4)
  57. .refresh_sequence = PANEL_213C_GDEY0213F52_REFRESH,
  58. .refresh_sequence_len = sizeof(PANEL_213C_GDEY0213F52_REFRESH) / sizeof(PANEL_213C_GDEY0213F52_REFRESH[0]),
  59. };
  60. } // namespace esphome::gxepd2