Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

esp32-smartdisplay

> 数据库
Open source

PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S02

682 stars0 likes2 views
WebsiteGitHub

About

PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S02

LVGL drivers for Chinese Sunton Smart display boards, aka CYD (Cheap Yellow Display)

Table of Contents

  • LVGL drivers for Chinese Sunton Smart display boards, aka CYD (Cheap Yellow Display)
    • Table of Contents
    • Supported boards
    • Why this library
    • Dependencies
    • How to use
      • Step 1: Download (or open) PlatformIO
      • Step 2: Boards definitions
      • Step 3: Create a new project
      • Step 4: Add this library to your project
      • Step 5: Create a settings file for LVGL
      • Step 6: Copy the build flags below in your project
      • Step 7: Initialize the display (and touch) in your project
    • Step 8 (Optional): Create your LVGL file or use SquareLine Studio to make a design
    • Step 9: Compile, upload and enjoy
    • Porting from LVGL 8.3.9
      • lv_conf.h
      • Ticker
    • More on lv_conf.h
    • LVGL initialization Functions
      • void smartdisplay_init()
      • void smartdisplay_lcd_set_backlight(float duty)
      • void smartdisplay_lcd_set_brightness_cb(smartdisplay_lcd_adaptive_brightness_cb_t cb, uint interval)
      • void smartdisplay_led_set_rgb(bool r, bool g, bool b)
      • touch_calibration_data_t touch_calibration_data
      • touch_calibration_data_t smartdisplay_compute_touch_calibration(const lv_point_t screen[3], const lv_point_t touch[3])
    • Rotation of the display and touch
    • Appendix: Template to support ALL the boards
    • Appendix: External dependencies
    • Version history

Supported boards

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.

  • N = No touch
  • R = Resistive touch
  • C = Capacitive touch

Currently this library supports the following boards:

  • ESP32-1732S019 N/C
  • ESP32-2424S012 N/C
  • ESP32-2432S022 N/C
  • ESP32-2432S024 R/C/N
  • ESP32-2432S028 R ( 3 variants)
  • ESP32-2432S032 N/R/C
  • ESP32-3248S035 R/C
  • ESP32-4827S043 R/C
  • ESP32-4848S040C_I_Y_1/3
  • ESP32-8048S050 N/C/R
  • ESP32-8048S070 N/C/R

This library integrates seamlessly in PlatformIO and supports these boards by providing display and touch and provides a jump start!

Why this library

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:

  • Lots of configuring to do before it all works,
  • Using a third party library there is unnecessary code included (for other boards),
  • No support for on the fly rotating,
  • No support for touch,
  • Not using code already present in the ESP firmware
  • No LVGL integration
  • Easy compile the same application for different boards

Dependencies

This library depends on:

  • LVGL, currently version 9.1.0
  • platformio-espressif32-sunton

[!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.

How to use

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:

  • User Interface created using the SquareLine Studio GUI generator.
  • Read the CdS (light sensor)
  • Control of the LEDs
  • Works for all known Sunton boards (and more): see Sunton Boards information
  • Full source code

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.

Step 1: Download (or open) PlatformIO

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/

Step 2: Boards definitions

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:

bash
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, use git submodule add https://github.com/rzeldent/platformio-espressif32-sunton.git boards to add them to your project as a submodule.

Step 3: Create a new project

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.

Step 4: Add this library to your project

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):

ini
lib_deps = rzeldent/esp32_smartdisplay

or the Github repository:

ini
lib_deps = https://github.com/rzeldent/esp32-smartdisplay.git

This will automatically download the library, the LVGL library (as a dependency) and set the defines required for the low level drivers.

Step 5: Create a settings file for LVGL

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.

    h
    /*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
    #define LV_COLOR_DEPTH 16
  • For debugging, enable CPU usage, FPS (Frames per Second) and memory defragmentation

    h
    #define LV_USE_PERF_MONITOR 1
    #define LV_USE_MEM_MONITOR 1

For 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:

h
/*Enable the log module*/
#define LV_USE_LOG 1

By 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 .pio directory so the libraries will be rebuild.

Step 6: Copy the build flags below in your project

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:

ini
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:

ini
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE

The -Wall flag can also be removed but outputs all the warnings.

Step 7: Initialize the display (and touch) in your project

To enable to display in your project call the void smartdisplay_init() function at startup and optionally set the orientation:

cpp
#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:

cpp
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();
}

Step 8 (Optional): Create your LVGL file or use SquareLine Studio to make a design

There is a good UI designer available for LVGL and free

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Carduinocydesp32esp32-2424s12

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库