imrishabh18/pcbgolf

A complete 4-layer PCBGolf controller PCB with STM32H7 MCU, USB/SD and CAN interfaces, power regulation, protection, connectors, switches, LEDs, clocking, and supporting passives.

Version
1.6.1
License
unset
Stars
0

footprints/README.md

# Original PCBGolf footprints

This directory converts all 28 footprints supplied by
[commaai/PCBGolf](https://github.com/commaai/PCBGolf/tree/master/pcbgolf.pretty).
The original library contains 380 SMT pads, 29 plated holes, and six non-plated holes.
One reviewed KiCad standard SOT-23-5 footprint adds five SMT pads, giving 29
footprints and 420 pads/holes in the complete library. U9–U12 use that footprint
to correct a source package/MPN mismatch; the functional pin remap and native
template are documented in `../source-corrections.json`. No pad is resized
to make placement or routing easier.

```tsx
import { footprints, footprintPinMaps } from "./footprints"

const name = "USB-C-FEMALE-VERT-GCT"
const pinMap = footprintPinMaps[name]
<chip
  name="J1"
  footprint={footprints[name]()}
  pinLabels={Object.fromEntries(
    Object.entries(pinMap).map(([id, pin]) => [pin, `P_${id}`]),
  )}
/>
```

`footprintPinMaps[name][originalPadId]` gives the canonical `pinN` selector.
Positive numeric pad IDs retain their numbers; other IDs receive stable unused
positive numbers. Original IDs also remain in each pad's `portHints`.
The mounting-hole pad named `0` maps to `pin1`. Duplicate original IDs share the
same canonical pin. Sanitize punctuation when using source IDs in `pinLabels`
(the main board handles the switch's `A'` and `B'` pins).

Coordinates are in millimetres with +Y up. The converter preserves original
pad centers, dimensions, copper sides, rotations, rounded-corner radii, drill
sizes, and explicit mask/paste margins. Omitted KiCad margins are explicitly
zero so tscircuit does not apply its default 70% solder-paste aperture size.
The source library has circular drills only. The generator also supports
slotted drills if the source is updated.

The CLI converter supplies silkscreen, fabrication, and courtyard graphics.
Copper primitives are regenerated from the source because the installed CLI
emits obsolete rotated-pad props and loses rounded corners. The `cornerRadius`
prop is used for SMT pads: `rectBorderRadius` is currently accepted but ignored
by tscircuit core for those pads. A square roundrect whose corner radius is
half its width is exactly a circle; these pads use the equivalent `circle`
primitive so clearance checks measure actual copper rather than square bounds.

Run `bun run footprints/verify.tsx` to render every footprint and compare pad
counts, coordinates, dimensions, rotations, copper radii, and drill geometry
against `geometry.json`. All 420 pads/holes pass. `verification.json` records
the rendered geometry and unconnected-library diagnostics. Those diagnostics
include intentional overlap between the MOSFET's common drain pads and the
USB connector's paired SMT/plated contacts. The main board assigns their
original nets and USB internal connectivity. The eight former USB contact
clearance warnings were artifacts of testing the square bounds of circular
copper. Exact clearances are 0.190739–0.202403 mm, above the 0.1 mm rule;
`usb-clearance-audit.json` records every pair. No clearance rule is relaxed.

Regenerate with:

```sh
python3 footprints/generate.py /path/to/PCBGolf/pcbgolf.pretty
```

The generator also reads the bundled reviewed templates in `footprints/kicad/`.

Known non-copper limitations: source STEP models are not embedded here; the
installed core emits rectangular solder-paste apertures for rounded rectangular
SMT pads, retaining aperture dimensions but not their corner radii. Source
thermal-relief and fabrication-specific settings are not a footprint TSX
property and remain in the original KiCad project.