Supported Displays

Good evening everyone, I’m starting with LGVL and would like to develop an application in SquarelineStudio where I will use some displays purchased from AlyExpress.

I would like to know if the Displays I purchased are correct?

The website in question is this one:

LVGL is set up in such a way that you have to write the functionality for displaying graphics on the screen yourself, based on an array of pixels generated by LVGL. So any display works if configured correctly!

As Tinus said, LVGL requires that you implement two functions yourself. The first allows LVGL to dump screen changes to the physical screen (flush_cb), and the second processes touch input (read_cb). You can use any screen you want once you implement these methods to convert data from LVGL to be displayed on your screen. There are other libraries for this depending on your screen chipset. I use LovyanGFX but there are others such as TFT_eSPI. Typically, your screen documentation should say which one works with it.

Examples of how to write those two functions can be seen here:

https://docs.lvgl.io/latest/en/html/porting/display.html

My goal is to use squareline studio to create my screens.

In this case, do I necessarily need to implement the functions and use of the LVGL library?

I bought an ILI9488 display

With this display will I be able to implement LVGL?

Hello,

Yes. You do need to implement those functions and use the library. LVGL needs to be there as a whole to generate the widgets/images/buttons, whatever you add based on a design you have made. Luckily for you, the ILI9488 is quite popular and people have already written flush (and probably read) functions for it:

for instance: Ili9488 & lvgl?
There are probably more on the Internet.

If you want to design something and get a visual preview of your design, use Squareline studio.

Guys, could anyone help me please?

So I’m trying to find a clean and simple code to use LVGL with ESP32 and the ILI9488 3.5" screen

I’m just starting with LVGL and I want at least one HELLO Word code.

So that from then on I can continue. NOTE: I am an experienced mcus programmer. But I don’t know this LVGL library.

I analyzed the topic suggested by my colleague, but I did not find a code that I could replicate in my reality.

The simplest LVGL hello world application there is, is probably this one here from the examples page

#include "../lv_examples.h"
#if LV_BUILD_EXAMPLES && LV_USE_LABEL

/**
 * Basic example to create a "Hello world" label
 */
void lv_example_get_started_1(void)
{

    //FIRST: Create a screen!! 
    lv_obj_t* screen = lv_obj_create(NULL);

    /*Change the active screen's background color*/
    lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);

    /*Create a white label, set its text and align it to the center*/
    lv_obj_t * label = lv_label_create(lv_screen_active());
    lv_label_set_text(label, "Hello world");
    lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
    lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

#endif

Follow the initialization steps in the guide: Set up a project — LVGL documentation
Then call the above code before the LOOP in your main.

For writing drivers for your display I cannot help you; as I said the ILI9488 is very widely used, there’s bound to be a working driver out there. Make sure you call lv_tick() and lv_task/timer_handler() when appriopriate. lv_tick(MS) should be called in a timer or other timed interrupt, whereas the lv_task_handler() function should be called in your main LOOP with a short (1MS) delay.

The documentation is not bad. If you want to just have something running you can even run one of the demos provided.

In your lv_conf.h file, find the demo portion and enable one, then run it from your main function before the loop, for example: lv_demo_music() will run the music demo.

I really appreciate your kindness and patience in responding to this post.

And actually using the lgvl library to write a Hello Word seems very simple to me.

As per instructions above. Because just call this function lv_example_get_started_1();

However, my difficulty is that I have no idea of ​​the general composition of the entire program.

What libraries do I include besides LVGL.

How to configure this lvgl_conf ? How to configure this driver “ili9488”.

I’m totally lost at this.

I didn’t find any tutorial that could help me.

There are few videos on the internet about the subject. And everyone is very busy… LVGL’s own documentation is well done and organized. It starts from the principle that you already know what you are doing.

There is no LVGL for dumies.

I’m without a way.

Hello,

For LVGL you do need to include any other libraries to get it to work, it is self contained.
Try following the steps here:
https://docs.lvgl.io/8.3/get-started/quick-overview.html#add-lvgl-into-your-project

The placement of lv_conf.h might seem a bit strange. Basically your project file structure has to look like this:

PROJECT:
-src:
 +-main.c
 +-(other files...)
-lvgl (copied or cloned from git
 +-All LVGL files...
-lv.conf.h (copy LV_TEMPLATE here and rename it to lv_conf.h)

Then in lv_conf.h change first #IF 0 to #IF 1. The defines in lv_conf.h can be seen as settings for LVGL to use.

Now in the file where you want LVGL to work from, simply #include "lvgl.h" or #include "..\lvgl\lvgl.h" depending on your file structure, linking settings et cetera.

After including LVGL, set it up by following the initilialization steps. As for driving your display, I really can’t help you: you need to create a function which draws the “pixels” lvgl puts into a buffer, to the display.

I really appreciate the attention.

Well, at this exact moment I managed to make a Hello Word example work perfectly.

I really suffered a lot because things are not clear in the C++ compiler, I needed to have the LCD screen and the Touch Driver working perfectly.

Before leaving for LVGL.

I believe this is a normal difficulty for those who are learning a new technology that involves several correlated tools.

1 Like

Below are the UserSetup.h settings

/* This is a stripped down version of a User_Setup.h file for TFT_eSPI

Copy the contents of this file to TFT_eSPI-master/User_setup.h 

This version is for a 38-pin ESP32 DevKitC and an ILI9488 screen with resistive touch controller.

*/

#define ILI9488_DRIVER     // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)

#define TFT_BL   32            // LED back-light control pin

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   15  // Chip select control pin
#define TFT_DC    2  // Data Command control pin
#define TFT_RST   4  // Reset pin (could connect to RST pin)

#define TOUCH_CS 21     // Chip select pin (T_CS) of touch screen

#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.

#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

#define SMOOTH_FONT

#define SPI_FREQUENCY  27000000
#define SPI_READ_FREQUENCY  20000000
#define SPI_TOUCH_FREQUENCY  2500000