Initial CYD TF card info display with LVGL.

Mount microSD on VSPI and show type, format, and capacity on the CYD screen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-17 17:29:51 +08:00
commit 23956897fa
11 changed files with 1650 additions and 0 deletions

1127
include/lv_conf.h Normal file

File diff suppressed because it is too large Load Diff

15
include/pins.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
// CYD ESP32-2432S028R 引脚
// TFT (HSPI / TFT_eSPI 已在 platformio.ini 配置)
#define TFT_BL_PIN 21
// TF / microSD (独立 VSPI)
#define SD_MISO 19
#define SD_MOSI 23
#define SD_SCK 18
#define SD_CS 5
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320

21
include/sd_info.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <Arduino.h>
struct SdCardInfo {
bool mounted;
bool present;
const char *type; // MMC / SDSC / SDHC / UNKNOWN / NONE
const char *filesystem; // FAT12 / FAT16 / FAT32 / exFAT / FAT / —
uint64_t card_bytes; // 卡物理容量
uint64_t total_bytes; // 分区总容量
uint64_t used_bytes;
uint64_t free_bytes;
uint32_t root_files; // 根目录条目数
String error; // 失败原因
};
bool sd_init();
void sd_deinit();
SdCardInfo sd_read_info();
String format_bytes(uint64_t bytes);

6
include/ui.h Normal file
View File

@@ -0,0 +1,6 @@
#pragma once
#include "sd_info.h"
void ui_create();
void ui_update(const SdCardInfo &info);