Levi52's Blog
- ESP32S3-输入设备Keypad + ESP32S3-输入设备Keypad
发表于 - +
@@ -276,7 +284,7 @@无触摸,使用按键来控制屏幕控件
@@ -307,7 +315,7 @@
-
+
@@ -325,19 +333,27 @@
- GitHub Profile
+ GitHub Profile
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -381,7 +397,7 @@
GitHub Profile 设置
@@ -412,7 +428,7 @@
-
+
@@ -430,10 +446,12 @@
- 安信可Ai-M61-32S环境搭建 + 点灯
+ 安信可Ai-M61-32S环境搭建 + 点灯
+
+
@@ -448,7 +466,7 @@
更新于
-
+
@@ -492,7 +510,7 @@
安信可Ai-M61-32S Windows环境搭建 + 点灯
@@ -523,7 +541,7 @@
-
+
@@ -541,10 +559,12 @@
- ESP32S3N8R8 + Squareline_Studio设计移植
+ ESP32S3N8R8 + Squareline_Studio设计移植
+
+
@@ -559,7 +579,7 @@
更新于
-
+
@@ -603,7 +623,7 @@
使用Squareline_Studio设计UI移植到ESP32S3N8R8
@@ -634,7 +654,7 @@
-
+
@@ -652,10 +672,12 @@
- ESP32S3N8R8 + lvgl测试官方案例
+ ESP32S3N8R8 + lvgl测试官方案例
+
+
@@ -670,7 +692,7 @@
更新于
-
+
@@ -714,7 +736,7 @@
lvgl官方案例配置测试
@@ -745,7 +767,7 @@
-
+
@@ -763,19 +785,27 @@
- Hello World
+ Hello World
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -806,7 +836,7 @@
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
@@ -242,7 +244,7 @@ Squareline Studio
@@ -359,6 +361,7 @@ Squareline Studio
+
diff --git a/tags/icon/index.html b/tags/icon/index.html
index 7896de5..9379bfa 100644
--- a/tags/icon/index.html
+++ b/tags/icon/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ icon
@@ -339,6 +341,7 @@ icon
+
diff --git a/tags/index.html b/tags/index.html
index 5999f14..0868128 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
tags | Levi52's Blog
@@ -335,6 +337,7 @@ tags
+
diff --git a/tags/lvgl/index.html b/tags/lvgl/index.html
index 52f7595..c139899 100644
--- a/tags/lvgl/index.html
+++ b/tags/lvgl/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ lvgl
@@ -242,7 +244,7 @@ lvgl
@@ -262,7 +264,7 @@ lvgl
@@ -379,6 +381,7 @@ lvgl
+
diff --git "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html" "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
index a0b2725..4cda87a 100644
--- "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
+++ "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 多功能开关
@@ -339,6 +341,7 @@ 多功能开关
+
diff --git "a/tags/\345\256\211\344\277\241\345\217\257/index.html" "b/tags/\345\256\211\344\277\241\345\217\257/index.html"
index 00937e4..7e2da5d 100644
--- "a/tags/\345\256\211\344\277\241\345\217\257/index.html"
+++ "b/tags/\345\256\211\344\277\241\345\217\257/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 安信可
@@ -339,6 +341,7 @@ 安信可
+
diff --git "a/tags/\347\202\271\347\201\257/index.html" "b/tags/\347\202\271\347\201\257/index.html"
index e33e42a..9055965 100644
--- "a/tags/\347\202\271\347\201\257/index.html"
+++ "b/tags/\347\202\271\347\201\257/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 点灯
@@ -339,6 +341,7 @@ 点灯
+
diff --git "a/tags/\347\216\257\345\242\203\346\220\255\345\273\272/index.html" "b/tags/\347\216\257\345\242\203\346\220\255\345\273\272/index.html"
index 2db3a4f..5f499e7 100644
--- "a/tags/\347\216\257\345\242\203\346\220\255\345\273\272/index.html"
+++ "b/tags/\347\216\257\345\242\203\346\220\255\345\273\272/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 环境搭建
@@ -339,6 +341,7 @@ 环境搭建
+
diff --git "a/tags/\347\253\213\345\210\233/index.html" "b/tags/\347\253\213\345\210\233/index.html"
index 399b3a1..2e59134 100644
--- "a/tags/\347\253\213\345\210\233/index.html"
+++ "b/tags/\347\253\213\345\210\233/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 立创
- GitHub Profile + GitHub Profile
GitHub Profile 设置
@@ -412,7 +428,7 @@
-
+
@@ -430,10 +446,12 @@
- 安信可Ai-M61-32S环境搭建 + 点灯
+ 安信可Ai-M61-32S环境搭建 + 点灯
+
+
@@ -448,7 +466,7 @@
更新于
-
+
@@ -492,7 +510,7 @@
安信可Ai-M61-32S Windows环境搭建 + 点灯
@@ -523,7 +541,7 @@
-
+
@@ -541,10 +559,12 @@
- ESP32S3N8R8 + Squareline_Studio设计移植
+ ESP32S3N8R8 + Squareline_Studio设计移植
+
+
@@ -559,7 +579,7 @@
更新于
-
+
@@ -603,7 +623,7 @@
使用Squareline_Studio设计UI移植到ESP32S3N8R8
@@ -634,7 +654,7 @@
-
+
@@ -652,10 +672,12 @@
- ESP32S3N8R8 + lvgl测试官方案例
+ ESP32S3N8R8 + lvgl测试官方案例
+
+
@@ -670,7 +692,7 @@
更新于
-
+
@@ -714,7 +736,7 @@
lvgl官方案例配置测试
@@ -745,7 +767,7 @@
-
+
@@ -763,19 +785,27 @@
- Hello World
+ Hello World
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -806,7 +836,7 @@
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
@@ -242,7 +244,7 @@ Squareline Studio
@@ -359,6 +361,7 @@ Squareline Studio
+
diff --git a/tags/icon/index.html b/tags/icon/index.html
index 7896de5..9379bfa 100644
--- a/tags/icon/index.html
+++ b/tags/icon/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ icon
@@ -339,6 +341,7 @@ icon
+
diff --git a/tags/index.html b/tags/index.html
index 5999f14..0868128 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
tags | Levi52's Blog
@@ -335,6 +337,7 @@ tags
+
diff --git a/tags/lvgl/index.html b/tags/lvgl/index.html
index 52f7595..c139899 100644
--- a/tags/lvgl/index.html
+++ b/tags/lvgl/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ lvgl
@@ -242,7 +244,7 @@ lvgl
@@ -262,7 +264,7 @@ lvgl
@@ -379,6 +381,7 @@ lvgl
+
diff --git "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html" "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
index a0b2725..4cda87a 100644
--- "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
+++ "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 多功能开关
@@ -339,6 +341,7 @@ 多功能开关
+
diff --git "a/tags/\345\256\211\344\277\241\345\217\257/index.html" "b/tags/\345\256\211\344\277\241\345\217\257/index.html"
index 00937e4..7e2da5d 100644
--- "a/tags/\345\256\211\344\277\241\345\217\257/index.html"
+++ "b/tags/\345\256\211\344\277\241\345\217\257/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 安信可
@@ -339,6 +341,7 @@ 安信可
+
diff --git "a/tags/\347\202\271\347\201\257/index.html" "b/tags/\347\202\271\347\201\257/index.html"
index e33e42a..9055965 100644
--- "a/tags/\347\202\271\347\201\257/index.html"
+++ "b/tags/\347\202\271\347\201\257/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 点灯
- 安信可Ai-M61-32S环境搭建 + 点灯 + 安信可Ai-M61-32S环境搭建 + 点灯
更新于 - + @@ -492,7 +510,7 @@
安信可Ai-M61-32S Windows环境搭建 + 点灯
@@ -523,7 +541,7 @@
-
+
@@ -541,10 +559,12 @@
- ESP32S3N8R8 + Squareline_Studio设计移植
+ ESP32S3N8R8 + Squareline_Studio设计移植
+
+
@@ -559,7 +579,7 @@
更新于
-
+
@@ -603,7 +623,7 @@
使用Squareline_Studio设计UI移植到ESP32S3N8R8
@@ -634,7 +654,7 @@
-
+
@@ -652,10 +672,12 @@
- ESP32S3N8R8 + lvgl测试官方案例
+ ESP32S3N8R8 + lvgl测试官方案例
+
+
@@ -670,7 +692,7 @@
更新于
-
+
@@ -714,7 +736,7 @@
lvgl官方案例配置测试
@@ -745,7 +767,7 @@
-
+
@@ -763,19 +785,27 @@
- Hello World
+ Hello World
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -806,7 +836,7 @@
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
@@ -242,7 +244,7 @@ Squareline Studio
@@ -359,6 +361,7 @@ Squareline Studio
+
diff --git a/tags/icon/index.html b/tags/icon/index.html
index 7896de5..9379bfa 100644
--- a/tags/icon/index.html
+++ b/tags/icon/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ icon
@@ -339,6 +341,7 @@ icon
+
diff --git a/tags/index.html b/tags/index.html
index 5999f14..0868128 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
tags | Levi52's Blog
@@ -335,6 +337,7 @@ tags
+
diff --git a/tags/lvgl/index.html b/tags/lvgl/index.html
index 52f7595..c139899 100644
--- a/tags/lvgl/index.html
+++ b/tags/lvgl/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ lvgl
@@ -242,7 +244,7 @@ lvgl
@@ -262,7 +264,7 @@ lvgl
@@ -379,6 +381,7 @@ lvgl
+
diff --git "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html" "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
index a0b2725..4cda87a 100644
--- "a/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
+++ "b/tags/\345\244\232\345\212\237\350\203\275\345\274\200\345\205\263/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 多功能开关
- ESP32S3N8R8 + Squareline_Studio设计移植 + ESP32S3N8R8 + Squareline_Studio设计移植
更新于 - + @@ -603,7 +623,7 @@
使用Squareline_Studio设计UI移植到ESP32S3N8R8
@@ -634,7 +654,7 @@
-
+
@@ -652,10 +672,12 @@
- ESP32S3N8R8 + lvgl测试官方案例
+ ESP32S3N8R8 + lvgl测试官方案例
+
+
@@ -670,7 +692,7 @@
更新于
-
+
@@ -714,7 +736,7 @@
lvgl官方案例配置测试
@@ -745,7 +767,7 @@
-
+
@@ -763,19 +785,27 @@
- Hello World
+ Hello World
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -806,7 +836,7 @@
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
@@ -242,7 +244,7 @@ Squareline Studio
@@ -359,6 +361,7 @@ Squareline Studio
+
diff --git a/tags/icon/index.html b/tags/icon/index.html
index 7896de5..9379bfa 100644
--- a/tags/icon/index.html
+++ b/tags/icon/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ icon
@@ -339,6 +341,7 @@ icon
+
diff --git a/tags/index.html b/tags/index.html
index 5999f14..0868128 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
tags | Levi52's Blog
@@ -335,6 +337,7 @@ tags
+
diff --git a/tags/lvgl/index.html b/tags/lvgl/index.html
index 52f7595..c139899 100644
--- a/tags/lvgl/index.html
+++ b/tags/lvgl/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ lvgl
@@ -242,7 +244,7 @@ lvgl
- ESP32S3N8R8 + lvgl测试官方案例 + ESP32S3N8R8 + lvgl测试官方案例
更新于 - + @@ -714,7 +736,7 @@
lvgl官方案例配置测试
@@ -745,7 +767,7 @@
-
+
@@ -763,19 +785,27 @@
- Hello World
+ Hello World
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -806,7 +836,7 @@
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
@@ -242,7 +244,7 @@ Squareline Studio
@@ -359,6 +361,7 @@ Squareline Studio
+
diff --git a/tags/icon/index.html b/tags/icon/index.html
index 7896de5..9379bfa 100644
--- a/tags/icon/index.html
+++ b/tags/icon/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ icon
- Hello World + Hello World
hexo blog
@@ -932,6 +962,7 @@
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png" b/posts/17ee55dc/boot.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/boot.png"
rename to posts/17ee55dc/boot.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png" b/posts/17ee55dc/copy.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/copy.png"
rename to posts/17ee55dc/copy.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif" b/posts/17ee55dc/download.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/download.gif"
rename to posts/17ee55dc/download.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png" b/posts/17ee55dc/downloaded.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/downloaded.png"
rename to posts/17ee55dc/downloaded.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png" b/posts/17ee55dc/edit1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit1.png"
rename to posts/17ee55dc/edit1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png" b/posts/17ee55dc/edit2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit2.png"
rename to posts/17ee55dc/edit2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png" b/posts/17ee55dc/edit3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/edit3.png"
rename to posts/17ee55dc/edit3.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png" b/posts/17ee55dc/env.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env.png"
rename to posts/17ee55dc/env.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png" b/posts/17ee55dc/env1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env1.png"
rename to posts/17ee55dc/env1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png" b/posts/17ee55dc/env2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/env2.png"
rename to posts/17ee55dc/env2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png" b/posts/17ee55dc/error1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/error1.png"
rename to posts/17ee55dc/error1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif" b/posts/17ee55dc/gitee.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.gif"
rename to posts/17ee55dc/gitee.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png" b/posts/17ee55dc/gitee.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/gitee.png"
rename to posts/17ee55dc/gitee.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html" b/posts/17ee55dc/index.html
similarity index 74%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
rename to posts/17ee55dc/index.html
index 7fbf005..ba62bda 100644
--- "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/index.html"
+++ b/posts/17ee55dc/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,55 +17,57 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
安信可Ai-M61-32S环境搭建 + 点灯 | Levi52's Blog
@@ -233,7 +235,7 @@
-
+
@@ -255,6 +257,8 @@
+
+
@@ -269,7 +273,7 @@
更新于
-
+
@@ -322,35 +326,35 @@ 二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1
git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从gitee
克隆仓库
-
+
等待下载,完成如下图所示
-
+
三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
+
+
2. 拉取文件
继续输入如下命令
1
2
3
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
+
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1
2
3
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
+
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
+
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
+
在弹出的窗口中选择系统变量里的Path
,点击编辑
-
+
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1
2
3
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
+
添加完成后,如下图
-
+
注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
@@ -360,30 +364,30 @@ 3
1
riscv64-unknown-elf-gcc -v
成功时,输出如下图
-
+
六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
+
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
+
2. 编译程序
输入make
命令
-
+
3. 处理报错
编译报错
-
+
根据报错,打开如下文件
-
+
注释掉如下两行代码,然后再次执行make
指令
-
-
+
+
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
+
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1
make flash COMX=COM19
-
+
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-八、效果演示
+
+八、效果演示
END
2024 Levi5
@@ -401,7 +405,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/安信可Ai-M61-32S环境搭建-点灯/
+ http://example.com/posts/17ee55dc/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -424,12 +428,12 @@ END
@@ -545,6 +549,7 @@ END
+
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif" b/posts/17ee55dc/led.gif
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/led.gif"
rename to posts/17ee55dc/led.gif
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png" b/posts/17ee55dc/paste.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/paste.png"
rename to posts/17ee55dc/paste.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png" b/posts/17ee55dc/powershell.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/powershell.png"
rename to posts/17ee55dc/powershell.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png" b/posts/17ee55dc/serial.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/serial.png"
rename to posts/17ee55dc/serial.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png" b/posts/17ee55dc/submodule1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule1.png"
rename to posts/17ee55dc/submodule1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png" b/posts/17ee55dc/submodule2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/submodule2.png"
rename to posts/17ee55dc/submodule2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png" b/posts/17ee55dc/success.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/success.png"
rename to posts/17ee55dc/success.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png" b/posts/17ee55dc/sysenv.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/sysenv.png"
rename to posts/17ee55dc/sysenv.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png" b/posts/17ee55dc/toolchain.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/toolchain.png"
rename to posts/17ee55dc/toolchain.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png" b/posts/17ee55dc/vscode1.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode1.png"
rename to posts/17ee55dc/vscode1.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png" b/posts/17ee55dc/vscode2.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode2.png"
rename to posts/17ee55dc/vscode2.png
diff --git "a/2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png" b/posts/17ee55dc/vscode3.png
similarity index 100%
rename from "2024/05/15/\345\256\211\344\277\241\345\217\257Ai-M61-32S\347\216\257\345\242\203\346\220\255\345\273\272-\347\202\271\347\201\257/vscode3.png"
rename to posts/17ee55dc/vscode3.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png" b/posts/2c4e27ec/ADDTFT.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/ADDTFT.png"
rename to posts/2c4e27ec/ADDTFT.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png" b/posts/2c4e27ec/TFTINSTALL.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALL.png"
rename to posts/2c4e27ec/TFTINSTALL.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png" b/posts/2c4e27ec/TFTINSTALLED.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFTINSTALLED.png"
rename to posts/2c4e27ec/TFTINSTALLED.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png" b/posts/2c4e27ec/TFT_eSPI.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/TFT_eSPI.png"
rename to posts/2c4e27ec/TFT_eSPI.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png" b/posts/2c4e27ec/bb_captouch.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/bb_captouch.png"
rename to posts/2c4e27ec/bb_captouch.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png" b/posts/2c4e27ec/image-20240410132437581.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132437581.png"
rename to posts/2c4e27ec/image-20240410132437581.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png" b/posts/2c4e27ec/image-20240410132701414.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132701414.png"
rename to posts/2c4e27ec/image-20240410132701414.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png" b/posts/2c4e27ec/image-20240410132744241.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410132744241.png"
rename to posts/2c4e27ec/image-20240410132744241.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png" b/posts/2c4e27ec/image-20240410134038409.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134038409.png"
rename to posts/2c4e27ec/image-20240410134038409.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png" b/posts/2c4e27ec/image-20240410134339063.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/image-20240410134339063.png"
rename to posts/2c4e27ec/image-20240410134339063.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html" b/posts/2c4e27ec/index.html
similarity index 90%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
rename to posts/2c4e27ec/index.html
index bbc5e23..09c2aa9 100644
--- "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/index.html"
+++ b/posts/2c4e27ec/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,34 +17,36 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -53,14 +55,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + lvgl测试官方案例 | Levi52's Blog
@@ -228,7 +230,7 @@
-
+
@@ -250,6 +252,8 @@
+
+
@@ -264,7 +268,7 @@
更新于
-
+
@@ -318,21 +322,21 @@ 硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
@@ -467,7 +471,7 @@ END
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-lvgl测试官方案例/
+ http://example.com/posts/2c4e27ec/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -494,12 +498,12 @@ END
-
+
Hello World
@@ -615,6 +619,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png" b/posts/2c4e27ec/load.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/load.png"
rename to posts/2c4e27ec/load.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png" b/posts/2c4e27ec/lvconf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvconf.png"
rename to posts/2c4e27ec/lvconf.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png" b/posts/2c4e27ec/lvgl.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvgl.png"
rename to posts/2c4e27ec/lvgl.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png" b/posts/2c4e27ec/lvglinstall.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstall.png"
rename to posts/2c4e27ec/lvglinstall.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png" b/posts/2c4e27ec/lvglinstalled.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/lvglinstalled.png"
rename to posts/2c4e27ec/lvglinstalled.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png" b/posts/2c4e27ec/open.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/open.png"
rename to posts/2c4e27ec/open.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png" b/posts/2c4e27ec/opensetup.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/opensetup.png"
rename to posts/2c4e27ec/opensetup.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png" b/posts/2c4e27ec/pos.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/pos.png"
rename to posts/2c4e27ec/pos.png
diff --git "a/2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png" b/posts/2c4e27ec/project.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-lvgl\346\265\213\350\257\225\345\256\230\346\226\271\346\241\210\344\276\213/project.png"
rename to posts/2c4e27ec/project.png
diff --git a/2024/05/15/hello-world/index.html b/posts/4a17b156/index.html
similarity index 87%
rename from 2024/05/15/hello-world/index.html
rename to posts/4a17b156/index.html
index efba704..d0d2f38 100644
--- a/2024/05/15/hello-world/index.html
+++ b/posts/4a17b156/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,28 +17,30 @@
+
+
-
+
-
+
-
+
-
+
-
+
Hello World | Levi52's Blog
@@ -206,7 +208,7 @@
-
+
@@ -228,15 +230,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -301,7 +311,7 @@
本文链接:
- https://levi52.github.io/2024/05/15/hello-world/
+ http://example.com/posts/4a17b156/
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -316,7 +326,7 @@
@@ -432,6 +442,7 @@
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
@@ -379,6 +381,7 @@ ESP32
+
diff --git a/tags/GitHub/index.html b/tags/GitHub/index.html
index 662d0ed..0669ab7 100644
--- a/tags/GitHub/index.html
+++ b/tags/GitHub/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ GitHub
@@ -339,6 +341,7 @@ GitHub
+
diff --git a/tags/PlatformIO/index.html b/tags/PlatformIO/index.html
index 2b8cd26..e30ca29 100644
--- a/tags/PlatformIO/index.html
+++ b/tags/PlatformIO/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ PlatformIO
@@ -242,7 +244,7 @@ PlatformIO
@@ -262,7 +264,7 @@ PlatformIO
@@ -379,6 +381,7 @@ PlatformIO
+
diff --git a/tags/Squareline-Studio/index.html b/tags/Squareline-Studio/index.html
index 016b9c1..37cf7bf 100644
--- a/tags/Squareline-Studio/index.html
+++ b/tags/Squareline-Studio/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Squareline Studio
更新于 - + @@ -322,35 +326,35 @@
二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
1 | git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master |
开始从gitee
克隆仓库
等待下载,完成如下图所示
- +三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
2. 拉取文件
继续输入如下命令
1 | cd AiPi-Open-Kits/ |
四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
1 | cd aithinker_Ai-M6X_SDK/ |
2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
1 | git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master |
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
- +在弹出的窗口中选择系统变量里的Path
,点击编辑
2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
1 | aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin |
添加完成后,如下图
- +注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
3. 验证
验证配置是否成功
在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
3
1
riscv64-unknown-elf-gcc -v
1 | riscv64-unknown-elf-gcc -v |
成功时,输出如下图
- +六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
2. 编译程序
输入make
命令
3. 处理报错
编译报错
- +根据报错,打开如下文件
- +注释掉如下两行代码,然后再次执行make
指令
七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
1 | make flash COMX=COM19 |
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
- -八、效果演示
+ +八、效果演示
END
END
END
END
更新于 - + @@ -318,21 +322,21 @@
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
新建工程
-点击侧边PlatformIO
插件,新建工程
+点击侧边PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
+依次设置工程名,开发板,框架
屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
+添加TFT_eSPI到工程
-打开配置文件,可以看到已成功添加库
+打开配置文件,可以看到已成功添加库
修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
@@ -353,19 +357,19 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
下载调试
-编译下载
+编译下载
根据屏幕显示情况修改User_Setup.h
文件
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1
2
3
4
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1
2
3
4
// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
+修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
修改main.cpp
添加头文件
1
#include <bb_captouch.h>
@@ -442,13 +446,13 @@
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
触摸显示效果如下图所示
+编译下载
触摸显示效果如下图所示
END
2024 Levi5
点击侧边PlatformIO
插件,新建工程
点击侧边PlatformIO
插件,新建工程
依次设置工程名,开发板,框架
依次设置工程名,开发板,框架
添加屏幕驱动库TFT_eSPI
,按如下图顺序
添加屏幕驱动库TFT_eSPI
,按如下图顺序
添加TFT_eSPI到工程
添加TFT_eSPI到工程
打开配置文件,可以看到已成功添加库
打开配置文件,可以看到已成功添加库
打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
根据屏幕驱动芯片解注释
1 | #include <Arduino.h> |
下载调试
-
-
编译下载
+编译下载
根据屏幕显示情况修改
User_Setup.h
文件
如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
1 | // If colours are inverted (white shows as black) then uncomment one of the next |
修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
1 | // For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display |
修改后,如下图所示,RGB顺序正常
修改后,如下图所示,RGB顺序正常
LVGL测试
添加LVGL
-
-
根据实际情况,选择lvgl版本
+
![](lvglinstall.png” style=”zoom:67%;” >根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
@@ -425,8 +429,8 @@
修改完成
最终main.cpp
文件内容如下
1 | #include <Arduino.h> |
编译下载
显示效果如下图
触摸测试
添加bb_captouch
+编译下载
显示效果如下图
触摸测试
添加bb_captouch
修改main.cpp
添加头文件
@@ -442,13 +446,13 @@1
#include <bb_captouch.h>
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
修改完成
最终main.cpp
文件内容如下
1 | #include <Arduino.h> |
编译下载
触摸显示效果如下图所示
编译下载
触摸显示效果如下图所示
END
END
END
END
本文链接: - https://levi52.github.io/2024/05/15/hello-world/ + http://example.com/posts/4a17b156/
diff --git a/2024/05/15/GitHub-Profile/GitHub-100000.svg b/posts/7f6b7f24/GitHub-100000.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/GitHub-100000.svg
rename to posts/7f6b7f24/GitHub-100000.svg
diff --git a/2024/05/15/GitHub-Profile/image-20240202114236931.png b/posts/7f6b7f24/image-20240202114236931.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240202114236931.png
rename to posts/7f6b7f24/image-20240202114236931.png
diff --git a/2024/05/15/GitHub-Profile/image-20240502212448655.png b/posts/7f6b7f24/image-20240502212448655.png
similarity index 100%
rename from 2024/05/15/GitHub-Profile/image-20240502212448655.png
rename to posts/7f6b7f24/image-20240502212448655.png
diff --git a/2024/05/15/GitHub-Profile/index.html b/posts/7f6b7f24/index.html
similarity index 95%
rename from 2024/05/15/GitHub-Profile/index.html
rename to posts/7f6b7f24/index.html
index 97188a8..2db9fcd 100644
--- a/2024/05/15/GitHub-Profile/index.html
+++ b/posts/7f6b7f24/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,21 +17,23 @@
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -213,19 +215,19 @@
-
+
-
+
-
+
-
+
GitHub Profile | Levi52's Blog
@@ -393,7 +395,7 @@
-
+
@@ -415,15 +417,23 @@
+
+
发表于
-
-
+
+
+
+
+
+
+ 更新于
+
@@ -485,9 +495,9 @@ shield图标
-
-
-
+
+
+
静态
badgeContent
string – REQUIRED
@@ -531,7 +541,7 @@ 静态
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@
-
本文链接:
- https://levi52.github.io/2024/05/15/GitHub-Profile/
+ http://example.com/posts/7f6b7f24/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/levi52.svg
rename to posts/7f6b7f24/levi52.svg
diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg
similarity index 100%
rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg
rename to posts/7f6b7f24/tool-pycharm-green.svg
diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
similarity index 100%
rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg"
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png"
rename to posts/b97be97c/S1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg"
rename to posts/b97be97c/S2.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg"
rename to posts/b97be97c/S3.jpg
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png"
rename to posts/b97be97c/Squareline.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png"
rename to posts/b97be97c/copy_file.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png"
rename to posts/b97be97c/export.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png"
rename to posts/b97be97c/file_folder.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png"
rename to posts/b97be97c/head.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html
similarity index 80%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
rename to posts/b97be97c/index.html
index 83e1e8e..f02e438 100644
--- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html"
+++ b/posts/b97be97c/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,8 @@
+
+
@@ -260,7 +264,7 @@
更新于
-
+
@@ -314,35 +318,35 @@
配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-Squareline Studio
设计UI
+Squareline Studio
设计UI
导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+导出文件
以下为Squareline Studio导出的文件
-移植文件
资源文件复制到src/lvgl_gui
+移植文件
资源文件复制到src/lvgl_gui
LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码
1
ui_init();
-
+
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
setup()
中创建任务
1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-编译下载
+编译下载
END
2024 Levi5
@@ -361,7 +365,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/
+ http://example.com/posts/b97be97c/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@ END
+
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png"
rename to posts/b97be97c/lvgl_conf.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png"
rename to posts/b97be97c/lvgl_test.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png"
rename to posts/b97be97c/project_setting.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png"
rename to posts/b97be97c/project_setting1.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png"
rename to posts/b97be97c/screen.png
diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png
similarity index 100%
rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png"
rename to posts/b97be97c/ui_init.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg"
rename to posts/c4d6bdd0/IMG_1963.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg"
rename to posts/c4d6bdd0/IMG_1964.jpg
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png"
rename to posts/c4d6bdd0/copy.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif"
rename to posts/c4d6bdd0/enter.gif
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png"
rename to posts/c4d6bdd0/export.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html
similarity index 93%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
rename to posts/c4d6bdd0/index.html
index 4226f53..237075e 100644
--- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html"
+++ b/posts/c4d6bdd0/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,29 +17,31 @@
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -49,14 +51,14 @@
-
+
-
+
-
+
ESP32S3-输入设备Keypad | Levi52's Blog
@@ -224,7 +226,7 @@
-
+
@@ -246,6 +248,12 @@
+
+
+ 置顶
+ |
+
+
@@ -254,7 +262,7 @@
发表于
-
+
@@ -306,14 +314,14 @@
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -324,7 +332,7 @@ 输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
1
2
3
4
5
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -343,9 +351,9 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
1
2
3
4
5
6
7
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -390,10 +398,10 @@ ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5
@@ -411,7 +419,7 @@ END
-
本文链接:
- https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/
+ http://example.com/posts/c4d6bdd0/
-
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
@@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@ END
+
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png"
rename to posts/c4d6bdd0/key.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png"
rename to posts/c4d6bdd0/key1.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png"
rename to posts/c4d6bdd0/keyd.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png"
rename to posts/c4d6bdd0/port.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png"
rename to posts/c4d6bdd0/screen.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png"
rename to posts/c4d6bdd0/setting.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png"
rename to posts/c4d6bdd0/sq.png
diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif
similarity index 100%
rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif"
rename to posts/c4d6bdd0/switch.gif
diff --git a/schedule/index.html b/schedule/index.html
index 3f6c156..51b7559 100644
--- a/schedule/index.html
+++ b/schedule/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
schedule | Levi52's Blog
@@ -328,6 +330,7 @@ schedule
+
diff --git a/search.xml b/search.xml
index ffc5102..a026400 100644
--- a/search.xml
+++ b/search.xml
@@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad
- /2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/
+ /posts/c4d6bdd0/
配置
硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline Studio
UI界面
使用Squareline Studio
设计如下简单界面
-
+
设置工程导出路径,然后导出文件
-
+
导出文件结构如下
-
+
PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
-
+
优化结构
VS Code
打开工程
为了让main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件
修改后screen.h
文件内容如下
@@ -25,7 +25,7 @@
输入设备
打开如下目录文件
-
+
打开lv_port_indev_template.c
文件后,可以看到一共有五种输入方式
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
@@ -44,9 +44,9 @@
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
-
+
原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
-
+
在screen.cpp
中最开始定义如下
static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7
@@ -91,10 +91,10 @@
#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
效果
修改程序后,编译烧录
-
-
-
-
+
+
+
+
END
2024 Levi5 ]]>
ESP32
@@ -111,378 +111,69 @@
- ESP32S3N8R8 + lvgl测试官方案例
- /2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/
- @TOC
-【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+ GitHub Profile
+ /posts/7f6b7f24/
+ GitHub 主页指南
+user_name: GitHub用户名(levi52)
-新建工程
-点击侧边PlatformIO
插件,新建工程
-
-依次设置工程名,开发板,框架
-
-
-屏幕测试
添加TFT_eSPI
-添加屏幕驱动库TFT_eSPI
,按如下图顺序
-
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
-修改TFT_eSPI
-打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-
-根据屏幕驱动芯片解注释
-
-
-// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
-
-
-- 根据屏幕大小设置宽高
-
-// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
-
-
-- 根据连线设置引脚
-
-// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
-
-修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
-
-下载调试
-编译下载
-
-根据屏幕显示情况修改User_Setup.h
文件
-
-
-如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
-// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
-修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
-// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
-修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
-
-添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
-
-
-修改LVGL
-打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
-将此文件重命名为lv_conf.h
-
-
-![](lvconf.png” style=”zoom:67%;” >
-
-- 使能lvgl
-
-/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
-
-
-- 设置周期
-
-默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
-/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
-
-
-- 心跳使能
-
-/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
-
-
-- 使能测试案例
-
-/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-更改文件路径
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-
-修改main.cpp
-将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
-
-- 设置头文件
-
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-- 设置宽高
-
-static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
+shield图标
+
+
+
+
+
+静态
-- 修改类型
-
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-- 注释掉触摸部分
-
-
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-编译下载
显示效果如下图
-触摸测试
添加bb_captouch
-修改main.cpp
-添加头文件
-#include <bb_captouch.h>
+badgeContent
string – REQUIRED
+标签, (可选) 信息, 颜色. -
连接
+示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string
+可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
+默认:flat
+示例:flat
-设置参数
-BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string
+可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
string
+logo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改my_touchpad_read
函数
-这里的x,y坐标需要根据实际情况修改
-
-/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
-修改完成
最终main.cpp
文件内容如下
-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
-
-编译下载
触摸显示效果如下图所示
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- 触摸屏
- 立创
-
-
-
- Hello World
- /2024/05/15/hello-world/
- Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-Quick Start
Create a new post
$ hexo new "My New Post"
-
-More info: Writing
-Run server
$ hexo server
-
-More info: Server
-Generate static files
$ hexo generate
-
-More info: Generating
-Deploy to remote sites
$ hexo deploy
-
-More info: Deployment
-]]>
-
-
- ESP32S3N8R8 + Squareline_Studio设计移植
- /2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/
-
-移植Squareline Studio到工程
-
-配置
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
-
-Squareline Studio
设计UI
-导出文件
-工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string
+左边文本
+示例:立创
-Export
+labelColor
string
+左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
-PlatformIO
文件结构
-导出文件
以下为Squareline Studio导出的文件
+color
string
+右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
资源文件复制到src/lvgl_gui
+cacheSeconds
string
+HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
-LVGL
-- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
-main
-添加头文件
-#include "ui.h"
-UI初始化
删去之前LVGL官方案例的内容,添加如下代码
-ui_init();
-
-
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-setup()
中创建任务
-xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
-编译下载
-END
2024 Levi5
-]]>
-
- ESP32
- 教程
-
-
- ESP32
- PlatformIO
- lvgl
- 2.8寸TFT
- Squareline Studio
- 触摸屏
- 立创
-
-
-
- 安信可Ai-M61-32S环境搭建 + 点灯
- /2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/
- 【祖传点灯】安信可Ai-M61-32S + 自由发挥
-一、软件安装
-二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
-开始从gitee
克隆仓库
-
-等待下载,完成如下图所示
-
-三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
-进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
-
-
-2. 拉取文件
继续输入如下命令
-cd AiPi-Open-Kits/
git submodule init
git submodule update
-
-
-四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
-
-
-2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
-
-
-五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
-
-在弹出的窗口中选择系统变量里的Path
,点击编辑
-
-2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
-
-
-添加完成后,如下图
-
-注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
-3. 验证
验证配置是否成功
-在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令
-make -v
-
-riscv64-unknown-elf-gcc -v
-
-成功时,输出如下图
-
-六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
-
-选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
-
-2. 编译程序
输入make
命令
-
-3. 处理报错
编译报错
-
-根据报错,打开如下文件
-
-注释掉如下两行代码,然后再次执行make
指令
-
-
-七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
-
-2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
-make flash COMX=COM19
-
-
-烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
-
-
-八、效果演示
-END
2024 Levi5 ]]>
-
- Ai-M61-32S
- 教程
-
-
- Ai-M61-32S
- 安信可
- 环境搭建
- 点灯
-
-
-
- GitHub Profile
- /2024/05/15/GitHub-Profile/
- GitHub 主页指南
-user_name: GitHub用户名(levi52)
-
-访问次数
![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-仓库状态
![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()
-
-shield图标
-
-
-
-
-
-静态
-
-badgeContent
string – REQUIRED
-标签, (可选) 信息, 颜色. -
连接
-示例:立创-EDA-#f7f7f7
-
-style
string
-可选参数:flat
,flat-square
,plastic
,for-the-badge
,social
-默认:flat
-示例:flat
-
-logo
string
-可选logo:simple-icons/slugs.md
-示例:easyeda
-
-logoColor
string
-logo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-label
string
-左边文本
-示例:立创
-
-labelColor
string
-左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-color
string
-右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-cacheSeconds
string
-HTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-link
string[]
-指定单击徽章的左/右链接。
-
+link
string[]
+指定单击徽章的左/右链接。
+
效果:
-
+
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@
icon
+
+ 安信可Ai-M61-32S环境搭建 + 点灯
+ /posts/17ee55dc/
+ 【祖传点灯】安信可Ai-M61-32S + 自由发挥
+一、软件安装
+二、克隆仓库
在项目文件夹右键,选择open git bash here
,输入如下指令
+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
+开始从gitee
克隆仓库
+
+等待下载,完成如下图所示
+
+三、拉取M61的SDK子模块
1. 修改文件
由于github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。
+进入 AiPi-Open-Kits
中,用文本打开 .gitmodules
文件 url 参数中的 github.com
改成 gitee.com
:
+
+
+2. 拉取文件
继续输入如下命令
+cd AiPi-Open-Kits/
git submodule init
git submodule update
+
+
+四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
+cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
+
+
+2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
+git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
+
+
+五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+
+在弹出的窗口中选择系统变量里的Path
,点击编辑
+
+2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
+aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
+
+
+添加完成后,如下图
+
+注意还需要把 aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层
+3. 验证
验证配置是否成功
+在桌面按住 shift
键点击 鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令
+make -v
+
+riscv64-unknown-elf-gcc -v
+
+成功时,输出如下图
+
+六、编译程序
1. 打开源码
使用VS Code
打开前面克隆的源码
+
+选择AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
+
+2. 编译程序
输入make
命令
+
+3. 处理报错
编译报错
+
+根据报错,打开如下文件
+
+注释掉如下两行代码,然后再次执行make
指令
+
+
+七、烧录程序
1. 查看端口
打开设备管理器
,查看端口
+
+2. 烧录
可以看到端口为COM19
,回到编辑器,在终端输入如下指令
+make flash COMX=COM19
+
+
+烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+
+
+八、效果演示
+END
2024 Levi5 ]]>
+
+ Ai-M61-32S
+ 教程
+
+
+ Ai-M61-32S
+ 安信可
+ 环境搭建
+ 点灯
+
+
+
+ ESP32S3N8R8 + Squareline_Studio设计移植
+ /posts/b97be97c/
+
+移植Squareline Studio到工程
+
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline Studio
+
+Squareline Studio
设计UI
+导出文件
+工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+
+Export
+
+
+PlatformIO
文件结构
+导出文件
以下为Squareline Studio导出的文件
+
+移植文件
资源文件复制到src/lvgl_gui
+
+
+LVGL
+- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
+main
+添加头文件
+#include "ui.h"
+UI初始化
删去之前LVGL官方案例的内容,添加如下代码
+ui_init();
+
+
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+setup()
中创建任务
+xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
+编译下载
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ Squareline Studio
+ 触摸屏
+ 立创
+
+
+
+ ESP32S3N8R8 + lvgl测试官方案例
+ /posts/2c4e27ec/
+ @TOC
+【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO
+
+新建工程
+点击侧边PlatformIO
插件,新建工程
+
+依次设置工程名,开发板,框架
+
+
+屏幕测试
添加TFT_eSPI
+添加屏幕驱动库TFT_eSPI
,按如下图顺序
+
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
+修改TFT_eSPI
+打开.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+
+根据屏幕驱动芯片解注释
+
+
+// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER
+
+
+- 根据屏幕大小设置宽高
+
+// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240
+
+
+- 根据连线设置引脚
+
+// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
+
+修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
+#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}
+
+下载调试
+编译下载
+
+根据屏幕显示情况修改User_Setup.h
文件
+
+
+如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
+// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF
+修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
+// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
+修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
+根据实际情况,选择lvgl版本
![](lvglinstall.png” style=”zoom:67%;” >
+
+添加lvgl到工程
![](lvglinstalled.png” style=”zoom:67%;” >
+
+
+修改LVGL
+打开.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件
+将此文件重命名为lv_conf.h
+
+
+![](lvconf.png” style=”zoom:67%;” >
+
+- 使能lvgl
+
+/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
+
+
+- 设置周期
+
+默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
输入设备读取周期毫秒
+/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/
+
+
+- 心跳使能
+
+/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
+
+
+- 使能测试案例
+
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif
+
+
+更改文件路径
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+
+修改main.cpp
+将.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制
+
+- 设置头文件
+
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
+
+
+- 设置宽高
+
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
+
+
+- 修改类型
+
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
+
+- 注释掉触摸部分
+
+
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+编译下载
显示效果如下图
+触摸测试
添加bb_captouch
+修改main.cpp
+添加头文件
+#include <bb_captouch.h>
+
+设置触摸芯片引脚
+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+
+设置参数
+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+
+初始化
+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+
+修改my_touchpad_read
函数
+这里的x,y坐标需要根据实际情况修改
+
+/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
+修改完成
最终main.cpp
文件内容如下
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}
+
+编译下载
触摸显示效果如下图所示
+END
2024 Levi5
+]]>
+
+ ESP32
+ 教程
+
+
+ ESP32
+ PlatformIO
+ lvgl
+ 2.8寸TFT
+ 触摸屏
+ 立创
+
+
+
+ Hello World
+ /posts/4a17b156/
+ Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+Quick Start
Create a new post
$ hexo new "My New Post"
+
+More info: Writing
+Run server
$ hexo server
+
+More info: Server
+Generate static files
$ hexo generate
+
+More info: Generating
+Deploy to remote sites
$ hexo deploy
+
+More info: Deployment
+]]>
+
diff --git a/sitemap/index.html b/sitemap/index.html
index 06fdc3e..0e512b4 100644
--- a/sitemap/index.html
+++ b/sitemap/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -34,11 +36,11 @@
-
+
-
+
sitemap | Levi52's Blog
@@ -328,6 +330,7 @@ sitemap
+
diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html"
index b8c8fa5..1365d4c 100644
--- "a/tags/2-8\345\257\270TFT/index.html"
+++ "b/tags/2-8\345\257\270TFT/index.html"
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ 2.8寸TFT
@@ -242,7 +244,7 @@ 2.8寸TFT
@@ -262,7 +264,7 @@ 2.8寸TFT
@@ -379,6 +381,7 @@ 2.8寸TFT
+
diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html
index d2792d0..d42fca1 100644
--- a/tags/Ai-M61-32S/index.html
+++ b/tags/Ai-M61-32S/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ Ai-M61-32S
@@ -339,6 +341,7 @@ Ai-M61-32S
+
diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html
index f867cd5..10520bf 100644
--- a/tags/ESP32/index.html
+++ b/tags/ESP32/index.html
@@ -6,9 +6,9 @@
-
-
-
+
+
+
@@ -17,13 +17,15 @@
+
+
-
+
-
+
@@ -32,7 +34,7 @@
-
+
@@ -222,7 +224,7 @@ ESP32
@@ -242,7 +244,7 @@ ESP32
@@ -262,7 +264,7 @@ ESP32
shield图标
- - - + + +静态
@@ -531,7 +541,7 @@badgeContent
string – REQUIRED静态
+效果:
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -732,7 +742,7 @@- 本文链接: - https://levi52.github.io/2024/05/15/GitHub-Profile/ + http://example.com/posts/7f6b7f24/
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处! @@ -751,12 +761,12 @@
@@ -872,6 +882,7 @@
diff --git a/2024/05/15/GitHub-Profile/levi52.svg b/posts/7f6b7f24/levi52.svg similarity index 100% rename from 2024/05/15/GitHub-Profile/levi52.svg rename to posts/7f6b7f24/levi52.svg diff --git a/2024/05/15/GitHub-Profile/tool-pycharm-green.svg b/posts/7f6b7f24/tool-pycharm-green.svg similarity index 100% rename from 2024/05/15/GitHub-Profile/tool-pycharm-green.svg rename to posts/7f6b7f24/tool-pycharm-green.svg diff --git "a/2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" "b/posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" similarity index 100% rename from "2024/05/15/GitHub-Profile/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" rename to "posts/7f6b7f24/\347\253\213\345\210\233-EDA-%23f7f7f7style=flat&logo=easyeda&logoColor=ffffff&label=\347\253\213\345\210\233&labelColor=5487ff&color=f7f7f7&cacheSeconds=3600&link=https%3A%2F%2Flceda.svg" diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" b/posts/b97be97c/S1.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S1.png" rename to posts/b97be97c/S1.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" b/posts/b97be97c/S2.jpg similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S2.jpg" rename to posts/b97be97c/S2.jpg diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" b/posts/b97be97c/S3.jpg similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/S3.jpg" rename to posts/b97be97c/S3.jpg diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" b/posts/b97be97c/Squareline.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/Squareline.png" rename to posts/b97be97c/Squareline.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" b/posts/b97be97c/copy_file.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/copy_file.png" rename to posts/b97be97c/copy_file.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" b/posts/b97be97c/export.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/export.png" rename to posts/b97be97c/export.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" b/posts/b97be97c/file_folder.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/file_folder.png" rename to posts/b97be97c/file_folder.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" b/posts/b97be97c/head.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/head.png" rename to posts/b97be97c/head.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" b/posts/b97be97c/index.html similarity index 80% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" rename to posts/b97be97c/index.html index 83e1e8e..f02e438 100644 --- "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/index.html" +++ b/posts/b97be97c/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,29 +17,31 @@ + + - + - + - - - - - - - - - - - + + + + + + + + + + + - + @@ -49,14 +51,14 @@ - + - + - +
ESP32S3N8R8 + Squareline_Studio设计移植 | Levi52's Blog @@ -224,7 +226,7 @@- + @@ -246,6 +248,8 @@ + +@@ -339,6 +341,7 @@@@ -260,7 +264,7 @@@@ -361,7 +365,7 @@配置
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
软件:Visual Studio Code + PlatformIO+ Squareline StudioSquareline Studio
设计UI
Squareline Studio
设计UI
导出文件
-
-
工程设置
+
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹工程设置
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
-Export
+Export
PlatformIO
文件结构
-
-
导出文件
+
以下为Squareline Studio导出的文件导出文件
以下为Squareline Studio导出的文件
-移植文件
+
资源文件复制到src/lvgl_gui移植文件
资源文件复制到src/lvgl_gui
LVGL
-
-
- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+ - 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
main
添加头文件
1
#include "ui.h"
UI初始化
删去之前LVGL官方案例的内容,添加如下代码- +1
ui_init();
lvgl显示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}setup()
中创建任务1
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
编译下载
+编译下载
END
2024 Levi5 END
- 本文链接: - https://levi52.github.io/2024/05/15/ESP32S3N8R8-Squareline-Studio设计移植/ + http://example.com/posts/b97be97c/
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处! @@ -390,12 +394,12 @@
END
@@ -511,6 +515,7 @@@@ -379,6 +381,7 @@END
+ diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" b/posts/b97be97c/lvgl_conf.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_conf.png" rename to posts/b97be97c/lvgl_conf.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" b/posts/b97be97c/lvgl_test.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/lvgl_test.png" rename to posts/b97be97c/lvgl_test.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" b/posts/b97be97c/project_setting.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting.png" rename to posts/b97be97c/project_setting.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" b/posts/b97be97c/project_setting1.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/project_setting1.png" rename to posts/b97be97c/project_setting1.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" b/posts/b97be97c/screen.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/screen.png" rename to posts/b97be97c/screen.png diff --git "a/2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" b/posts/b97be97c/ui_init.png similarity index 100% rename from "2024/05/15/ESP32S3N8R8-Squareline-Studio\350\256\276\350\256\241\347\247\273\346\244\215/ui_init.png" rename to posts/b97be97c/ui_init.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" b/posts/c4d6bdd0/IMG_1963.jpg similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1963.jpg" rename to posts/c4d6bdd0/IMG_1963.jpg diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" b/posts/c4d6bdd0/IMG_1964.jpg similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/IMG_1964.jpg" rename to posts/c4d6bdd0/IMG_1964.jpg diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" b/posts/c4d6bdd0/copy.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/copy.png" rename to posts/c4d6bdd0/copy.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" b/posts/c4d6bdd0/enter.gif similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/enter.gif" rename to posts/c4d6bdd0/enter.gif diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" b/posts/c4d6bdd0/export.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/export.png" rename to posts/c4d6bdd0/export.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" b/posts/c4d6bdd0/index.html similarity index 93% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" rename to posts/c4d6bdd0/index.html index 4226f53..237075e 100644 --- "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/index.html" +++ b/posts/c4d6bdd0/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,29 +17,31 @@ + + - + - + - - - - - - - - - - - + + + + + + + + + + + - + @@ -49,14 +51,14 @@ - + - + - + ESP32S3-输入设备Keypad | Levi52's Blog @@ -224,7 +226,7 @@- + @@ -246,6 +248,12 @@ + + + 置顶 + | + +@@ -262,7 +264,7 @@@@ -254,7 +262,7 @@@@ -411,7 +419,7 @@发表于 - +
@@ -306,14 +314,14 @@硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline StudioUI界面
使用
- +Squareline Studio
设计如下简单界面设置工程导出路径,然后导出文件
- +导出文件结构如下
- +PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
- +优化结构
VS Code
打开工程为了让
main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件修改后
@@ -324,7 +332,7 @@screen.h
文件内容如下输入设备
打开如下目录文件
- +打开
lv_port_indev_template.c
文件后,可以看到一共有五种输入方式@@ -343,9 +351,9 @@1
2
3
4
5lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
- +原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
- +在
screen.cpp
中最开始定义如下@@ -390,10 +398,10 @@1
2
3
4
5
6
7static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}效果
修改程序后,编译烧录
- - - - + + + +END
2024 Levi5 END
- 本文链接: - https://levi52.github.io/2024/05/16/ESP32S3-输入设备Keypad/ + http://example.com/posts/c4d6bdd0/
- 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处! @@ -440,7 +448,7 @@
END
@@ -558,6 +566,7 @@@@ -242,7 +244,7 @@END
+ diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" b/posts/c4d6bdd0/key.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key.png" rename to posts/c4d6bdd0/key.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" b/posts/c4d6bdd0/key1.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/key1.png" rename to posts/c4d6bdd0/key1.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" b/posts/c4d6bdd0/keyd.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/keyd.png" rename to posts/c4d6bdd0/keyd.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" b/posts/c4d6bdd0/port.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/port.png" rename to posts/c4d6bdd0/port.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" b/posts/c4d6bdd0/screen.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/screen.png" rename to posts/c4d6bdd0/screen.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" b/posts/c4d6bdd0/setting.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/setting.png" rename to posts/c4d6bdd0/setting.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" b/posts/c4d6bdd0/sq.png similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/sq.png" rename to posts/c4d6bdd0/sq.png diff --git "a/2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" b/posts/c4d6bdd0/switch.gif similarity index 100% rename from "2024/05/16/ESP32S3-\350\276\223\345\205\245\350\256\276\345\244\207Keypad/switch.gif" rename to posts/c4d6bdd0/switch.gif diff --git a/schedule/index.html b/schedule/index.html index 3f6c156..51b7559 100644 --- a/schedule/index.html +++ b/schedule/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,13 +17,15 @@ + + - + - + @@ -34,11 +36,11 @@ - + - + schedule | Levi52's Blog @@ -328,6 +330,7 @@ schedule + diff --git a/search.xml b/search.xml index ffc5102..a026400 100644 --- a/search.xml +++ b/search.xml @@ -2,19 +2,19 @@
ESP32S3-输入设备Keypad -/2024/05/16/ESP32S3-%E8%BE%93%E5%85%A5%E8%AE%BE%E5%A4%87Keypad/ +/posts/c4d6bdd0/ 配置 硬件:ESP32S3N16R8开发板 + 2.8寸TFT显示屏(ST7789) + 拨轮
软件:Visual Studio Code + PlatformIO + Squareline StudioUI界面
使用
- +Squareline Studio
设计如下简单界面设置工程导出路径,然后导出文件
- +导出文件结构如下
- +PlatforIO工程
复制工程
复制前面写好的触摸屏工程
删除原工程中的UI文件,将新UI复制过来
- +优化结构
VS Code
打开工程为了让
main.cpp
更简洁,这里将屏幕初始化的内容写到单独的screen.cpp
文件中,然后在main.cpp
中引入screen.h
头文件修改后
@@ -25,7 +25,7 @@screen.h
文件内容如下输入设备
打开如下目录文件
- +打开
lv_port_indev_template.c
文件后,可以看到一共有五种输入方式@@ -44,9 +44,9 @@lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/*Will be called by the library to read the mouse*/
static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}在我自制的ESP32S3N16R8开发板中使用的是如下图所示的多功能开关
- +原理图如下,三个按键被下拉,IO为低电平,当按键按下时IO将检测到高电平
- +在
screen.cpp
中最开始定义如下@@ -91,10 +91,10 @@static lv_indev_drv_t indev_drv;
lv_indev_t * indev_keypad1;
lv_group_t * group1;
// 按键引脚
#define btn1 5
#define btn2 6
#define btn3 7#include <Arduino.h>
#include <lvgl.h>
#include <freertos/FreeRTOS.h>
// SCREEN
#include "./screen.h"
// UI
#include "./lvgl_gui/ui.h"
// 任务
void lvgl_task(void *pt);
void setup()
{
Serial.begin( 115200 ); // 串口初始化
lv_init(); // lvgl初始化
screen_init(); // 屏幕初始化
ui_init(); // UI初始化
xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
}
void loop()
{
}
void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}效果
修改程序后,编译烧录
- - - - + + + +END
2024 Levi5 ]]>ESP32 @@ -111,378 +111,69 @@- -ESP32S3N8R8 + lvgl测试官方案例 -/2024/05/15/ESP32S3N8R8-lvgl%E6%B5%8B%E8%AF%95%E5%AE%98%E6%96%B9%E6%A1%88%E4%BE%8B/ -@TOC - 【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
-配置
-
硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
+
软件:Visual Studio Code + PlatformIOGitHub Profile +/posts/7f6b7f24/ +GitHub 主页指南 -+
-user_name: GitHub用户名(levi52)
新建工程
-
-
点击侧边
-PlatformIO
插件,新建工程
-依次设置工程名,开发板,框架
-
-
屏幕测试
添加TFT_eSPI
-
-
添加屏幕驱动库
-TFT_eSPI
,按如下图顺序
-添加TFT_eSPI到工程
-
-打开配置文件,可以看到已成功添加库
-
-
修改TFT_eSPI
-
-
打开
-.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
-根据屏幕驱动芯片解注释
-
-
- -// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER-
-
- 根据屏幕大小设置宽高 -
- -// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240-
-
- 根据连线设置引脚 -
- -// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
-- -#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}下载调试
-
-
编译下载
-
-根据屏幕显示情况修改
-User_Setup.h
文件
-
如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
--// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
-仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
--// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red修改后,如下图所示,RGB顺序正常
-LVGL测试
添加LVGL
-
-
根据实际情况,选择lvgl版本
-
![](lvglinstall.png” style=”zoom:67%;” >
-添加lvgl到工程
-
![](lvglinstalled.png” style=”zoom:67%;” >
-
修改LVGL
-
-
打开
-.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件将此文件重命名为
-lv_conf.h
-
![](lvconf.png” style=”zoom:67%;” >
--
-
- 使能lvgl -
- -/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H-
-
- 设置周期 -
默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
-
输入设备读取周期毫秒- -/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/-
-
- 心跳使能 -
- -/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM-
-
- 使能测试案例 -
+/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif访问次数
-![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
-
-
更改文件路径
-将
-.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
-修改main.cpp
-将
-.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制-
-
- 设置头文件 -
+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
+常用语言
+[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
-
-
- 设置宽高 -
+static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;仓库状态
+![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()shield图标
+ + + + + +静态
-
-
- 修改类型 -
-lv_disp_t
修改为lv_disp_drv_t
-lv_indev_t
修改为lv_indev_drv_t
-
-
- 注释掉触摸部分 -
-
修改完成
最终
-main.cpp
文件内容如下-#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}编译下载
显示效果如下图
-触摸测试
添加
-bb_captouch
修改
main.cpp
-
-
添加头文件
-+#include <bb_captouch.h>
+badgeContent
string – REQUIRED标签, (可选) 信息, 颜色.
+-
连接示例:立创-EDA-#f7f7f7
-设置触摸芯片引脚
-+// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+style
string可选参数:
+flat
,flat-square
,plastic
,for-the-badge
,social
默认:
+flat
示例:
flat
-设置参数
-+BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+logo
string可选logo:simple-icons/slugs.md
+示例:easyeda
-初始化
-+bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+logoColor
stringlogo颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:ffffff
-修改
-my_touchpad_read
函数这里的x,y坐标需要根据实际情况修改
- -/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
-
修改完成
最终
-main.cpp
文件内容如下- -#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}编译下载
触摸显示效果如下图所示
-END
2024 Levi5 -]]>- -ESP32 -教程 -- -ESP32 -PlatformIO -lvgl -2.8寸TFT -触摸屏 -立创 -- -Hello World -/2024/05/15/hello-world/ -Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. - -Quick Start
Create a new post
- -$ hexo new "My New Post"
More info: Writing
-Run server
- -$ hexo server
More info: Server
-Generate static files
- -$ hexo generate
More info: Generating
-Deploy to remote sites
- -$ hexo deploy
More info: Deployment
-]]>- -ESP32S3N8R8 + Squareline_Studio设计移植 -/2024/05/15/ESP32S3N8R8-Squareline-Studio%E8%AE%BE%E8%AE%A1%E7%A7%BB%E6%A4%8D/ -- -移植Squareline Studio到工程
- -配置
-
-硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
-
软件:Visual Studio Code + PlatformIO+ Squareline StudioSquareline Studio
设计UI
-导出文件
-
-
工程设置
+
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+label
string左边文本
+示例:立创
-Export
+
+labelColor
string左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
+示例:5487ff
-
PlatformIO
文件结构
-
-
导出文件
+
以下为Squareline Studio导出的文件
+color
string右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
+示例:f7f7f7
-移植文件
+
资源文件复制到src/lvgl_gui
+cacheSeconds
stringHTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
+示例: 3600
-
LVGL
-
-
- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
-
main
-
-
添加头文件
-#include "ui.h"
-UI初始化
-
删去之前LVGL官方案例的内容,添加如下代码- -ui_init();
-lvgl显示
-void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
-
-setup()
中创建任务xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
-
编译下载
-END
2024 Levi5 -]]>- -ESP32 -教程 -- -ESP32 -PlatformIO -lvgl -2.8寸TFT -Squareline Studio -触摸屏 -立创 -- -安信可Ai-M61-32S环境搭建 + 点灯 -/2024/05/15/%E5%AE%89%E4%BF%A1%E5%8F%AFAi-M61-32S%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA-%E7%82%B9%E7%81%AF/ -【祖传点灯】安信可Ai-M61-32S + 自由发挥 - -一、软件安装
-二、克隆仓库
在项目文件夹右键,选择
-open git bash here
,输入如下指令-git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从
- -gitee
克隆仓库等待下载,完成如下图所示
- -三、拉取M61的SDK子模块
1. 修改文件
由于
-github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。进入
- - -AiPi-Open-Kits
中,用文本打开.gitmodules
文件 url 参数中的github.com
改成gitee.com
:2. 拉取文件
继续输入如下命令
-- - -cd AiPi-Open-Kits/
git submodule init
git submodule update四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
-- - -cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
-- - -git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
- -在弹出的窗口中选择系统变量里的
- -Path
,点击编辑2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
-- - -aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja添加完成后,如下图
- -注意还需要把
-aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层3. 验证
验证配置是否成功
-在桌面按住
-shift
键点击鼠标右键
选择在此处打开PowersShell窗口
-Windows PowerShell
窗口中,输入如下命令- -make -v
- -riscv64-unknown-elf-gcc -v
成功时,输出如下图
- -六、编译程序
1. 打开源码
使用
- -VS Code
打开前面克隆的源码选择
- -AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
2. 编译程序
输入
- -make
命令3. 处理报错
编译报错
- -根据报错,打开如下文件
- -注释掉如下两行代码,然后再次执行
- - -make
指令七、烧录程序
1. 查看端口
打开
- -设备管理器
,查看端口2. 烧录
可以看到端口为
-COM19
,回到编辑器,在终端输入如下指令- - -make flash COMX=COM19
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
- - -八、效果演示
-END
2024 Levi5 ]]>- -Ai-M61-32S -教程 -- -Ai-M61-32S -安信可 -环境搭建 -点灯 -- +GitHub Profile -/2024/05/15/GitHub-Profile/ -GitHub 主页指南 -
-user_name: GitHub用户名(levi52)
-访问次数
- -![Visitor Count](https://profile-counter.glitch.me/user_name/count.svg)
GitHub Readme Stats
github-readme-stats: :zap: Dynamically generated stats for your github readmes
-常用语言
-[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name)](https://github.com/user_name/github-readme-stats)
- -[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=user_name&layout=compact)](https://github.com/user_name/github-readme-stats)
仓库状态
- -![user_name's GitHub stats](https://github-readme-stats.vercel.app/api?username=user_name&show_icons=true&theme=tokyonight)
![GitHub followers]()shield图标
- - - - - -静态
--
-
-badgeContent
string – REQUIRED标签, (可选) 信息, 颜色.
--
连接示例:立创-EDA-#f7f7f7
-
-
-style
string可选参数:
-flat
,flat-square
,plastic
,for-the-badge
,social
默认:
-flat
示例:
-flat
-
-logo
string可选logo:simple-icons/slugs.md
-示例:easyeda
-
-
-logoColor
stringlogo颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:ffffff
-
-
-label
string左边文本
-示例:立创
-
-
-labelColor
string左边背景颜色,支持 hex, rgb, rgba, hsl, hsla and css
-示例:5487ff
-
-
-color
string右边背景颜色,支持hex, rgb, rgba, hsl, hsla and css
-示例:f7f7f7
-
-
-cacheSeconds
stringHTTP缓存生存期(应用规则来推断每个徽章的默认值,低于默认值指定的任何值都将被忽略)。
-示例: 3600
-
-
-link
string[]指定单击徽章的左/右链接。
- +
+link
string[]指定单击徽章的左/右链接。
+
效果:
主页编辑器
Github Profilinator - GitHub Profile README Generator
图标
📱 Contact
@@ -676,4 +367,313 @@icon + +安信可Ai-M61-32S环境搭建 + 点灯 +/posts/17ee55dc/ +【祖传点灯】安信可Ai-M61-32S + 自由发挥 + +一、软件安装
+二、克隆仓库
在项目文件夹右键,选择
+open git bash here
,输入如下指令+git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git -b master
开始从
+ +gitee
克隆仓库等待下载,完成如下图所示
+ +三、拉取M61的SDK子模块
1. 修改文件
由于
+github
访问较慢,在拉取 SDK 之前,需要修改子模块仓库位置。进入
+ + +AiPi-Open-Kits
中,用文本打开.gitmodules
文件 url 参数中的github.com
改成gitee.com
:2. 拉取文件
继续输入如下命令
++ + +cd AiPi-Open-Kits/
git submodule init
git submodule update四、拉取 M61 SDK 中的子模块
1. 拉取文件
继续输入如下命令
++ + +cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update2. 克隆工具链
完成后,输入如下指令,克隆适用 Windows 的编译工具链
++ + +git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git -b master
五、环境变量设置
1. 打开环境变量
打开电脑高级系统设置,点击环境变量
+ +在弹出的窗口中选择系统变量里的
+ +Path
,点击编辑2. 添加环境变量
选择新建,然后点击浏览,添加如下路径
++ + +aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja添加完成后,如下图
+ +注意还需要把
+aithinker_Ai-M6X_SDK\tools\make
路径上移到最高层3. 验证
验证配置是否成功
+在桌面按住
+shift
键点击鼠标右键
选择在此处打开PowersShell窗口
+Windows PowerShell
窗口中,输入如下命令+ +make -v
+ +riscv64-unknown-elf-gcc -v
成功时,输出如下图
+ +六、编译程序
1. 打开源码
使用
+ +VS Code
打开前面克隆的源码选择
+ +AiPi-Eyes-DU
文件夹,右键选择在集成终端中打开
2. 编译程序
输入
+ +make
命令3. 处理报错
编译报错
+ +根据报错,打开如下文件
+ +注释掉如下两行代码,然后再次执行
+ + +make
指令七、烧录程序
1. 查看端口
打开
+ +设备管理器
,查看端口2. 烧录
可以看到端口为
+COM19
,回到编辑器,在终端输入如下指令+ + +make flash COMX=COM19
烧写开发板前,先按住烧录按键不松手再按一下复位按键,然后松手进入烧录模式
+ + +八、效果演示
+END
2024 Levi5 ]]>+ +Ai-M61-32S +教程 ++ +Ai-M61-32S +安信可 +环境搭建 +点灯 ++ +ESP32S3N8R8 + Squareline_Studio设计移植 +/posts/b97be97c/ ++ +移植Squareline Studio到工程
+ +配置
+
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
+
软件:Visual Studio Code + PlatformIO+ Squareline StudioSquareline Studio
设计UI
+导出文件
-
+
工程设置
+
按如下所示设置工程,Project Export Root
和UI Files Export Path
路径可以选择为LVGL工程目录下新建的export
文件夹
+Export
+
+
PlatformIO
文件结构
-
+
导出文件
+
以下为Squareline Studio导出的文件
+移植文件
+
资源文件复制到src/lvgl_gui
+
LVGL
-
+
- 修改lvgl
修改lvgl_conf.h,如下所示,关闭案例编译
+
main
-
+
添加头文件
+#include "ui.h"
+UI初始化
+
删去之前LVGL官方案例的内容,添加如下代码+ +ui_init();
+lvgl显示
+void lvgl_task(void *pt)
{
while(1)
{
lv_timer_handler(); /* let the GUI do its work */
vTaskDelay(5);
}
}
+
+setup()
中创建任务xTaskCreatePinnedToCore(lvgl_task, "lvgl display", 1024 * 15, NULL, 2, NULL, 1);
+
编译下载
+END
2024 Levi5 +]]>+ +ESP32 +教程 ++ +ESP32 +PlatformIO +lvgl +2.8寸TFT +Squareline Studio +触摸屏 +立创 ++ +ESP32S3N8R8 + lvgl测试官方案例 +/posts/2c4e27ec/ +@TOC + +【ESP32】立创ESP32S3R8N8开发板+2.8寸TFT电容触摸屏ST7789+GT911+PlatformIO-CSDN博客
+配置
+
+硬件:立创ESP32S3R8N8开发板 + 2.8寸TFT显示屏(ST7789) + 电容触摸(GT911)
+
软件:Visual Studio Code + PlatformIO新建工程
-
+
点击侧边
+PlatformIO
插件,新建工程
+依次设置工程名,开发板,框架
+
+
屏幕测试
添加TFT_eSPI
-
+
添加屏幕驱动库
+TFT_eSPI
,按如下图顺序
+添加TFT_eSPI到工程
+
+打开配置文件,可以看到已成功添加库
+
+
修改TFT_eSPI
-
+
打开
+.pio\libdeps\esp32-s3-devkitc-1\TFT_eSPI\User_Setup.h
文件
+根据屏幕驱动芯片解注释
+
+
+ +// Only define one driver, the other ones must be commented out
// #define ILI9341_DRIVER // Generic driver for common displays
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER // Define additional parameters below for this display
//#define ILI9163_DRIVER // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER-
+
- 根据屏幕大小设置宽高 +
+ +// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH 80
// #define TFT_WIDTH 128
// #define TFT_WIDTH 172 // ST7789 172 x 320
// #define TFT_WIDTH 170 // ST7789 170 x 320
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240-
+
- 根据连线设置引脚 +
+ +// ### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###
// For ESP32 Dev board (only tested with ILI9341 display)
// The hardware SPI can be mapped to any pins
//#define TFT_MISO 19
#define TFT_MOSI 17
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 16 // Data Command control pin
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST修改main.cpp
在屏幕上从上到下分别显示红绿蓝三色,以及白色文字,用来测试屏幕颜色显示是否正常。
++ +#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#define TFT_GREY 0x5AEB
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_WHITE, TFT_GREY); // Adding a background colour erases previous text automatically
tft.fillRect(0,0,240,50,TFT_RED);
tft.fillRect(0,50,240,50,TFT_GREEN);
tft.fillRect(0,100,240,50,TFT_BLUE);
tft.drawCentreString("Time flies",120,260,4);
}
void loop() {
// put your main code here, to run repeatedly:
}下载调试
-
+
编译下载
+
+根据屏幕显示情况修改
+User_Setup.h
文件
+
如果颜色反转(白色显示为黑色),如下图所示,则取消下一个注释,尝试两个选项,其中一个选项应该纠正反转。
++// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
// #define TFT_INVERSION_ON
#define TFT_INVERSION_OFF修改后,如下图所示,白色正常显示,但是RGB顺序存在问题
+仅对于ST7735, ST7789和ILI9341,如果显示器上的蓝色和红色交换,则定义颜色顺序,一次尝试一个选项来找到显示的正确颜色顺序
++// For ST7735, ST7789 and ILI9341 ONLY, define the colour order IF the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red修改后,如下图所示,RGB顺序正常
+LVGL测试
添加LVGL
-
+
根据实际情况,选择lvgl版本
+
![](lvglinstall.png” style=”zoom:67%;” >
+添加lvgl到工程
+
![](lvglinstalled.png” style=”zoom:67%;” >
+
修改LVGL
-
+
打开
+.pio\libdeps\esp32-s3-devkitc-1\lvgl\lv_conf_template.h
文件将此文件重命名为
+lv_conf.h
+
![](lvconf.png” style=”zoom:67%;” >
+-
+
- 使能lvgl +
+ +/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H-
+
- 设置周期 +
默认显示刷新周期。LVG将重新绘制改变的区域与这个周期时间
+
输入设备读取周期毫秒+ +/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 1 /*[ms]*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 1 /*[ms]*/-
+
- 心跳使能 +
+ +/*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM-
+
- 使能测试案例 +
+ +/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
#define LV_USE_DEMO_WIDGETS 1
#if LV_USE_DEMO_WIDGETS
#define LV_DEMO_WIDGETS_SLIDESHOW 0
#endif-
+
更改文件路径
+将
+.pio\libdeps\esp32-s3-devkitc-1\lvgl\demos
文件夹移动至.pio\libdeps\esp32-s3-devkitc-1\lvgl\src\demos
+修改main.cpp
+将
+.pio\libdeps\esp32-s3-devkitc-1\lvgl\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino
文件内容复制-
+
- 设置头文件 +
+ +#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"-
+
- 设置宽高 +
+ +static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;-
+
- 修改类型 +
+lv_disp_t
修改为lv_disp_drv_t
+lv_indev_t
修改为lv_indev_drv_t
-
+
- 注释掉触摸部分 +
+
修改完成
最终
+main.cpp
文件内容如下+#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
// void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
// {
// uint16_t touchX, touchY;
// bool touched = tft.getTouch( &touchX, &touchY, 600 );
// if( !touched )
// {
// data->state = LV_INDEV_STATE_REL;
// }
// else
// {
// data->state = LV_INDEV_STATE_PR;
// /*Set the coordinates*/
// data->point.x = touchX;
// data->point.y = touchY;
// Serial.print( "Data x " );
// Serial.println( touchX );
// Serial.print( "Data y " );
// Serial.println( touchY );
// }
// }
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
/*Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
// tft.setTouch( calData );
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}编译下载
显示效果如下图
+触摸测试
添加
+bb_captouch
修改
main.cpp
-
+
添加头文件
++#include <bb_captouch.h>
+设置触摸芯片引脚
++// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
+设置参数
++BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
+初始化
++bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
+修改
+my_touchpad_read
函数这里的x,y坐标需要根据实际情况修改
+ +/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
+
修改完成
最终
+main.cpp
文件内容如下+ +#include <Arduino.h>
#include <SPI.h>
#include <lvgl.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include "demos/lv_demos.h"
#include <bb_captouch.h>
// These defines are for a low cost ESP32 LCD board with the GT911 touch controller
#define TOUCH_SDA 4
#define TOUCH_SCL 2
#define TOUCH_INT 3
#define TOUCH_RST 1
BBCapTouch bbct;
const char *szNames[] = {"Unknown", "FT6x36", "GT911", "CST820"};
/*Change to your screen resolution*/
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * 10 ];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
// uint16_t touchX, touchY;
TOUCHINFO ti;
if(bbct.getSamples(&ti))
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = screenWidth - ti.y[0];
data->point.y = ti.x[0];
Serial.print( "Data x " );
Serial.println( screenWidth - ti.y[0] );
Serial.print( "Data y " );
Serial.println( ti.x[0] );
}
else
{
data->state = LV_INDEV_STATE_REL;
}
}
void setup()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
bbct.init(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_INT);
int iType = bbct.sensorType();
Serial.printf("Sensor type = %s\n", szNames[iType]);
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init( &disp_drv );
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, LVGL_Arduino.c_str() );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
// uncomment one of these demos
lv_demo_widgets(); // OK
#endif
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay( 5 );
}编译下载
触摸显示效果如下图所示
+END
2024 Levi5 +]]>+ +ESP32 +教程 ++ +ESP32 +PlatformIO +lvgl +2.8寸TFT +触摸屏 +立创 ++ diff --git a/sitemap/index.html b/sitemap/index.html index 06fdc3e..0e512b4 100644 --- a/sitemap/index.html +++ b/sitemap/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,13 +17,15 @@ + + - + - + @@ -34,11 +36,11 @@ - + - +Hello World +/posts/4a17b156/ +Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. + +Quick Start
Create a new post
+ +$ hexo new "My New Post"
More info: Writing
+Run server
+ +$ hexo server
More info: Server
+Generate static files
+ +$ hexo generate
More info: Generating
+Deploy to remote sites
+ +$ hexo deploy
More info: Deployment
+]]>sitemap | Levi52's Blog @@ -328,6 +330,7 @@ sitemap + diff --git "a/tags/2-8\345\257\270TFT/index.html" "b/tags/2-8\345\257\270TFT/index.html" index b8c8fa5..1365d4c 100644 --- "a/tags/2-8\345\257\270TFT/index.html" +++ "b/tags/2-8\345\257\270TFT/index.html" @@ -6,9 +6,9 @@ - - - + + + @@ -17,13 +17,15 @@ + + - + - + @@ -32,7 +34,7 @@ - + @@ -222,7 +224,7 @@
2.8寸TFT
2.8寸TFT
2.8寸TFT
2.8寸TFT + diff --git a/tags/Ai-M61-32S/index.html b/tags/Ai-M61-32S/index.html index d2792d0..d42fca1 100644 --- a/tags/Ai-M61-32S/index.html +++ b/tags/Ai-M61-32S/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,13 +17,15 @@ + + - + - + @@ -32,7 +34,7 @@ - + @@ -222,7 +224,7 @@
Ai-M61-32S
Ai-M61-32S + diff --git a/tags/ESP32/index.html b/tags/ESP32/index.html index f867cd5..10520bf 100644 --- a/tags/ESP32/index.html +++ b/tags/ESP32/index.html @@ -6,9 +6,9 @@ - - - + + + @@ -17,13 +17,15 @@ + + - + - + @@ -32,7 +34,7 @@ - + @@ -222,7 +224,7 @@
ESP32