LovyanGFX Settings for 3.5" Parallel RGB Display
I've recently bought a few Elecrow ESP32 Displays. I've been getting them to work with various Arduino graphics libraries and have found several working configurations.
This configuration works for me with the 3.5" Parallel RGB display using the latest LovyanGFX library:
class LGFX : public lgfx::LGFX_Device { public: lgfx::Bus_Parallel16 _bus_instance; lgfx::Panel_ILI9488 _panel_instance; lgfx::Light_PWM _light_instance; lgfx::Touch_FT5x06 _touch_instance; LGFX(void) { { auto cfg = _bus_instance.config(); cfg.freq_write = 40000000; cfg.pin_wr = 18; cfg.pin_rd = 48; cfg.pin_rs = 45; cfg.pin_d0 = 47; cfg.pin_d1 = 21; cfg.pin_d2 = 14; cfg.pin_d3 = 13; cfg.pin_d4 = 12; cfg.pin_d5 = 11; cfg.pin_d6 = 10; cfg.pin_d7 = 9; cfg.pin_d8 = 3; cfg.pin_d9 = 8; cfg.pin_d10 = 16; cfg.pin_d11 = 15; cfg.pin_d12 = 7; cfg.pin_d13 = 6; cfg.pin_d14 = 5; cfg.pin_d15 = 4; _bus_instance.config(cfg); _panel_instance.bus(&_bus_instance); } { auto cfg = _panel_instance.config(); cfg.panel_width = 480; cfg.panel_width = 320; cfg.offset_x = 0; cfg.offset_y = 0; cfg.pin_cs = -1; cfg.pin_rst = -1; cfg.pin_busy = -1; cfg.offset_rotation = 3; cfg.readable = true; cfg.invert = false; cfg.rgb_order = false; cfg.dlen_16bit = true; cfg.bus_shared = false; _panel_instance.config(cfg); } { auto cfg = _light_instance.config(); cfg.pin_bl = GPIO_NUM_46; _light_instance.config(cfg); _panel_instance.light(&_light_instance); } { auto cfg = _touch_instance.config(); cfg.i2c_port = 0; cfg.i2c_addr = 0x38; cfg.pin_sda = 38; cfg.pin_scl = 39; cfg.pin_int = -1; cfg.freq = 400000; cfg.x_min = 0; cfg.x_max = 479; cfg.y_min = 0; cfg.y_max = 319; _touch_instance.config(cfg); _panel_instance.setTouch(&_touch_instance); } setPanel(&_panel_instance); } };
Comments
Please note that there is a 3.5" version with a 16 bit parallel bus, the "RGB" version, a.k.a. DLC35010R, and a version with SPI, which is slightly slower.
The parallel 3.5" board is supported by default in LovianGFX v1.1.6.
This worked for me:
The file
LGFX_Elecrow_ESP32_Display_DLC35010R.h
contains the code in the original comment by benlye above (I did not check if it is exactly the same, but it works).The display flush callback function is:
The code to initialize lvgl is:
I can't recall exactly what I modified in
lv_conf.h
, but this was pretty straightforward. At least change:I noticed that many important function names were changed in v9 of LVGL, but were not yet updated in the documentation. This was quite a challenge for a beginner like me, but I am really pleased that it works now. It is of course also possible to use an earlier version of LVGL, but the callback function and init procedures must then be a little different.
I have not tested the capacitive touch yet, which will be my next step.
Enjoy!