pixalynx/usb3-hub-10g

A USB 3.2 Gen 2 six-port hub board with USB-C PD power input, regulated 5 V/3.3 V/1.15 V rails, one upstream and four protected downstream USB-A/USB-C ports, SuperSpeed muxes, ESD protection, and controlled port power.

Version
0.0.1
License
unset
Stars
0

lib/gnd-mesh.tsx

import { Fragment } from "react"

export type GndMesh = {
  stubs: { port: string; layer: string; pad: number[]; via: number[]; local: number[] }[]
  links: { from: string; to: string; layer: string; a: number[]; b: number[] }[]
  unresolved: string[]
}

/** Renders the generated ground mesh: one short stub + plane via per ground land, straight
 * same-layer links for lands that had no free via spot, and a plain net connection for the
 * rest (routed by the autorouter). Generated by scripts/gen-gnd-mesh.py from the placement
 * build; regenerate after any placement change. */
export function GndMeshTraces({ mesh, net = "GND", plane = "inner1" as const, width = 0.25 }: { mesh: GndMesh; net?: string; plane?: "inner1" | "inner2"; width?: number }) {
  return (
    <>
      {mesh.stubs.map((s) => (
        <Fragment key={`stub-${s.port}`}>
          <trace from={s.port} to={`net.${net}`} thickness={width} pcbPath={[{ x: s.local[0], y: s.local[1] }, { x: s.local[0], y: s.local[1], via: true, toLayer: plane }]} />
        </Fragment>
      ))}
      {mesh.links.map((l) => (
        <Fragment key={`link-${l.from}`}>
          <trace from={l.from} to={l.to} thickness={width} pcbPath={[]} />
        </Fragment>
      ))}
      {mesh.unresolved.map((p) => (
        <Fragment key={`auto-${p}`}>
          <trace from={p} to={`net.${net}`} />
        </Fragment>
      ))}
    </>
  )
}