gokul/macro-six-usbc
A six-key macro keyboard PCB paired with a separate physical enclosure.
- Version
- 0.1.16
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone gokul/macro-six-usbc # download the package files into ./macro-six-usbc
tsci add gokul/macro-six-usbc # add it to your project as @tsci/gokul.macro-six-usbcIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
manufacturing/check-connectivity.py
"""Check same-net copper connectivity across both layers, including pours and barrels."""
import runpy, sys, json
from collections import defaultdict
from pathlib import Path
from shapely.strtree import STRtree
# Reuse the fabrication checker's exact copper and drill shapes.
d = runpy.run_path(str(Path(__file__).with_name('check-copper.py')))
# Keep disconnected pieces separate even when one saved trace owns them.
features = [dict(f, geometry=g) for f in d['features']
for g in (list(f['geometry'].geoms) if f['geometry'].geom_type == 'MultiPolygon' else [f['geometry']])]
parent = list(range(len(features)))
def root(i):
while parent[i] != i:
parent[i] = parent[parent[i]]
i = parent[i]
return i
def join(i, k):
parent[root(i)] = root(k)
by_layer = defaultdict(list)
barrels = defaultdict(list)
for i, f in enumerate(features):
by_layer[f['layer']].append(i)
if f['kind'] in ('via', 'pth'):
barrels[f['id']].append(i)
for indices in by_layer.values():
tree = STRtree([features[i]['geometry'] for i in indices])
for i in indices:
a = features[i]
for k0 in tree.query(a['geometry'].buffer(1e-7)):
k = indices[int(k0)]
if k > i and a['net'] == features[k]['net'] and a['geometry'].distance(features[k]['geometry']) <= 1e-7:
join(i, k)
for indices in barrels.values():
for k in indices[1:]:
join(indices[0], k)
net_roots = defaultdict(set)
for i, f in enumerate(features):
net_roots[f['net']].add(root(i))
errors = [{'net': n, 'copper_islands': len(rs)} for n, rs in net_roots.items() if len(rs) > 1 and not n.startswith('unconnected:')]
report = {'nets': len(net_roots), 'disconnected_nets': errors}
Path('outputs/release/copper-connectivity-check.json').write_text(json.dumps(report, indent=2))
print('Copper connectivity:', len(net_roots), 'nets;', len(errors), 'disconnected nets')
for e in errors: print(e)
if errors: sys.exit(1)