LilyGo T-Display-S3 (ESP32S3 + st7789) Arduino PlatformIO minimal example to get started

Description

Howdy!

I’m trying to get started with LVGL on my T-Display-S3.
For a couple of reasons, this is quite overwhelming, however. I’m not here to rant, but I’ll list my hurdles here, in case you are interested in seeing which problems newbies run into when trying to get started. Feel free to skip to my actual questions in the following sections:

  • The configuration files have a ton of settings. I would like A) a simple overview over which settings are critical for getting started and B) a glossary with a short description of each setting.
  • When researching, I come across a lot of outdated information. As an example, this prominent repo has not been updated in more than a year: lvgl/lv_port_esp32
    • A more specific example is that this file mentions a file lvgl:/src/lv_conf_simple.h that is nowhere to be found
    • A lot of this outdated information mentions settings and functions that don’t exist anymore. For example, I’ve come across LV_COLOR_16_SWAP a lot, which does not appear in the newest conf files on master
  • In general, I would like a super simple tutorial, holding my hand all the way from adding the library to my project, though printing my first letter on the screen. I feel like this documentation Set up a project, for example, has quite a lot of places where it mentions that something needs to be done, but it skips the how and why.

What MCU/Processor/Board and compiler are you using?

I’m using a LilyGo T-Display-S3, so an ESP32S3 combined with an st7789.
I’m using PlatformIO with the Arduino framework. Also, I’m using the master branch of LVGL.

What do you want to achieve?

A minimal example, for example setting the full screen to some color, or displaying a word.

What have you tried so far?

I have installed the library using PlatformIO. My platformio.ini looks like this:

[env:lilygo-t-display-s3]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.01.10/platform-espressif32.zip
board = lilygo-t-display-s3
framework = arduino
build_unflags = -std=gnu++11
build_flags = -std=gnu++2b 
              -D LV_CONF_INCLUDE_SIMPLE
              -D LV_CONF_SKIP ; Configure LVGL in platformio.ini instead of lv_conf.h 
              -D LV_COLOR_DEPTH=16
              -D LV_USE_ST7789
              -D LV_USE_LOG
lib_deps = lvgl = https://github.com/lvgl/lvgl.git

I have seen mention of the following setting:

/*Use a custom tick source that tells the elapsed time in milliseconds.
 *It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
    #define LV_TICK_CUSTOM_INCLUDE "Arduino.h"         /*Header for the system time function*/
    #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis())    /*Expression evaluating to current system time in ms*/
#endif   /*LV_TICK_CUSTOM*/

But this does not seem to exist in the current version of lv_conf.h.
I would like to have as little as possible to do with handling these ticks, though, so this setting sounds nice.

Code to reproduce

I have created a main.cpp that looks like this:

#include <Arduino.h>
#include <lvgl.h>
#include <drivers/display/st7789/lv_st7789.h>

uint64_t count = 0;

void setup() {
    Serial.begin(115200);
    lv_init();

    // auto display = lv_st7789_create(EXAMPLE_LCD_H_RES, EXAMPLE_LCD_V_RES, );
}

void loop() {
    Serial.println(count++);
    sleep(1);
}

This compiles and makes my board print stuff over serial, as expected.
The commented out line is my attempt at getting started by creating a display, but I’m stuck here, since I don’t know how to deal with the remaining arguments:

flags – default configuration settings (mirror, RGB ordering, etc.)
send_cmd – platform-dependent function to send a command to the LCD controller (usually uses polling transfer)
send_color – platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback)
  1. Where can I find a description of all the possible flags, and how do I set them?
  2. How do I create these send_cmd and send_color functions?
  • This documentation page “ST7789 LCD Controller driver” mentions that I need to create these functions, but it doesn’t give me enough information about what I should actually implement. To get more information, it links to a file that does not exist. (Sorry, I’m only allowed to include three links, since I’m a new user).
  1. What do I do after creating my display?
2 Likes

Small update:

I figured out that the dead link was caused by a missing s (doc vs. docs). It should link here. This document was a really good find, as it explains a bunch of stuff in a more detailed way. Now I know what the flags are and how to set them.

I’m still really stuck, but I’m making tiny progress at least, which is nice.

1 Like

I found a really nice example that I’m now studying :slight_smile:

thank u, i am facing the same situation to yours, and your efforts help me a lot!I have tried to figure out it and taken a lot of time, but not made progress. :kissing_smiling_eyes: :kissing_smiling_eyes:

Hi tang, I hope you have figured out how to make this work.

I have created a minimal working example, which you can find here: LilyGo T-Display-S3 + LVGL minimal example (github.com)