astra/f1c100s

This code defines and renders a four-layer, top-mounted F1C100S module with detailed pin assignments, schematic annotations, and layout profiles, facilitating design, validation, and routing of the hardware including support for decoupling capacitors, crystal oscillators, and external connectors.

Version
0.11.0
License
unset
Stars
0

src/UnroutedModule.tsx

import { capacitorSpecs, isLargeCapacitor } from "./capacitor-specs";
import { BreakoutTestPoint } from "./BreakoutTestPoint";
import { ClockCrystal } from "./ClockCrystal";
import { F1C100S } from "../imports/F1C100S";
import { makeLayout } from "./layout";
import type { LayoutProfile } from "./profiles";

export function UnroutedModule({
	layoutProfile,
}: {
	layoutProfile: LayoutProfile;
}) {
	const layout = makeLayout(layoutProfile);
	return (
		<group name="MODULE" pcbX={0} pcbY={0}>
			<F1C100S
				name="U1"
				pcbRotation={layout.rotation}
				schX={0}
				schY={0}
				schWidth={14}
				schHeight={24}
			/>
			<ClockCrystal placement={layout.crystal} />
			{layout.terminals.map((t) => (
				<BreakoutTestPoint key={t.name} terminal={t} />
			))}
			{layout.passives.map((p, i) =>
				p.kind === "capacitor" ? (
					<capacitor
						key={p.name}
						name={p.name}
						capacitance={p.value}
						{...capacitorSpecs(p.name, p.value)}
						layer={isLargeCapacitor(p.name, p.value) ? "bottom" : "top"}
						pcbX={p.x}
						pcbY={p.y}
						pcbRotation={p.rotation}
						schX={-22 + (i % 5) * 3}
						schY={18 - Math.floor(i / 5) * 3}
					/>
				) : (
					<resistor
						key={p.name}
						name={p.name}
						resistance={p.value}
						pcbRotation={p.rotation}
						footprint="0402"
						layer="top"
						pcbX={p.x}
						pcbY={p.y}
						schX={-22 + (i % 5) * 3}
						schY={18 - Math.floor(i / 5) * 3}
					/>
				),
			)}
			{/* maxLength bounds the aggregate multi-terminal rail tree. It is not a
        decoupling-loop constraint. The generator requires a separate physical branch
        from every C_D supply pad to its assigned U1 pin before routing these rails.
        Runtime inflation exposes those branches as explicit two-port traces. */}
			{Object.entries(layout.nets).map(([name, ports]) => (
				<trace
					key={name}
					name={`N_${name}`}
					path={ports}
					thickness={0.12}
					maxLength={1000}
				/>
			))}
		</group>
	);
}