LVGL - Demo
Overview#
The previous chapters introduced the advantages of LVGL in embedded GUI development, as well as the workflow and common widgets of LVGL.
This chapter introduces how to quickly get started with Quecpython LVGL and develop a GUI application with no experience.
Set Up Environment#
Hardware Preparation#
EVB: LTE OPEN-EVB_V1.1 and EC600U-EU_AB TE-A
LCD: ST7789 240*320
Download Firmware#
Please go to QuecPython-Download to download the official firmware for EC600U-EU_AB.
Hardware Connection#
Connect the LCD to the LCD interface of the EVB, and connect the EVB to the computer via a USB cable. Long press the "PWRKEY" to power on the EVB, as shown in the following figure.
Flash Firmware#
Flash the firmware by using QPYcom (Click here to download QPYcom).
Write Script#
Click here to download the application code.
Initialize LCD#
For the initialization of LCD, see machine LCD.
Here takes an ST7789 LCD with a resolution of 240*320 as an example. The following is the code for LCD initialization:
Initialize LVGL#
Register Display Driver#
Start LVGL Thread#
Set the heartbeat of LVGL and start the LVGL thread.
At this point, we have completed the initialization and can start writing the main code for the GUI interface.
Create Interface#
Create a basic LVGL (i.e., interface) with no parent class.
Create Image#
Create an image widget with the LVGL interface created earlier as the parent, and set the position and image source.
Create Label#
Create a label widget with the LVGL interface created earlier as the parent, and set the text and position.
Load Screen#
Verification#
Download the script to the module and run it. You will see the display interface of the LCD, as shown in the following figure.