重构WiFi站点示例并集成LVGL用户界面

- 更新了 devcontainer 和 VSCode 设置,以指定串口和闪存类型。
- 增强了 README 文档,添加了 LVGL 演示界面的详细硬件规格和使用说明。
- 在 lvgl_demo_ui.c 中新增了 LVGL 演示界面实现,展示旋转按钮和弧形图形。
- 将主应用逻辑整合到 main.c 文件中,集成 LVGL 和 LCD 触摸功能。
- 移除已弃用的 station_example_main.c,以简化代码库。
- 更新依赖项,包含 LVGL 和 LCD 触摸组件。
This commit is contained in:
雨霖铃
2026-06-28 15:45:37 +00:00
parent 27e2835075
commit 815485fc1a
9 changed files with 687 additions and 188 deletions
+75 -2
View File
@@ -1,6 +1,66 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | ESP32-P4 | ESP32-H2 |
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | -------- |
# 外围硬件
| 硬件类别 | 组件/型号 | 关键参数/功能 | 备注 |
| :----------------- | :--------------- | :--------------------------------- | :------------------------------- |
| **核心处理器** | ESP32-S3R8 | Xtensa 32位LX7双核,**主频240MHz** | 乐鑫高性能芯片 |
| **存储** | 内置 SRAM | 512KB | 芯片内部 |
| | 内置 ROM | 384KB | 芯片内部 |
| | 叠封 PSRAM | **8MB** | 用于运行代码,性能优异 |
| | 外接 Flash | **16MB** (W25Q128) | 存储程序和数据 |
| **显示与触摸** | LCD 屏幕 | 1.9英寸,170×320分辨率,262K彩色 | 驱动IC为ST7789V2 |
| | 触摸控制芯片 | **CST816** (电容式) | **触控版特有**,通过I2C接口 |
| **无线通信** | Wi-Fi | 2.4GHz, 802.11 b/g/n | |
| | 蓝牙 | Bluetooth 5 (BLE) | |
| | 板载天线 | 贴片陶瓷天线 | |
| | 外部天线接口 | **IPEX-1 连接器** | **触控版特有**,需修改焊盘启用 |
| **传感器** | 六轴惯性测量单元 | **QMI8658** | 包含3轴加速度计和3轴陀螺仪 |
| **存储扩展** | Micro SD 卡槽 | 支持Micro SD卡 | 位于PCB背面 |
| **电源管理** | 电池接口 | MX1.25 连接器 | 支持3.7V锂电池**充放电** |
| | USB供电 | USB Type-C 接口 | 同时用于下载调试 |
| | 充电指示灯 | 红色LED | 充电时亮起,充满熄灭 |
| **用户交互与调试** | 复位按键 | RESET | 系统复位 |
| | 启动按键 | BOOT | 用于下载模式和引导 |
| **扩展接口** | Pico兼容排针 | 引出丰富GPIO | 兼容树莓派Pico生态,可连接扩展板 |
# 外围接口
| 接口名称 | 接口类型 | 引脚/GPIO | 功能说明 |
| :------------- | :--- | :------------- | :------------------- |
| **LCD 显示屏** | SPI | IO9 | LCD\_RST(复位) |
| | | IO10 | LCD\_CLK(时钟) |
| | | IO11 | LCD\_DC(数据/命令) |
| | | IO12 | LCD\_CS(片选) |
| | | IO13 | LCD\_DIN(数据输入) |
| | | IO14 | LCD\_BL(背光控制,PWM |
| **触摸屏** | I2C | IO47 | TP\_SDA(数据线) |
| | | IO48 | TP\_SCL(时钟线) |
| | GPIO | IO17 | TP\_RESET(复位) |
| | | IO21 | TP\_INT(中断) |
| **SD 卡** | SPI | IO5 | SD\_CS(片选) |
| | | IO39 | SD\_CLK(时钟) |
| | | IO40 | SD\_MISO(主入从出) |
| | | IO41 | SD\_MOSI(主出从入) |
| **IMU 传感器** | I2C | IO8 | IMU\_SDA(数据线) |
| (QMI8658A) | | IO7 | IMU\_SCL(时钟线) |
| | GPIO | IO6 | IMU\_INT1(中断1 |
| | | IO15 | IMU\_INT2(中断2 |
| **UART0 串口** | UART | IO43 | U0\_TX(发送) |
| | | IO44 | U0\_RX(接收) |
| **用户按键** | GPIO | IO0 | BOOT0(启动/下载模式) |
| | | IO4 | KEY\_IO(用户按键) |
| **用户 LED** | GPIO | IO16 | LED\_A(指示灯) |
| **电池检测** | ADC | IO3 | BAT\_ADC(电池电压采集) |
| **USB Type-C** | USB | VBUS/D+/D- | 供电 + 程序下载 + 串口通信 |
| **锂电池接口** | 电源 | J1 | 电池充电与供电(ETA6098 |
| **WiFi/蓝牙天线** | 射频 | J5 (U.FL-IPEX) | 外接天线座 |
| **TF 卡座** | SPI | TF1 | MicroSD 卡扩展存储 |
| **外部 Flash** | SPI | U5 (W25Q32) | 4MB 板载 Flash |
| **扩展排针 J3** | 混合 | IO0~IO14 | 20Pin 排针,引出主要 GPIO |
| **扩展排针 J4** | 混合 | IO14~IO48等 | 20Pin 排针,含 USB/3V3/地 |
# Wi-Fi Station Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
@@ -16,8 +76,8 @@ Open the project configuration menu (`idf.py menuconfig`).
In the `Example Configuration` menu:
* Set the Wi-Fi configuration.
* Set `WiFi SSID`.
* Set `WiFi Password`.
* Set `WiFi SSID`.
* Set `WiFi Password`.
Optional: If you need, change the other options according to your requirements.
@@ -29,6 +89,16 @@ Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
(To exit the serial monitor, type ``Ctrl-]``.)
### Attach USB device in WSL
If you are using Windows Subsystem for Linux (WSL) and need to forward the ESP board from Windows to WSL, you can attach the device with:
```bash
usbipd attach --wsl --busid 3-1 --auto-attach
```
Replace `3-1` with the actual bus ID of your device from `usbipd list`. This allows the board to be detected by the ESP-IDF tools in WSL.
See the Getting Started Guide for all the steps to configure and use the ESP-IDF to build projects.
* [ESP-IDF Getting Started Guide on ESP32](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)
@@ -36,9 +106,11 @@ See the Getting Started Guide for all the steps to configure and use the ESP-IDF
* [ESP-IDF Getting Started Guide on ESP32-C3](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html)
## Example Output
Note that the output, in particular the order of the output, may vary depending on the environment.
Console output if station connects to AP successfully:
```
I (589) wifi station: ESP_WIFI_MODE_STA
I (599) wifi: wifi driver task: 3ffc08b4, prio:23, stack:3584, core=0
@@ -72,6 +144,7 @@ I (2089) wifi station: connected to ap SSID:myssid password:mypassword
```
Console output if the station failed to connect to AP:
```
I (589) wifi station: ESP_WIFI_MODE_STA
I (599) wifi: wifi driver task: 3ffc08b4, prio:23, stack:3584, core=0