一. LVGL模擬器是什么?
就是可以在PC跑LVGL,不依賴于任何嵌入式設備(STM32/樹莓派/.....等等等等)
可以支持以下IDE(可點擊進入LVGL不同模擬器倉庫):
The simulator is ported to various IDEs (Integrated Development Environments). Choose your favorite IDE, read its README on GitHub, download the project, and load it to the IDE.
-
Eclipse with SDL driver: Recommended on Linux and Mac
-
CodeBlocks: Recommended on Windows
-
VisualStudio with SDL driver: For Windows
-
VSCode with SDL driver: Recommended on Linux and Mac
-
PlatformIO with SDL driver: Recommended on Linux and Mac
You can use any IDEs for the development but, for simplicity, the configuration for Eclipse CDT is focused in this tutorial. The following section describes the set-up guide of Eclipse CDT in more details.
Note: If you are on Windows, it's usually better to use the Visual Studio or CodeBlocks projects instead. They work out of the box without requiring extra steps.
二. LVGL模擬器有什么優勢?
官方(https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html?highlight=visual%20studio#select-an-ide)說的很明白:
Simulator on the PC have the following advantages:
-
Hardware independent - Write a code, run it on the PC and see the result on the PC monitor.
-
Cross-platform - Any Windows, Linux or OSX PC can run the PC simulator.
-
Portability - the written code is portable, which means you can simply copy it when using an embedded hardware.
-
Easy Validation - The simulator is also very useful to report bugs because it means common platform for every user. So it's a good idea to reproduce a bug in simulator and use the code snippet in the Forum.
三. 怎樣在Visual Studio跑起來LVGL
1.前提條件:
1) 電腦安裝了git
2) 電腦安裝了VS2019(Github倉庫說強烈建議2019,但是他說2017也可以,But,我自己試過2017有變異錯誤,懶得去查為啥了,所以直接安裝2019吧)
2. 使用步驟:
步驟一:敲以下命令(把倉庫的code clone下來,由于有自倉庫,所以還不能直接在github download code.zip)
git clone --recurse-submodules https://github.com/lvgl/lv_sim_visual_studio.git
步驟二: 使用工程,此部分有兩個工程,一個是SDL,一個是基于Win32的,我們來分別說下
1. 使用SDL工程
打開lv_sim_visual_studio\lv_sim下的lv_sim_visual_studio_sdl.sln工程
打開后有一個注意的點:要把平臺根據你的電腦是32bit還是64bit設定為x86或者x64,我是64bit的,所以設定為x64

然后就可以直接運行了,效果如下:

2. 使用Win32工程
打開Llv_sim_visual_studio下的LVGL.sln工程
打開后有兩個注意的點:
1)要把平臺根據你的電腦是32bit還是64bit設定為x86或者x64,我是64bit的,所以設定為x64

2)設定啟動項為如下,否則運行運行不了

然后就啥代碼也不用改,就直接可以運行起來啦,效果圖

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/258811.html
標籤:其他
