Files
STM32F4-Base/Drivers/BSP
wandering1 515db819ab feat(ui): fold board inputs and outputs into the telemetry page
The 12 board-level rows now live at the end of the 遥信量 page instead of
a separate 开入开出 page: 8 opto inputs (DI_A..DI_H) and 4 relay outputs
(KO6/TRIP/ERT/CLZ). 33 rows become 45, five pages become six. The
standalone page, its menu entry, its golden references and both build
registrations are removed.

Folding the display is not folding the point table. The board rows
render from dio_di_* / dio_do_* and stay out of yx_bits / yx_valid /
yx_dp: any change to those carriers is provably absent from this diff.
IEC 104 mapping and YX_VALID_MASK are untouched, so nothing new is
reported to a master station.

Input polarity was wrong and is fixed here. On this board a 24 V input
drives the opto, which pulls the 74HC165 pin LOW, so the raw mask is
inverted relative to "has signal". The bit assembly only reordered bits;
nothing converted the level. The screen showed 分 on every channel no
matter what the operator drove in. Polarity now converts once, in the
driver, behind IOBOARD_DI_LEVEL_ACTIVE (0 = active low), so callers see
1 = has signal for both inputs and outputs.

Verified on the board: page 5 shows YX33 followed immediately by DI_A,
crossing the 33-point boundary with no drift; DI_C reads 合 because the
operator's signal is on channel C, the other seven read 分; page 6 shows
DI_H then all four outputs 释放. Page rows end at y=134, the footer
starts at y=144.

Input bit order is only partly verified: channel C was confirmed against
a real signal, the other seven have not been exercised channel by
channel. The board detects the presence of 24 V, not contact closure,
and the output rows show the shadow register (our intent) rather than
mechanical contact feedback. All three limits are recorded in the page
header and in the IOBOARD README.

Also adds a polarity guard to the host tests: the input polarity was
flipped once already, and until now no assertion would have caught a
silent re-flip, since only the DO side was pinned.
2026-11-16 23:30:35 +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