How to use LVGL in Arduino

发布于 2023-08-14 22:05:09

Hello! Today I will tell you how to use LVGL in your arduino projects simply.
You must take a few steps:
1.Update your Arduino core to version 0.0.5
2.Add these definitions to the inttypes.h file

#define PRId32 "d"
#define PRIu32 "u"

3.
Download the LVGL library through the library manager in the Arduino IDE
image.png

4.Prepare LVGL for work according to the instructions https://docs.lvgl.io/latest/en/html/get-started/arduino.html#configure-lvgl exclude these points image.png

5.Take this sketch as a test
w80x_test_lvgl.zip

The sketch uses the screen driver that I posted in the dialog
http://ask.winnermicro.com/question/692.html
ILI9341_Fast_SDIO_SPI.zip - Download it. Connect the display to the board as described in this sketch.
If all the steps are completed, you will receive a picture on the screen
输入链接说明

If you have any difficulties - ask me

PS...

Let's check the performance of LVGL

To do this, insert the header file in w80x_test_lvgl.ino

#include "demos/lv_demos.h"

Don't forget to follow the recommendation
You also need to copy lvgl/examples to lvgl/src/examples. Similarly for the demos lvgl/demos to lvgl/src/demos.
In lv_conf.h set parameter
/Benchmark your system/

#define LV_USE_DEMO_BENCHMARK 0 to 1

Commenting out a block of code
/ Create simple label /
Add a function call
lv_demo_benchmark();
And you can see how slowly it works. :)
It's not a problem! The bottleneck is the screen driver and the drawing method written in the my_disp_flush() function.

Let's start optimization...

PPS.
So, we figured out the driver for Arduino which is an adapted simple version of the code provided by the isme expert. I uploaded a test sketch in the comments to this article. It even works stably :) with FPS about 23-25
Your next step, in order to use the LVGL library very easily, should be to study SquareLine_Studio :) You must learn how to drag-and-drop widgets and learn how to bind events to them. After this. your chakras will open and rapid growth in the embedder’s career is expected!
Looking ahead, I will say that working with SquareLine_Studio is no more difficult than qtDesigner. As a result, this system generates for us a project designed for an esp32 board:
image.png
It is enough to replace the screen driver and touch panel and delete the eTFT folder, and the project can be compiled and uploaded in Arduino framework to the w80x chip.
image.png
They write that using Studio is free for schoolchildren, students and pensioners :)

10 条评论

发布
问题