- 在 CMakeLists.txt 中添加 ui_Screen2.c 源文件以支持新屏幕 - 新增 ui_events.c 和 ui_events.h,定义按钮点击事件处理函数 - 实现 ui_Screen2.c,构建第二屏幕的 UI 组件和事件回调 - 更新 ui.c 以初始化和加载第二屏幕 - 更新相关头文件,确保新屏幕与现有结构兼容
Suppor
| 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.)
This example shows how to use the Wi-Fi Station functionality of the Wi-Fi driver of ESP for connecting to an Access Point.
How to use example
Configure the project
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
Optional: If you need, change the other options according to your requirements.
Build and Flash
Build the project and flash it to the board, then run the monitor tool to view the serial output:
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:
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
- ESP-IDF Getting Started Guide on ESP32-S2
- ESP-IDF Getting Started Guide on ESP32-C3
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
I (599) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (599) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (629) wifi: wifi firmware version: 2d94f02
I (629) wifi: config NVS flash: enabled
I (629) wifi: config nano formatting: disabled
I (629) wifi: Init dynamic tx buffer num: 32
I (629) wifi: Init data frame dynamic rx buffer num: 32
I (639) wifi: Init management frame dynamic rx buffer num: 32
I (639) wifi: Init management short buffer num: 32
I (649) wifi: Init static rx buffer size: 1600
I (649) wifi: Init static rx buffer num: 10
I (659) wifi: Init dynamic rx buffer num: 32
I (759) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0
I (769) wifi: mode : sta (30:ae:a4:d9:bc:c4)
I (769) wifi station: wifi_init_sta finished.
I (889) wifi: new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (889) wifi: state: init -> auth (b0)
I (899) wifi: state: auth -> assoc (0)
I (909) wifi: state: assoc -> run (10)
I (939) wifi: connected with #!/bin/test, aid = 1, channel 6, BW20, bssid = ac:9e:17:7e:31:40
I (939) wifi: security type: 3, phy: bgn, rssi: -68
I (949) wifi: pm start, type: 1
I (1029) wifi: AP's beacon interval = 102400 us, DTIM period = 3
I (2089) esp_netif_handlers: sta ip: 192.168.77.89, mask: 255.255.255.0, gw: 192.168.77.1
I (2089) wifi station: got ip:192.168.77.89
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
I (599) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (599) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (629) wifi: wifi firmware version: 2d94f02
I (629) wifi: config NVS flash: enabled
I (629) wifi: config nano formatting: disabled
I (629) wifi: Init dynamic tx buffer num: 32
I (629) wifi: Init data frame dynamic rx buffer num: 32
I (639) wifi: Init management frame dynamic rx buffer num: 32
I (639) wifi: Init management short buffer num: 32
I (649) wifi: Init static rx buffer size: 1600
I (649) wifi: Init static rx buffer num: 10
I (659) wifi: Init dynamic rx buffer num: 32
I (759) phy: phy_version: 4180, cb3948e, Sep 12 2019, 16:39:13, 0, 0
I (759) wifi: mode : sta (30:ae:a4:d9:bc:c4)
I (769) wifi station: wifi_init_sta finished.
I (889) wifi: new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (889) wifi: state: init -> auth (b0)
I (1889) wifi: state: auth -> init (200)
I (1889) wifi: new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (1889) wifi station: retry to connect to the AP
I (1899) wifi station: connect to the AP fail
I (3949) wifi station: retry to connect to the AP
I (3949) wifi station: connect to the AP fail
I (4069) wifi: new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (4069) wifi: state: init -> auth (b0)
I (5069) wifi: state: auth -> init (200)
I (5069) wifi: new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (5069) wifi station: retry to connect to the AP
I (5069) wifi station: connect to the AP fail
I (7129) wifi station: retry to connect to the AP
I (7129) wifi station: connect to the AP fail
I (7249) wifi: new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (7249) wifi: state: init -> auth (b0)
I (8249) wifi: state: auth -> init (200)
I (8249) wifi: new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (8249) wifi station: retry to connect to the AP
I (8249) wifi station: connect to the AP fail
I (10299) wifi station: connect to the AP fail
I (10299) wifi station: Failed to connect to SSID:myssid, password:mypassword
Running the example on ESP Chips without Wi-Fi
This example can run on ESP Chips without Wi-Fi using ESP-Hosted. See the Two-Chip Solution section in the upper level README.md for information.
Troubleshooting
For any technical queries, please open an issue on GitHub. We will get back to you soon.