panel_154_z90c.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. // GDEH0154Z90, SSD1681 controller, 200x200, black + red (3-colour). Same
  3. // controller family and command shape as panel_213_z98c.h (SSD1680/1681
  4. // 3-colour), two 1bpp planes (0x24 black, 0x26 red) sharing one full-frame
  5. // RAM window.
  6. //
  7. // Derived by the descriptor emitter (tools/gxepd2_harness/emit_descriptor.h)
  8. // observing the real GxEPD2_154_Z90c driver, not hand-transcribed - the first
  9. // panel brought up that way. The emitter reproduced the 213 Z98c descriptor
  10. // byte-for-byte as a control, then produced this one; the capture also caught
  11. // the two real differences from the 213 (verified against the vendor source):
  12. // - SWRESET (0x12) here waits on the busy pin, where the 213 brackets it
  13. // with fixed 10ms delays instead;
  14. // - no 0x21 "display update control" in init (the 213 sets {0x00, 0x80}).
  15. //
  16. // plane_invert is NOT emitter-derived (that needs the diag pass); it's set to
  17. // {false, false} because this driver's writeImage() is byte-identical to the
  18. // 213's - black via 0x24 as-is, red via 0x26 with _writeData(~data) - and the
  19. // 213's {false, false} is bench-validated against that exact behaviour. If red
  20. // and white come out swapped on hardware, flip plane_invert[1] (and see the
  21. // 213's plane_invert comment for the register/convention coupling).
  22. //
  23. // NOT yet bench-tested - no 1.54" panel on hand at import time.
  24. #include "epd_command.h"
  25. namespace esphome::gxepd2 {
  26. inline const uint8_t PANEL_154_Z90C_DRIVER_OUTPUT_CONTROL[] = {0xC7, 0x00, 0x00}; // gate = 0x00C7 = 199 (200 lines)
  27. inline const uint8_t PANEL_154_Z90C_DATA_ENTRY_MODE[] = {0x03};
  28. inline const uint8_t PANEL_154_Z90C_BORDER_WAVEFORM[] = {0x05};
  29. inline const uint8_t PANEL_154_Z90C_TEMP_SENSOR[] = {0x80};
  30. inline const EpdCommand PANEL_154_Z90C_INIT[] = {
  31. {0x12, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true}, // SWRESET
  32. {0x01, PANEL_154_Z90C_DRIVER_OUTPUT_CONTROL, 3},
  33. {0x11, PANEL_154_Z90C_DATA_ENTRY_MODE, 1},
  34. {0x3C, PANEL_154_Z90C_BORDER_WAVEFORM, 1},
  35. {0x18, PANEL_154_Z90C_TEMP_SENSOR, 1},
  36. };
  37. inline const uint8_t PANEL_154_Z90C_UPDATE_MODE[] = {0xF7};
  38. inline const EpdCommand PANEL_154_Z90C_REFRESH[] = {
  39. {0x22, PANEL_154_Z90C_UPDATE_MODE, 1},
  40. {0x20, nullptr, 0, /*delay_before_ms=*/0, /*delay_after_ms=*/0, /*wait_busy_after=*/true},
  41. };
  42. // _setPartialRamArea(0, 0, 200, 200): SSD1681 byte-column X addressing, no
  43. // Y-reversal (same layout as the 213 Z98c).
  44. inline const uint8_t PANEL_154_Z90C_WINDOW_X[] = {0x00, 0x18}; // xe/8 = 199/8 = 24
  45. inline const uint8_t PANEL_154_Z90C_WINDOW_Y[] = {0x00, 0x00, 0xC7, 0x00}; // ye = 199
  46. inline const uint8_t PANEL_154_Z90C_WINDOW_XC[] = {0x00};
  47. inline const uint8_t PANEL_154_Z90C_WINDOW_YC[] = {0x00, 0x00};
  48. inline const EpdCommand PANEL_154_Z90C_WINDOW[] = {
  49. {0x44, PANEL_154_Z90C_WINDOW_X, 2},
  50. {0x45, PANEL_154_Z90C_WINDOW_Y, 4},
  51. {0x4E, PANEL_154_Z90C_WINDOW_XC, 1},
  52. {0x4F, PANEL_154_Z90C_WINDOW_YC, 2},
  53. };
  54. inline const EpdPanelDescriptor PANEL_154_Z90C = {
  55. .width = 200,
  56. .height = 200,
  57. .busy_active_level = true, // GxEPD2_EPD(..., /*busy_level=*/HIGH, ...)
  58. .busy_timeout_ms = 30000, // vendor full_refresh_time ~14000ms; err long
  59. .init_sequence = PANEL_154_Z90C_INIT,
  60. .init_sequence_len = sizeof(PANEL_154_Z90C_INIT) / sizeof(PANEL_154_Z90C_INIT[0]),
  61. .window_sequence = {PANEL_154_Z90C_WINDOW, nullptr},
  62. .window_sequence_len = {sizeof(PANEL_154_Z90C_WINDOW) / sizeof(PANEL_154_Z90C_WINDOW[0]), 0},
  63. .plane_count = 2,
  64. .plane_write_cmd = {0x24, 0x26},
  65. .plane_invert = {false, false}, // see header note (matches 213 Z98c's validated convention)
  66. .refresh_sequence = PANEL_154_Z90C_REFRESH,
  67. .refresh_sequence_len = sizeof(PANEL_154_Z90C_REFRESH) / sizeof(PANEL_154_Z90C_REFRESH[0]),
  68. };
  69. } // namespace esphome::gxepd2