lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.03k stars 189 forks source link

ZX4D30NE01S / ST7701 #464

Closed erazor83 closed 5 months ago

erazor83 commented 6 months ago

Device: ZX4D30NE01S

Controller should be: ST7701 / 480x272

It's a display only and very cheap (~23eur), can be bought at aliexpress:

Found a doc about the panel:

And some source:

I wrote a custom header but something seems to be wrong:

#define LGFX_USE_V1
#include <LovyanGFX.hpp>

#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <driver/i2c.h>

class LGFX : public lgfx::LGFX_Device
{
public:

  lgfx::Bus_RGB      _bus_instance;
  lgfx::Panel_ST7701 _panel_instance;
//  lgfx::Touch_GT911  _touch_instance;
   lgfx::Light_PWM   _light_instance;

  LGFX(void)
  {
    {
      auto cfg = _panel_instance.config();

      cfg.memory_width  = 480;
      cfg.memory_height = 272;
      cfg.panel_width  = 480;
      cfg.panel_height = 272;

      cfg.offset_x = 0;
      cfg.offset_y = 0;

      _panel_instance.config(cfg);
    }
/*
    {
      auto cfg = _panel_instance.config_detail();

      cfg.pin_cs = 1;
      cfg.pin_sclk = 12;
      cfg.pin_mosi = 11;

      _panel_instance.config_detail(cfg);
    }
*/
    {
      auto cfg = _bus_instance.config();
      cfg.panel = &_panel_instance;
      cfg.pin_d0  = GPIO_NUM_9;   // B0
      cfg.pin_d1  = GPIO_NUM_10;  // B1
      cfg.pin_d2  = GPIO_NUM_11;  // B2
      cfg.pin_d3  = GPIO_NUM_12;  // B3
      cfg.pin_d4  = GPIO_NUM_13;  // B4
      cfg.pin_d5  = GPIO_NUM_16;  // G0
      cfg.pin_d6  = GPIO_NUM_17;  // G1
      cfg.pin_d7  = GPIO_NUM_18;  // G2
      cfg.pin_d8  = GPIO_NUM_8;   // G3
      cfg.pin_d9  = GPIO_NUM_3;   // G4
      cfg.pin_d10 = GPIO_NUM_46;  // G5
      cfg.pin_d11 = GPIO_NUM_4;   // R0
      cfg.pin_d12 = GPIO_NUM_5;   // R1
      cfg.pin_d13 = GPIO_NUM_6;   // R2
      cfg.pin_d14 = GPIO_NUM_7;   // R3
      cfg.pin_d15 = GPIO_NUM_15;  // R4

      cfg.pin_henable = GPIO_NUM_40;
      cfg.pin_vsync   = GPIO_NUM_48;
      cfg.pin_hsync   = GPIO_NUM_47;
      cfg.pin_pclk    = GPIO_NUM_14;
      cfg.freq_write  = 14000000;

      cfg.hsync_polarity    = 0;
      cfg.hsync_front_porch = 10;
      cfg.hsync_pulse_width = 8;
      cfg.hsync_back_porch  = 50;
      cfg.vsync_polarity    = 0;
      cfg.vsync_front_porch = 10;
      cfg.vsync_pulse_width = 8;
      cfg.vsync_back_porch  = 20;
      cfg.pclk_idle_high    = 0;
      cfg.de_idle_high      = 1;
      _bus_instance.config(cfg);
    }
    _panel_instance.setBus(&_bus_instance);

    /*
    {
      auto cfg = _touch_instance.config();
      cfg.x_min      = 0;
      cfg.x_max      = 480;
      cfg.y_min      = 0;
      cfg.y_max      = 272;
      cfg.bus_shared = false;
      cfg.offset_rotation = 0;

      cfg.i2c_port   = I2C_NUM_1;

      cfg.pin_int    = GPIO_NUM_NC;
      cfg.pin_sda    = GPIO_NUM_17;
      cfg.pin_scl    = GPIO_NUM_18;
      cfg.pin_rst    = GPIO_NUM_38;

      cfg.freq       = 400000;
      _touch_instance.config(cfg);
      _panel_instance.setTouch(&_touch_instance);
    }
*/
     {
       auto cfg = _light_instance.config();
       cfg.pin_bl = GPIO_NUM_45;
       _light_instance.config(cfg);
     }
     _panel_instance.light(&_light_instance);

    setPanel(&_panel_instance);
  }
};
github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 5 months ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.