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/routed-traces.tsx

import { Fragment } from "react"
import { localPath, type Pt } from "./geometry"
import { SCHEMATIC_OFF } from "./env"

/** One land-to-land (or land-to-plane) copper leg produced by scripts/import-router-session.py from a
 * Freerouting session. `path` is in board coordinates; it is converted into the from-component frame
 * at render time exactly like the hand-routed legs. */
export type RoutedLeg = {
  id: string
  net: string
  from: string
  to: string
  width: number
  fromCentre: Pt
  fromRotation: number
  path: (Pt & { via?: boolean; toLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" })[]
}
export type RoutedLegs = { source: string; router: string; legs: RoutedLeg[] }

/** Legs carry their id as the trace name only in schematic-off builds (the routing tools, e.g. scripts/fix-anchors.py,
 * find legs by name). In a schematic build a named trace becomes its net's display label: every unnamed local net would
 * be drawn with a leg id ("fr_97_R101_pin1") and sent through the trace solver's inline-label phase (13+ minutes). */
const LEG_NAMES = SCHEMATIC_OFF

export function RoutedTraces({ routes }: { routes: RoutedLegs }) {
  return (
    <>
      {routes.legs.map((l) => (
        <Fragment key={l.id}>
          <trace name={LEG_NAMES ? l.id : undefined} from={l.from} to={l.to} thickness={l.width} pcbPath={localPath(l.path, l.fromCentre, l.fromRotation)} />
        </Fragment>
      ))}
    </>
  )
}