Files
inmp441recondtest/README.md
DESKTOP-PUHFO60\dsx2016 994d21c7fb Fix touch vs SD VSPI clash; SoftSPI + BOOT/serial REC.
Recording verified via serial r; 2.8 touch no longer shares VSPI with microSD.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-27 21:42:37 +08:00

91 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CYD INMP441 录音
ESP32 Cheap Yellow Display + INMP441(I2S)→ microSD **WAV 录音**,支持 DAC 回放。
默认 **2.8" ESP32-2432S028R**;可选 **3.5" ESP32-3248S035C**(`cyd_35r`)。
引脚约定见同目录 [CYD_PROJECT_GUIDE.md](../CYD_PROJECT_GUIDE.md);麦克风接线参考 [inmp441test](../inmp441test)。
## 硬件
| 项目 | 2.8" · 2432S028R | 3.5" C · 3248S035C |
|------|------------------|---------------------|
| 屏驱 | ILI9341 | ST7796 |
| 触控 | XPT2046 SoftSPI | GT911 Wire1(SDA33/SCL32/INT21/RST25) |
| 背光 TFT_BL | **GPIO21** | **GPIO27** |
| INMP441 WS | **GPIO22**(CN1/P3) | **GPIO22** |
| INMP441 SCK | **GPIO27**(CN1) | **GPIO21**(CN1;勿占 27=BL) |
| INMP441 SD | **GPIO35**(P3,仅输入) | **GPIO35** |
| microSD | CS5 / SCK18 / MISO19 / MOSI23 | 同左 |
| 喇叭 | **GPIO26**(DAC2,P4) | 同左 |
接线:
| INMP441 | CYD |
|---------|-----|
| VDD | 3.3V(CN1) |
| GND | GND |
| L/R | GND(左声道,勿悬空) |
| WS | IO22 |
| SCK | IO27(2.8)/ IO21(3.5) |
| SD | IO35(P3) |
> 不要接 5V;不要占用背光脚。I2S 需要三根信号线(22 + 27/21 + 35)。
> **3.5C**:`SCK=GPIO21` 与 GT911 INT 同脚;固件先完成触控选址,再把 21 交给 I2S,触控仅轮询。
## 功能
- 触控 **REC / STOP**:录制 16 kHz / 16-bit 单声道 PCM WAV 到 `/rec/Rxxxx.WAV`
- 最长约 **120 秒**(自动停)
- 实时电平条(近似 dB,与 inmp441test 同一换算)
- **PLAY / STOP**:用板载喇叭(GPIO26)回放最近一条录音
- 短按顶部标题栏切换背光 4 档
- 需插入 **FAT32 microSD**
- 触控备用:板载 **BOOT** 键切换 REC;串口发送 `r` / `p` 切换录音 / 播放
- 2.8" 触控用 SoftSPI(与 SD 的 VSPI 隔离;勿再用会抢总线的 XPT2046+VSPI)
## 构建与烧录
依赖 [PlatformIO](https://platformio.org/)。
```bash
pio run -e cyd_28r -t upload # 2.8"
pio run -e cyd_35r -t upload # 3.5C
pio device monitor -b 115200
```
### 预编译固件
| 板型 | 目录 |
|------|------|
| 2.8" | [`firmware/cyd_28r/`](firmware/cyd_28r/) |
| 3.5" | [`firmware/cyd_35r/`](firmware/cyd_35r/) |
```powershell
cd firmware\cyd_28r # 或 cyd_35r
.\flash.ps1
```
重新打包:
```powershell
.\firmware\export_from_build.ps1
.\firmware\export_from_build.ps1 -Env cyd_35r
```
## 项目结构
```
platformio.ini
include/pins.h lv_conf.h touch.h sdcard.h recorder.h player.h
src/main.cpp touch.cpp sdcard.cpp recorder.cpp player.cpp
scripts/exclude_lvgl_asm.py
firmware/
README.md
```
## 变更记录
| 日期 | 说明 |
|------|------|
| 2026-10-27 | 初版:INMP441 → microSD WAV 录音 + DAC 回放;双板 `cyd_28r` / `cyd_35r` |