Skip to content

Commit 61c4f60

Browse files
committed
feat: 添加模块
1 parent 29bcdd5 commit 61c4f60

19 files changed

Lines changed: 2576 additions & 1033 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
cp metadata.json release-staging/metadata.json
4141
cp build/symbols/libs/MCU_SiFli.kicad_sym release-staging/symbols/MCU_SiFli.kicad_sym
4242
find build/footprints -maxdepth 1 -type d -name '*.pretty' -exec cp -R {} release-staging/footprints/ \;
43+
if [ -d module-footprints ]; then
44+
find module-footprints -maxdepth 1 -type d -name '*.pretty' -exec cp -R {} release-staging/footprints/ \;
45+
fi
4346
4447
if [ -d resources ]; then
4548
cp -R resources/. release-staging/resources/

docs/modules.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ SiliconSchema pad type → KiCad pin electrical type,例:`bidirectional` →
8080

8181
`load_footprint_manifest()` 用于 `--symbols-only` 模式,从已有 manifest 恢复封装信息。
8282

83-
## module_loader.py / module_footprints.py — 模组生成
83+
## module_loader.py — 模组定义与手工封装
8484

8585
模组生成以本仓库 `modules/*/module.yml` 为真源(而非 SiliconSchema 子模块),并支持两类引脚来源:
8686

@@ -94,18 +94,24 @@ SiliconSchema pad type → KiCad pin electrical type,例:`bidirectional` →
9494
modules/
9595
└── <module_id>/
9696
├── module.yml # 元信息 + include + variants
97-
├── pins.yml # 引脚表(number → pad/include)+ 本地 pads 定义
98-
└── footprint.yml # 推荐 PCB 封装 DSL(pad_groups / keepouts / body)
97+
└── pins.yml # 引脚表(number → pad/include)+ 本地 pads 定义
9998
```
10099

101100
其中:
102101

103102
- `module.yml.variants[].package` 作为 KiCad footprint 的 package key(会写入 footprint manifest)。
104103
- `pins.yml.pins[].pad` 可为字符串(本地 pad)或 `{include,name}`(引用 include pad)。
105-
- `footprint.yml``pad_groups` 的 pad number 必须与 `pins.yml` 一致(生成时会校验)。
106104

107-
封装生成使用一个轻量 DSL(row/grid/single 的 pad group),并支持生成真实的 KiCad keepout zone
108-
(例如天线禁布区),输出到 `build/footprints/<namespace>.pretty/`
105+
模块封装不再通过 YAML DSL 自动生成。手工维护的 `.kicad_mod` 统一放在单独目录:
106+
107+
```text
108+
module-footprints/
109+
└── <library>.pretty/
110+
└── <package>.kicad_mod
111+
```
112+
113+
生成器遇到模组 package 时,不会再创建封装,而是从 `module-footprints/` 复制对应的
114+
`.kicad_mod``build/footprints/<library>.pretty/`,并写入 `manifest.json` 供符号生成引用。
109115

110116
## footprint_loader.py — 封装参数
111117

@@ -156,7 +162,7 @@ release-staging/
156162
├── symbols/
157163
│ └── MCU_SiFli.kicad_sym # 来自 build/symbols/libs/MCU_SiFli.kicad_sym
158164
├── footprints/
159-
│ └── *.pretty/*.kicad_mod # 来自 build/footprints/*.pretty/*.kicad_mod
165+
│ └── *.pretty/*.kicad_mod # 来自 build/footprints/*.pretty/*.kicad_mod,并叠加 module-footprints/*.pretty/*.kicad_mod
160166
└── resources/
161167
```
162168

module-footprints/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Manual Module Footprints
2+
3+
This directory stores manually maintained KiCad module footprints.
4+
5+
Expected layout:
6+
7+
```text
8+
module-footprints/
9+
└── <library>.pretty/
10+
└── <package>.kicad_mod
11+
```
12+
13+
The generator no longer builds module footprints from YAML. Instead, it copies
14+
matching `.kicad_mod` files from this directory into the output footprint tree
15+
and records them in the footprint manifest for symbol generation and release.

0 commit comments

Comments
 (0)