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-usbc

In 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.

scripts/render-routing-inspection.ts

import { convertCircuitJsonToPcbSvg } from 'circuit-to-svg'
import { Resvg } from '@resvg/resvg-js'
const board = await Bun.file('outputs/release/board.circuit.json').json()
// Inspection-only view: show every saved wire even where it merges into a pour.
// Fabrication Circuit JSON and Gerbers retain the actual pours and annotations.
const inspection = board.filter(e => e.type !== 'pcb_copper_pour').map(e => e.type === 'pcb_trace' ? {
  ...e, route: e.route.map(({ is_inside_copper_pour, copper_pour_id, ...p }) => p),
} : e)
for (const layer of ['top', 'bottom'] as const) {
  const svg = convertCircuitJsonToPcbSvg(inspection, { layer })
  await Bun.write(`outputs/release/routing-${layer}-all-traces.svg`, svg)
  await Bun.write(`outputs/release/routing-${layer}-all-traces.png`, new Resvg(svg, { fitTo: { mode: 'width', value: 2200 } }).render().asPng())
}