Files
STM32F4-Base/Drivers/BSP
wandering1 2b466b85f0 feat(ui): add DI/DO status page showing 8 inputs and 4 outputs
New read-only content page under 实时数据 → 开入开出 showing the board's
8 opto inputs (DI_A..DI_H, 合/分) and 4 relay outputs (KO6/TRIP/ERT/CLZ,
吸合/释放) as a 12-row list, 8 rows per page, 2 pages.

Data path reuses the existing de-bounced input poll instead of adding a
second hardware reader:

  defaultTask (50 ms) → ioboard_di_snap_publish() → de-bounced snapshot
    → ioboard_di_snap_lookup()  [new registration channel]
    → ui_data_feed_tick() (uiTask, 200 ms)
    → ui_data_rt_t.dio_di_* / dio_do_*

No new critical sections, no new hardware access on the UI path. Outputs
come from the volatile shadow register (a memory read, no lock).

Semantic honesty, recorded in ui_page_di_do.c and README §6:
  · Output state is the software shadow register (ODR mirror), NOT a
    mechanical contact feedback — this platform has no auxiliary contact
    readback path. ioboard_do_read_level() also reads ODR, so comparing
    the two is tautological.
  · IOBOARD_DO_LEVEL_ACTIVE polarity has not been checked against the
    schematic.
  · Input bit order has not been verified by manual shorting. The
    2026-11-16 run read 0x00 eight times because the operator had no time
    to short each channel — the data path itself was fine.
  · Board-level inputs are deliberately kept out of the 33-point telemetry
    bitmap (IEC 104 point-table semantics); the two have no mapping.

Invalid snapshots render "--", never 合/分 or 吸合/释放: painting "no data"
as "all inputs released" would tell the field the inputs are open when we
simply failed to read them.

Board-verified 2026-11-16: page 1 shows 分 on all 8 inputs, page 2 shows
释放 on all 4 outputs, page footer and paging correct. Input bit order
still pending manual shorting.

Also: regenerate ui_font_cn_12 for 吸/释, add golden references for both
pages, align check_menu_rows.py L2 geometry with the now-4-item submenu,
and register the new source file in both the Keil project and CMake.

Reviewed independently; zero blocking findings.
2026-11-16 21:45:08 +08:00
..

Drivers/BSP/ — 板级支持包(纯手工自研代码)

本目录全部为手工编写的板级驱动与中间层(非 CubeMX 生成、非第三方库、非 ST HAL)。 每个芯片/子模块一个子目录。改驱动前必读对应模块的 Trap Records(见下)。

子模块一览

目录 芯片/模块 接口 职责 关键文档
CH395F/ CH395F 以太网控制器 SPI2 以太网 MAC/PHY 控制器底层驱动 docs/问题记录/CH395F_Trap_Records.md
GD5F2GQ5UE/ GD5F2GQ5UE SPI NAND SPI1 NAND 驱动 + FTL(nand_ftl.c) docs/问题记录/GD5F2GQ5UE_Trap_Records.md
TPAFE5160/ TPAFE5160 高精度 ADC 并行 16 位 ADC 采样驱动(CONVST/BUSY 时序) —
SD2506/ SD2506 RTC I2C 实时时钟驱动 docs/问题记录/SD2506_Trap_Records.md
RS485/ RS-485 半双工 UART5 收发方向控制(DE 引脚)+ 时序 —
NET/ BSD Socket 网络抽象层 — Socket API + select + 轻量 FTP 服务器 docs/网络/(含 Net层阻塞模型架构设计.md)
NETCFG/ 网络配置 — /config.ini 网络段的加载/保存 docs/子系统设计/网络配置说明.md
UI/ LVGL UI 组件 — 菜单/内容页/组件/中文字体 docs/UI设计/

根级文件

文件 作用
dbg_log.h 调试日志宏(DBG_INFO 等),编译期开关
dbg_cfg.h 调试配置项
app_assert.h 模块级轻量断言宏(APP_ASSERT):编译期两态裁剪(默认关闭 = 零符号零开销;打开态与 configASSERT 共用同一个失败钩子)。试点见 Drivers/BSP/NET/net_socket.c

子模块 README

⚠️ 改驱动前必读(踩坑速查)

模块 陷阱
CH395F SPI 事务须 ch395f_spi_begin()/end() 包裹;分频系数必须为 8(PCB 约束,勿"优化");快速复连会因事件被读清消费致监听死亡(TRAP-NET-17 已修,E14 复核:非芯片丢事件);上传中止后首笔复连截断(TRAP-NET-18 已修)
GD5F2GQ5UE FatFs 移植版打开模式陷阱(FA_OPEN_APPEND 不含写位);文件名严格 8.3 短名、不得以点开头;f_write 簇分配失败返 FR_OK + 短写,须校验字节数
NET 就绪屏障位必须 osFlagsNoClear;s_net_errno 已按任务隔离(勿改回全局)
通用 自研代码禁用 C 库堆分配(MicroLIB 堆仅 512 B),动态内存只用 pvPortMalloc/vPortFree

完整平台约束的落点:隔离与错误码语义 → .dsh/roles/network-specialist.md(网络)/ .dsh/roles/storage-specialist.md(存储);中断与吞吐细节 → docs/网络/网络自愈架构设计.md、docs/架构设计/STM32F4-Base存储架构说明.md;C 库堆禁令 → docs/门禁说明/coding-standard.md。另见各模块的 Trap Records。

相关文档

  • 架构全景:docs/架构设计/项目架构总览.md
  • 存储栈:docs/架构设计/STM32F4-Base存储架构说明.md
  • 测试指南:docs/测试说明/板级测试/*_Test_Guide.md