IDF配置LVGL8.3
下載LVGL源碼
LVGL GITHUB代碼倉庫如下:https://github.com/lvgl/lvgl/tree/release/v8.3
官方已經(jīng)在ESP32上移植好的代碼demo,目前最新版是LVGL 7.9:https://github.com/lvgl/lv_port_esp32
我們可以將LVGL官方配置好的ESP32 LVGL倉庫下載下來,直接編譯作為工程使用:
不出問題,可以直接編譯成功,如下圖:
如果對LVGL版本沒要求,就可以直接在這個(gè)工程上面添加代碼。
如果是要在現(xiàn)有工程中添加LVGL指定版本,這種方法則不行。官網(wǎng)給的配置流程如下:
首先我們從IDF的例程代碼里拷貝過來一個(gè)空白hello_world工程:
我們將本文件夾創(chuàng)建為一個(gè)git倉庫,然后打開git bash,執(zhí)行以下指令,將相應(yīng)版本的LVGL代碼添加到本工程的components中:
git clone -b v8.3.8 --depth 1 git@github.com:lvgl/lvgl.git components/lvgl
通過IDF的menuconfig配置LVGL
然后運(yùn)行idf cmd進(jìn)入到此文件夾,運(yùn)行idf.py menuconfig
然后進(jìn)入Component config -> LVGL configuration去配置 LVGL.
然后按S保存并退出:
然后,我將LVGL ESP32的驅(qū)動(dòng)作為子模塊添加到本工程中,其支持的屏幕驅(qū)動(dòng)芯片如下:
我們運(yùn)行以下命令:
git submodule add https://github.com/lvgl/lvgl_esp32_drivers.git components/lvgl_esp32_drivers
然后,運(yùn)行idf.py menuconfig
在Component config -> LVGL ESP Drivers -> LVGL TFT Display controller配置 lvgl_esp32_drivers:
在menuconfig中配置驅(qū)動(dòng)屏幕的引腳
配置驅(qū)動(dòng)屏幕的SPI引腳:
在main.c文件中編輯如下:
#include "lvgl.h"
// #include "driver.h"
#include "demo.h"
int app_main(void)
{
lv_init();
/* Initialize your hardware. */
/* hw_init(); */
demo_create();
/* Create the UI or start a task for it.
* In the end, don't forget to call `lv_task_handler` in a loop. */
/* hw_loop(); */
return 0;
}
LVGL可視化設(shè)計(jì)
Squareline Studio
Squareline Studio是LVGL官網(wǎng)推薦使用的可視化設(shè)計(jì)助手
也配有許多例程代碼:
Squareline Studio下載鏈接如下:https://squareline.io/
安裝好后有30天的試用期。官網(wǎng)教程鏈接如下:https://docs.squareline.io/docs/squareline/
我們選擇一個(gè)例程并創(chuàng)建:
然后點(diǎn)擊左上角File->Project Settings設(shè)置文件輸出格式及保存的位置。點(diǎn)擊菜單欄Export->Export File選擇導(dǎo)出文件的格式。文章來源:http://www.zghlxwxcb.cn/news/detail-554656.html
參考鏈接
LVGL官網(wǎng)ESP32移植LVGL倉庫
LVGL源碼倉庫
ESP32配置LVGL并設(shè)計(jì)UI
LVGL顯示圖片
LVGL官網(wǎng)
Squareline Studio介紹
Squareline studio使用
LVGL官方文檔文章來源地址http://www.zghlxwxcb.cn/news/detail-554656.html
到了這里,關(guān)于ESP32開發(fā):IDFV4.4配置LVGL8.3的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!