aboutsummaryrefslogtreecommitdiff
path: root/kicad/lib/tools/make_7seg_fp.py
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@tha.de>2026-11-08 18:14:54 +0100
committerFriedrich Beckmann <friedrich.beckmann@tha.de>2026-11-08 18:14:54 +0100
commit5129a5a5448012a53cb9ddae1349c2a2c8571339 (patch)
tree41d60bbce7fe0de57cdd92b232682831759de1a8 /kicad/lib/tools/make_7seg_fp.py
parent9e4911662b81bad61183cca74b8c1905f84e60e4 (diff)
Add KiCad 9 schematic, project libraries and datasheetsHEADmaster
Schematic (kicad/), one sheet per function as on ULX3S: - power: TLV62569 bucks for +1V1 / +3V3, AP2112K LDO for +2V5 - usb: USB-C with PTC and TVS, CH347F for JTAG and UART - fpga_power, fpga_config, fpga_banks_01/23/67: ECP5 LFE5U-25F caBGA256 (pin compatible with the 45F), quad SPI flash, 50 MHz CLOCK_50, ball assignment as in PINPLAN.md - ethernet: RTL8211F gigabit PHY, HR911130A RJ45, shield via 1M || 1nF 2kV - sdram: 32 MB W9825G6KH-6 - hdmi: TMDS from the FPGA (LVCMOS33D), AC coupled, ESD protected - user_io: SW, KEY (debounced), LEDR, LEDG, HEX0-HEX3 with DE1 names - gpio: two DE1 compatible 2x20 headers (THDB-ADA on GPIO_0), Pmod A/B, ESD arrays - testpoints: bring-up pads, M3 mounting holes All parts have LCSC numbers, MPN and manufacturer for JLCPCB assembly; footprints are cross-checked against the EasyEDA data. Libraries: ECP5 symbols generated from the Lattice pinout CSVs (kipart), CH347F, RTL8211F, SM410561N symbols, HR911130A symbol and footprint from KiCad library merge requests, generator scripts in lib/tools/. Datasheets of all parts except resistors and capacitors in datasheets/ (manufacturer copyright, not covered by the project licenses).
Diffstat (limited to 'kicad/lib/tools/make_7seg_fp.py')
-rwxr-xr-xkicad/lib/tools/make_7seg_fp.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/kicad/lib/tools/make_7seg_fp.py b/kicad/lib/tools/make_7seg_fp.py
new file mode 100755
index 0000000..197bdc1
--- /dev/null
+++ b/kicad/lib/tools/make_7seg_fp.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Write the footprint for the ARKLED SM410561N 0.56" single digit display.
+
+Dimensions from the ARKLED specification, page 4/4: body 12.60 x 19.0 mm,
+2 x 5 pins on a 2.54 mm pitch, rows 15.24 mm apart, pin diameter 0.51 mm,
+pin 1 bottom left (digit upright), numbering counter-clockwise.
+Footprint origin = pin 1.
+
+ make_7seg_fp.py OUT.kicad_mod
+"""
+import sys
+import uuid
+
+NS = uuid.UUID("2f1b6f2e-9a77-4b8e-8f0e-5a3c7e1d2b44")
+OUT = sys.argv[1]
+W, H, PITCH, ROW = 12.60, 19.0, 2.54, 15.24
+CX, CY = 2 * PITCH, -ROW / 2 # body centre relative to pin 1
+
+
+def u(*a):
+ return str(uuid.uuid5(NS, "/".join(map(str, a))))
+
+
+def f(v):
+ v = round(v, 4)
+ return "0" if v == 0 else f"{v:g}"
+
+
+o = ['(footprint "7SegmentLED_0.56in_1Digit_SM410561N"\n\t(version 20241229)\n\t(generator "eboard")\n'
+ '\t(generator_version "9.0")\n\t(layer "F.Cu")\n'
+ '\t(descr "0.56 inch single digit 7-segment display, ARKLED SM410561N, '
+ 'https://www.lcsc.com/product-detail/C141368.html")\n'
+ '\t(tags "7 segment LED display 0.56 inch")\n']
+
+
+def prop(name, val, x, y, layer, hide=False):
+ o.append(f'\t(property "{name}" "{val}"\n\t\t(at {f(x)} {f(y)} 0)\n\t\t(layer "{layer}")\n'
+ + ('\t\t(hide yes)\n' if hide else '')
+ + f'\t\t(uuid "{u("p", name)}")\n\t\t(effects\n\t\t\t(font\n\t\t\t\t(size 1 1)\n'
+ '\t\t\t\t(thickness 0.15)\n\t\t\t)\n\t\t)\n\t)\n')
+
+
+def line(x1, y1, x2, y2, layer, w):
+ o.append(f'\t(fp_line\n\t\t(start {f(x1)} {f(y1)})\n\t\t(end {f(x2)} {f(y2)})\n\t\t(stroke\n'
+ f'\t\t\t(width {w})\n\t\t\t(type solid)\n\t\t)\n\t\t(layer "{layer}")\n'
+ f'\t\t(uuid "{u("l", layer, x1, y1, x2, y2)}")\n\t)\n')
+
+
+def rect(x1, y1, x2, y2, layer, w):
+ for a, b in (((x1, y1), (x2, y1)), ((x2, y1), (x2, y2)), ((x2, y2), (x1, y2)), ((x1, y2), (x1, y1))):
+ line(*a, *b, layer, w)
+
+
+x1, x2, y1, y2 = CX - W / 2, CX + W / 2, CY - H / 2, CY + H / 2
+prop("Reference", "REF**", CX, y1 - 1.5, "F.SilkS")
+prop("Value", "SM410561N", CX, y2 + 1.5, "F.Fab")
+prop("Datasheet", "https://www.lcsc.com/product-detail/C141368.html", 0, 0, "F.Fab", hide=True)
+prop("Description", "0.56 inch single digit 7-segment display", 0, 0, "F.Fab", hide=True)
+o.append('\t(attr through_hole)\n')
+rect(x1, y1, x2, y2, "F.Fab", 0.1)
+rect(x1 - 0.12, y1 - 0.12, x2 + 0.12, y2 + 0.12, "F.SilkS", 0.12)
+rect(x1 - 0.5, y1 - 0.5, x2 + 0.5, y2 + 0.5, "F.CrtYd", 0.05)
+line(x1 - 0.5, 1.2, x1 - 0.5, -1.2, "F.SilkS", 0.12) # pin 1 marker
+o.append(f'\t(fp_text user "${{REFERENCE}}"\n\t\t(at {f(CX)} {f(CY)} 0)\n\t\t(layer "F.Fab")\n'
+ f'\t\t(uuid "{u("t")}")\n\t\t(effects\n\t\t\t(font\n\t\t\t\t(size 1 1)\n'
+ '\t\t\t\t(thickness 0.15)\n\t\t\t)\n\t\t)\n\t)\n')
+pads = [(n, (n - 1) * PITCH, 0.0) for n in range(1, 6)] + \
+ [(n, (10 - n) * PITCH, -ROW) for n in range(6, 11)]
+for n, x, y in pads:
+ shape = "rect" if n == 1 else "circle"
+ o.append(f'\t(pad "{n}" thru_hole {shape}\n\t\t(at {f(x)} {f(y)})\n\t\t(size 1.5 1.5)\n'
+ f'\t\t(drill 0.8)\n\t\t(layers "*.Cu" "*.Mask")\n\t\t(remove_unused_layers no)\n'
+ f'\t\t(uuid "{u("pad", n)}")\n\t)\n')
+o.append('\t(embedded_fonts no)\n)\n')
+open(OUT, "w").write("".join(o))
+print("wrote", OUT)