PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S02
PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S02
These Sunton boards have an LCD display and most of them have a touch interface. More information, data sheets, ordering information etc. can be found at Sunton Boards information.
Currently this library supports the following boards:
This library integrates seamlessly in PlatformIO and supports these boards by providing display and touch and provides a jump start!
With the boards, there is a link supplied and there are a lot of examples present and this looks fine.... If you know your way around....
These examples for LVGL depend on external libraries (TFT_eSPI or LovyanGFX) but also different touch drivers. However, when working with these libraries, I found out that these libraries had their flaws using these boards:
This library depends on:
[!NOTE] This library uses the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers are provided by Espressif and have already been copied and included to this library.
Get started by following the steps below. It is also highly recommended to look at the demo application esp32-smartdisplay-demo to quickly see the possibilities of this library.
This demo provides:
The next sections will guide you though the process of creating an application. However, knowledge of PlatformIO, C/C++ and LVGL is required!
If you run into problems, first try to open a discussion on the github esp32-smartdisplay discussion board.
This library is made for usage in PlatformIO. If not familiar with PlatformIO please take a look at their site and micro controller boards they support. However these boards only use the Arduino platform and ESP32 boards.
Make sure you have PlatformIO installed and functional. Follow the documentation on their site: https://docs.platformio.org/en/latest/
The board definitions required for this library are defined in the boards library platformio-espressif32-sunton. This library must reside in the /boards directory so PlatformIo will automatically recognize these boards.
It is recommended to use git clone --recurse-submodules to include these board definitions automatically.
In case the repository was opened without the submodules, the submodules need to be initialized and updated. To do this type at the command prompt:
git submodule init
git submodule update[!TIP] If you already have a project, clone it with the
git clone --recurse-submodules. If creating a new project, usegit submodule add https://github.com/rzeldent/platformio-espressif32-sunton.git boardsto add them to your project as a submodule.
Use the standard PlatformIO create project to start a new project. When using a new PlatformIO installation these boards, defined in platformio-espressif32-sunton, are not present. Just use a known ESP32 board and correct this later in the platformIO file.
Optionally, you can copy the boards definition to the /.platformio\platforms\espressif32\boards directory to have them always available but it is probably easier to create the project, add the boards as a git submodule and change the board afterwards. For each supported board there is a board definition.
To add this library (and its dependency on LVGL) add the following line to the platformio.ini file:
From the platformIO registry (version 2.0.x):
lib_deps = rzeldent/esp32_smartdisplayor the Github repository:
lib_deps = https://github.com/rzeldent/esp32-smartdisplay.gitThis will automatically download the library, the LVGL library (as a dependency) and set the defines required for the low level drivers.
LVGL needs a configuration file; lv_conf.h. This file contains information about the fonts, color depths, default background, styles, etc...
The default LVGL template can be found in the LVGL library at the location: lvgl/lv_conf_template.h.
This file must be copied to the include directory and renamed to lv_conf.h. Also the #if 0 must be removed to enable the file to be included.
This file can immediately be used and is valid. Some modifications might be required fore additional features.
More information about setting up a project with LVGL can be obtained at LVGL get-started/quick-overview.
I suggest to put the lv_conf.h file in the include directory and set the build flags to specify the location of the file, see below.
Important settings are:
Only the R5G6B5 format is supported on these panels.
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 16For debugging, enable CPU usage, FPS (Frames per Second) and memory defragmentation
#define LV_USE_PERF_MONITOR 1
#define LV_USE_MEM_MONITOR 1For debugging it is possible to enable logging from LVGL. The library will output to the debugging output (using lv_log_register_print_cb).
To enable logging, set the define:
/*Enable the log module*/
#define LV_USE_LOG 1By default the logging is only LV_LOG_LEVEL_WARN but can be adjusted in the lv_conf.h.
To enable additional decoding options, libraries or widgets, enable them in the lv_conf.ini file by setting a LV_USE_xxxx to 1. These are disabled by default.
…More information about the LVGL configuration can be found in the excellent LVGL documentation.
[!WARNING] After the library has been build, changes in the lv_conf.h are no longer applied because libraries are cached. To apply these settings, delete the
.piodirectory so the libraries will be rebuild.
Especially the definition of the LV_CONF_PATH is critical, this must point to an absolute path where the lv_conf.h file is located.
More about this in the section below. See below how this can be done with the use of the platformIO defines:
build_flags =
-Ofast
-Wall
'-D BOARD_NAME="${this.board}"'
'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO'
#'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG'
#'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE'
'-D LV_CONF_PATH=${platformio.include_dir}/lv_conf.h'The line in the settings logs the INFO level to the serial console but can be omitted for production builds:
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONEThe -Wall flag can also be removed but outputs all the warnings.
To enable to display in your project call the void smartdisplay_init() function at startup and optionally set the orientation:
#include
#include
void setup()
{
smartdisplay_init();
auto display = lv_display_get_default();
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_90);
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_180);
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_270);
}and update tick update and drawing in the loop:
auto lv_last_tick = millis();
void loop()
{
auto const now = millis();
// Update the ticker
lv_tick_inc(now - lv_last_tick);
lv_last_tick = now;
// Update the UI
lv_timer_handler();
}There is a good UI designer available for LVGL and free
No open issues yet, or sync has not completed.