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/layout.ts
import { EDGE_Y } from "../parts/Connectors"
/** Board frame: origin at the centre, +y = back edge (host + power-in USB-C), -y = front edge (the four
* downstream ports). Millimetres. First-pass placement, to be refined after the user reviews the layout. */
export const BOARD = { w: 80, h: 60 } as const
export const FRONT = -BOARD.h / 2
export const BACK = BOARD.h / 2
/** Connector centres so the mating face overhangs the edge (see EDGE_Y). Front parts at 0 deg (face -y),
* back parts at 180 deg (face +y). */
export const J = {
A1: { x: -24, y: FRONT - EDGE_Y.usba3, rot: 0 },
A2: { x: -7, y: FRONT - EDGE_Y.usba3, rot: 0 },
C1: { x: 11, y: FRONT - EDGE_Y.usbc24, rot: 0 },
C2: { x: 26, y: FRONT - EDGE_Y.usbc24, rot: 0 },
HOST: { x: -2, y: BACK + EDGE_Y.usbc24, rot: 180 },
PWR: { x: 26, y: BACK + EDGE_Y.usbc16, rot: 180 },
} as const
export const HUB = { x: -4, y: 2 } as const
/** Schematic block origins (schematic units): the signal path across the top (host port, hub, the four downstream
* ports), the power tree along the bottom (PD input, 5.1 V buck, OR-ing, 3.3 V / 1.15 V rails). Each block places its
* parts relative to its origin; blocks/Hub.tsx assumes HUB stays at [0, 0]. */
export const S = {
UP: [-31.8, 3.0], HUB: [0, 0], A1: [12.8, 8.6], A2: [12.8, -1.6], C1: [35.4, 7.4], C2: [35.4, -9.2],
PD: [-31.0, -23.9], BUCK: [-7.6, -22.9], ORING: [-24.2, -33.8], RAILS: [33.4, -23.7],
} as const
/** Schematic sheets, in signal-flow order. Each sheet is its own scope for `tsci check schematic-placement` (the
* decoupling rule wants every cap of a rail within 4 units of the others on the same sheet), so ports and power
* stages get separate sheets. `at` is where the sheet title goes: above the block frame's top-left corner. */
export const SHEETS = {
UP: { name: "upstream", index: 0, title: "Upstream port (USB-C to host)", paper: "A4", at: [-33.0, 8.5] },
HUB: { name: "hub", index: 1, title: "USB 3.2 Gen 2 hub (USB7206C)", paper: "A3", at: [-12.4, 14.6] },
A1: { name: "usb-a-1", index: 2, title: "Downstream USB-A port 1", paper: "A4", at: [10.0, 11.4] },
A2: { name: "usb-a-2", index: 3, title: "Downstream USB-A port 2", paper: "A4", at: [10.0, 1.2] },
C1: { name: "usb-c-1", index: 4, title: "Downstream USB-C port 1", paper: "A4", at: [30.2, 12.2] },
C2: { name: "usb-c-2", index: 5, title: "Downstream USB-C port 2", paper: "A4", at: [30.2, -4.4] },
POWER: { name: "power", index: 6, title: "Power input, 5.1 V buck, 5 V OR-ing", paper: "A3", at: [-32.0, -20.5] },
RAILS: { name: "rails", index: 7, title: "3.3 V and 1.15 V rails, hub reset", paper: "A4", at: [30.8, -20.5] },
} as const
export const SHEET_COUNT = Object.keys(SHEETS).length
/** Sheet of each schematic section. Every part is tagged with its block's section; its sheet follows from it. Parts
* are NOT children of their <schematicsheet> (core auto-lays-out a sheet's children, ignoring schX/schY): each one
* names its sheet with schSheetName instead. */
const SHEET_OF: Record<string, string> = {
UP: SHEETS.UP.name, HUB: SHEETS.HUB.name, A1: SHEETS.A1.name, A2: SHEETS.A2.name, C1: SHEETS.C1.name, C2: SHEETS.C2.name,
PD: SHEETS.POWER.name, BUCK: SHEETS.POWER.name, ORING: SHEETS.POWER.name, RAILS: SHEETS.RAILS.name,
}
export const onSheet = (sec?: string): {} => (sec ? { schSheetName: SHEET_OF[sec] } : {})
export const sch = (sec: keyof typeof S, dx: number, dy: number) => ({ sx: S[sec][0] + dx, sy: S[sec][1] + dy, sec })