gokul/usb3-sd-hub
Engineering draft: four-layer, computer-powered USB 3 hub with one USB-C host socket, two USB-C and two USB-A accessory sockets, and a full-size SD slot. Board and three schematic previews are available. Routing and production checks are incomplete; not fabrication ready.
- Version
- 0.1.5
- License
- MIT
- Stars
- 0
design/downstream-one-receive.ts
import {
wire,
via,
offsetPath,
matchOnHorizontal,
halfCenterGapMm,
type NumericPath,
type Point,
} from "./paired-paths";
const hubEscape: Point[] = [
{ x: -6.6, y: 5.6 },
{ x: -6.9, y: 5.6 },
{ x: -7.6, y: 4.9 },
{ x: -8.7, y: 4.9 },
];
const bottomPath: Point[] = [
{ x: -9.5, y: 5.05 },
{ x: -10.5, y: 5.05 },
{ x: -11.5, y: 4.05 },
{ x: -11.5, y: -5.5 },
{ x: -10.5, y: -6.5 },
{ x: 29.1, y: -6.5 },
{ x: 30.1, y: -5.5 },
{ x: 30.1, y: 0.9 },
];
function receivePath(positive: boolean): NumericPath {
const offsetMm = positive ? halfCenterGapMm : -halfCenterGapMm;
const hubPad = { x: -5.85, y: positive ? 5.8 : 5.4 };
const muxPad = {
x: positive ? 30.3000472 : 29.900048,
y: positive ? 2.7999008 : 2.800104,
};
const firstVia = { x: -9.1, y: positive ? 5.25 : 4.55 };
const secondVia = { x: positive ? 30.45 : 29.75, y: 1.4 };
const escape = offsetPath({ points: hubEscape, offsetMm });
const spine = offsetPath({ points: bottomPath, offsetMm });
const last = spine.at(-1)!;
return {
connection: positive ? "U_HUB.D1_RXP" : "U_HUB.D1_RXN",
route: [
wire(hubPad, "top"),
...escape.map((point) => wire(point, "top")),
wire(firstVia, "top"),
via(firstVia, "top"),
wire(firstVia),
...spine.map((point) => wire(point)),
wire({ x: last.x, y: secondVia.y - Math.abs(last.x - secondVia.x) }),
wire(secondVia),
via(secondVia, "bottom"),
wire(secondVia, "top"),
wire(
{ x: secondVia.x, y: 2.35 - Math.abs(muxPad.x - secondVia.x) },
"top",
),
wire({ x: muxPad.x, y: 2.35 }, "top"),
wire(muxPad, "top"),
],
};
}
export const downstreamOneReceivePaths = matchOnHorizontal({
paths: [receivePath(true), receivePath(false)],
startXsMm: [-7, -1, 5, 11, 17, 23],
awayDirection: [-1, 1],
});