abse/gameboy-advance

Validates and exports a four-layer Game Boy–style PCB assembly with RP2350 MCU, 32MB flash, USB-C, LCD and speaker connectors, battery buck-boost power, buttons, and verified routing, connectivity, clearances, CAD models, and physical DRC.

Version
0.0.39
License
unset
Stars
0

schematic-layout.tsx

import { createElement } from "react";
import type { SchematicSheetProps, SchematicTextProps } from "@tscircuit/props";

const SchematicSheet = (props: SchematicSheetProps) =>
	createElement("schematicsheet", props);
const SchematicText = (props: SchematicTextProps) =>
	createElement("schematictext", props);

// Schematic-only organization. Coordinates use schematic world mm: +X right, +Y up.
// These notes and sheets create no source components or PCB copper.
const sheets = [
	{
		name: "processor",
		title: "Processor, Clock and Debug",
	},
	{
		name: "core-power",
		title: "RP2350 Core Regulator and Bypass",
	},
	{
		name: "usb",
		title: "USB Data and Power Detection",
	},
	{
		name: "battery",
		title: "AA Protection and 5V Converter",
	},
	{
		name: "rails",
		title: "USB Isolation and 3V2 Supply",
	},
	{
		name: "flash",
		title: "QSPI Firmware Flash",
	},
	{
		name: "psram",
		title: "QSPI Working RAM",
	},
	{
		name: "storage",
		title: "microSD Game Storage",
	},
	{
		name: "audio",
		title: "PWM Audio and Speaker",
	},
	{
		name: "display",
		title: "Display, Touch and Backlight",
	},
	{
		name: "controls",
		title: "Game Controls",
	},
] as const;
const notes = [
	{
		name: "U1",
		sheet: "processor",
		x: 0,
		y: 2,
		noteX: -0.816,
		noteY: 6.536,
		label: "U1: \nRuns console\nMemory / USB / LCD /\ncontrols",
		role: "Runs console",
		connection: "Memory / USB / LCD / controls",
	},
	{
		name: "U_XTAL",
		sheet: "processor",
		x: -10,
		y: 5,
		noteX: -12.697,
		noteY: 5.951,
		label: "U_XTAL: \nSets system clock\nU1 XIN / XOUT",
		role: "Sets system clock",
		connection: "U1 XIN / XOUT",
	},
	{
		name: "U_BOOTSEL",
		sheet: "processor",
		x: 11,
		y: 0,
		noteX: 10.051,
		noteY: 1.652,
		label: "U_BOOTSEL: \nSelects USB boot\nFlash CS / ground",
		role: "Selects USB boot",
		connection: "Flash CS / ground",
	},
	{
		name: "U_RUN",
		sheet: "processor",
		x: 11,
		y: 5,
		noteX: 10.107,
		noteY: 6.652,
		label: "U_RUN: \nResets processor\nU1 RUN / ground",
		role: "Resets processor",
		connection: "U1 RUN / ground",
	},
	{
		name: "U_CORE_INDUCTOR",
		sheet: "core-power",
		x: 0,
		y: 5,
		noteX: -1.06,
		noteY: 4.37,
		label: "U_CORE_INDUCTOR: \nConverts core power\nU1 LX / DVDD",
		role: "Converts core power",
		connection: "U1 LX / DVDD",
	},
	{
		name: "R_VREG_AVDD",
		sheet: "core-power",
		x: -7,
		y: 1,
		noteX: -6.15,
		noteY: 1.051,
		label: "R_VREG_AVDD: \nFilters analog rail\n3V2 / U1 VREG_AVDD",
		role: "Filters analog rail",
		connection: "3V2 / U1 VREG_AVDD",
		rotation: -90,
	},
	{
		name: "R_RUN",
		sheet: "processor",
		x: 8,
		y: 5,
		noteX: 7.107,
		noteY: 6.652,
		label: "R_RUN: \nHolds reset high\n3V2 / U1 RUN",
		role: "Holds reset high",
		connection: "3V2 / U1 RUN",
		rotation: 90,
	},
	{
		name: "C_VREG_IN",
		sheet: "core-power",
		x: -10,
		y: 5,
		noteX: -11.116,
		noteY: 4.05,
		label: "C_VREG_IN: \nBypasses core input\nU1 VREG_VIN / ground",
		role: "Bypasses core input",
		connection: "U1 VREG_VIN / ground",
	},
	{
		name: "C_CORE",
		sheet: "core-power",
		x: -3,
		y: -3,
		noteX: -4.06,
		noteY: -3.95,
		label: "C_CORE: \nSmooths core output\nDVDD / U1 VREG_PGND",
		role: "Smooths core output",
		connection: "DVDD / U1 VREG_PGND",
	},
	{
		name: "C_VREG_AVDD",
		sheet: "core-power",
		x: -7,
		y: -3,
		noteX: -6.15,
		noteY: -2.532,
		label: "C_VREG_AVDD: \nBypasses analog rail\nU1 VREG_AVDD /\nground",
		role: "Bypasses analog rail",
		connection: "U1 VREG_AVDD / ground",
	},
	{
		name: "C_QSPI_USB",
		sheet: "processor",
		x: -7,
		y: -3,
		noteX: -10.082,
		noteY: -2.649,
		label: "C_QSPI_USB: \nBypasses IO supply\nU1 QSPI / USB supply",
		role: "Bypasses IO supply",
		connection: "U1 QSPI / USB supply",
	},
	{
		name: "C_ADC",
		sheet: "processor",
		x: -5.2,
		y: -3,
		noteX: -6.016,
		noteY: -3.95,
		label: "C_ADC: \nBypasses ADC supply\nU1 ADC_AVDD / ground",
		role: "Bypasses ADC supply",
		connection: "U1 ADC_AVDD / ground",
	},
	{
		name: "C_XIN",
		sheet: "processor",
		x: -11,
		y: 1,
		noteX: -10.15,
		noteY: 1.351,
		label: "C_XIN: \nLoads crystal input\nU1 XIN / ground",
		role: "Loads crystal input",
		connection: "U1 XIN / ground",
	},
	{
		name: "C_XOUT",
		sheet: "processor",
		x: -9.2,
		y: 1,
		noteX: -10.082,
		noteY: 3.468,
		label: "C_XOUT: \nLoads crystal output\nCrystal XOUT /\nground",
		role: "Loads crystal output",
		connection: "Crystal XOUT / ground",
	},
	{
		name: "R_XOUT",
		sheet: "processor",
		x: -7,
		y: 5,
		noteX: -8.06,
		noteY: 6.427,
		label: "R_XOUT: \nDamps crystal drive\nU1 XOUT / crystal",
		role: "Damps crystal drive",
		connection: "U1 XOUT / crystal",
	},
	{
		name: "R_BOOTSEL",
		sheet: "processor",
		x: 8,
		y: 0,
		noteX: 6.996,
		noteY: 1.895,
		label: "R_BOOTSEL: \nLimits boot-switch\nload\nFlash CS / boot\nswitch",
		role: "Limits boot-switch load",
		connection: "Flash CS / boot switch",
	},
	{
		name: "TP_SWDIO",
		sheet: "processor",
		x: 9,
		y: -1,
		noteX: 9.562,
		noteY: -1.249,
		label: "TP_SWDIO: \nDebug data access\nU1 SWDIO",
		role: "Debug data access",
		connection: "U1 SWDIO",
	},
	{
		name: "TP_SWCLK",
		sheet: "processor",
		x: 9,
		y: -2.4,
		noteX: 6.429,
		noteY: -1.449,
		label: "TP_SWCLK: \nDebug clock access\nU1 SWCLK",
		role: "Debug clock access",
		connection: "U1 SWCLK",
	},
	{
		name: "TP_GND",
		sheet: "processor",
		x: 13,
		y: -2.4,
		noteX: 13.562,
		noteY: -1.932,
		label: "TP_GND: \nDebug ground\nreference\nGround plane",
		role: "Debug ground reference",
		connection: "Ground plane",
	},
	{
		name: "TP_3V3",
		sheet: "processor",
		x: 13,
		y: -1,
		noteX: 13.562,
		noteY: -0.649,
		label: "TP_3V3: \nMeasure logic supply\n3V2 rail",
		role: "Measure logic supply",
		connection: "3V2 rail",
	},
	{
		name: "C_IOVDD6",
		sheet: "processor",
		x: -3.4,
		y: -3,
		noteX: -4.104,
		noteY: -1.348,
		label: "C_IOVDD6: \nBypasses IO rail\nU1 IOVDD6 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD6 / ground",
	},
	{
		name: "C_IOVDD5",
		sheet: "processor",
		x: -1.5999999999999996,
		y: -3,
		noteX: -2.904,
		noteY: -3.95,
		label: "C_IOVDD5: \nBypasses IO rail\nU1 IOVDD5 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD5 / ground",
	},
	{
		name: "C_IOVDD4",
		sheet: "processor",
		x: 0.20000000000000018,
		y: -3,
		noteX: -0.504,
		noteY: -4.2,
		label: "C_IOVDD4: \nBypasses IO rail\nU1 IOVDD4 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD4 / ground",
	},
	{
		name: "C_IOVDD3",
		sheet: "processor",
		x: 2,
		y: -3,
		noteX: 1.996,
		noteY: -3.95,
		label: "C_IOVDD3: \nBypasses IO rail\nU1 IOVDD3 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD3 / ground",
	},
	{
		name: "C_IOVDD2",
		sheet: "processor",
		x: 3.8000000000000007,
		y: -3,
		noteX: 3.096,
		noteY: -1.348,
		label: "C_IOVDD2: \nBypasses IO rail\nU1 IOVDD2 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD2 / ground",
	},
	{
		name: "C_IOVDD1",
		sheet: "processor",
		x: 5.6,
		y: -3,
		noteX: 6.45,
		noteY: -2.649,
		label: "C_IOVDD1: \nBypasses IO rail\nU1 IOVDD1 / ground",
		role: "Bypasses IO rail",
		connection: "U1 IOVDD1 / ground",
	},
	{
		name: "C_DVDD3",
		sheet: "core-power",
		x: -1.2,
		y: -3,
		noteX: -2.204,
		noteY: -1.098,
		label: "C_DVDD3: \nBypasses core rail\nU1 DVDD3 / ground",
		role: "Bypasses core rail",
		connection: "U1 DVDD3 / ground",
	},
	{
		name: "C_DVDD2",
		sheet: "core-power",
		x: 0.6,
		y: -3,
		noteX: -0.404,
		noteY: -3.95,
		label: "C_DVDD2: \nBypasses core rail\nU1 DVDD2 / ground",
		role: "Bypasses core rail",
		connection: "U1 DVDD2 / ground",
	},
	{
		name: "C_DVDD2_BULK",
		sheet: "core-power",
		x: 2.4,
		y: -3,
		noteX: 1.451,
		noteY: -1.348,
		label: "C_DVDD2_BULK: \nBuffers core rail\nU1 DVDD2 / ground",
		role: "Buffers core rail",
		connection: "U1 DVDD2 / ground",
	},
	{
		name: "C_DVDD1",
		sheet: "core-power",
		x: 4.2,
		y: -3,
		noteX: 5.05,
		noteY: -2.649,
		label: "C_DVDD1: \nBypasses core rail\nU1 DVDD1 / ground",
		role: "Bypasses core rail",
		connection: "U1 DVDD1 / ground",
	},
	{
		name: "J_USB",
		sheet: "usb",
		x: -8,
		y: 6,
		noteX: -9.004,
		noteY: 4.45,
		label: "J_USB: \nUSB data and power\nU1 USB / VBUS /\nground",
		role: "USB data and power",
		connection: "U1 USB / VBUS / ground",
	},
	{
		name: "R_CC1",
		sheet: "usb",
		x: -12,
		y: 3,
		noteX: -14.97,
		noteY: 3.351,
		label: "R_CC1: \nAdvertises USB sink\nJ_USB CC1 / ground",
		role: "Advertises USB sink",
		connection: "J_USB CC1 / ground",
		rotation: -90,
	},
	{
		name: "R_CC2",
		sheet: "usb",
		x: -10,
		y: 3,
		noteX: -9.15,
		noteY: 3.351,
		label: "R_CC2: \nAdvertises USB sink\nJ_USB CC2 / ground",
		role: "Advertises USB sink",
		connection: "J_USB CC2 / ground",
		rotation: -90,
	},
	{
		name: "R_USB_DM",
		sheet: "usb",
		x: -3,
		y: 6,
		noteX: -4.116,
		noteY: 7.427,
		label: "R_USB_DM: \nDamps USB data\nJ_USB D- / U1 USB_DM",
		role: "Damps USB data",
		connection: "J_USB D- / U1 USB_DM",
	},
	{
		name: "R_USB_DP",
		sheet: "usb",
		x: -3,
		y: 3,
		noteX: -4.116,
		noteY: 2.275,
		label: "R_USB_DP: \nDamps USB data\nJ_USB D+ / U1 USB_DP",
		role: "Damps USB data",
		connection: "J_USB D+ / U1 USB_DP",
	},
	{
		name: "C_VBUS",
		sheet: "usb",
		x: -7,
		y: -3,
		noteX: -9.747,
		noteY: -2.649,
		label: "C_VBUS: \nSmooths USB input\nVBUS / ground",
		role: "Smooths USB input",
		connection: "VBUS / ground",
	},
	{
		name: "U_USB_VALID",
		sheet: "usb",
		x: 1,
		y: -2,
		noteX: -0.116,
		noteY: -2.95,
		label: "U_USB_VALID: \nDetects valid USB\npower\nVBUS / boost-disable\ntransistor",
		role: "Detects valid USB power",
		connection: "VBUS / boost-disable transistor",
		width: 2.1,
	},
	{
		name: "C_USB_VALID",
		sheet: "usb",
		x: -5.2,
		y: -3,
		noteX: -4.35,
		noteY: -2.415,
		label: "C_USB_VALID: \nBypasses USB\ndetector\nDetector VDD /\nground",
		role: "Bypasses USB detector",
		connection: "Detector VDD / ground",
	},
	{
		name: "R_USB_BOOST_OFF",
		sheet: "usb",
		x: 5,
		y: -2,
		noteX: 3.94,
		noteY: -2.95,
		label: "R_USB_BOOST_OFF: \nLimits disable base\ncurrent\nUSB detector /\ntransistor",
		role: "Limits disable base current",
		connection: "USB detector / transistor",
		rotation: 90,
	},
	{
		name: "Q_USB_BOOST_OFF",
		sheet: "usb",
		x: 9,
		y: -3,
		noteX: 8.051,
		noteY: -3.95,
		label: "Q_USB_BOOST_OFF: \nDisables boost on\nUSB\nUSB valid /\nconverter EN",
		role: "Disables boost on USB",
		connection: "USB valid / converter EN",
	},
	{
		name: "R_USB_BOOST_OFF_PULLDOWN",
		sheet: "usb",
		x: 6,
		y: -6,
		noteX: 4.549,
		noteY: -6.95,
		label: "R_USB_BOOST_OFF_PULLDOWN: \nKeeps disable\ninactive\nDisable base /\nground",
		role: "Keeps disable inactive",
		connection: "Disable base / ground",
		rotation: -90,
	},
	{
		name: "J_BAT",
		sheet: "battery",
		x: -14,
		y: 7,
		noteX: -16.786,
		noteY: 7.468,
		label: "J_BAT: \nConnects AA pack\nFuse / battery\nground",
		role: "Connects AA pack",
		connection: "Fuse / battery ground",
		rotation: -90,
		pinArrangement: {
			topSide: ["pin1"],
			bottomSide: ["pin2"],
		},
	},
	{
		name: "F_BAT",
		sheet: "battery",
		x: -12.86,
		y: 7,
		noteX: -12.976,
		noteY: 6.52,
		label: "F_BAT: \nLimits fault current\nAA pack / reverse\nFET",
		role: "Limits fault current",
		connection: "AA pack / reverse FET",
	},
	{
		name: "Q_BAT_REVERSE",
		sheet: "battery",
		x: -7.89,
		y: 7,
		noteX: -9.006,
		noteY: 8.886,
		label: "Q_BAT_REVERSE: \nBlocks reversed pack\nFuse / protected\nbattery",
		role: "Blocks reversed pack",
		connection: "Fuse / protected battery",
	},
	{
		name: "R_BAT_REVERSE_GATE",
		sheet: "battery",
		x: -10,
		y: 3,
		noteX: -9.15,
		noteY: 3.585,
		label: "R_BAT_REVERSE_GATE: \nBiases protection\nFET\nReverse FET gate /\nground",
		role: "Biases protection FET",
		connection: "Reverse FET gate / ground",
		rotation: -90,
	},
	{
		name: "U_BAT_BUCKBOOST",
		sheet: "battery",
		x: 2.9,
		y: 1,
		noteX: 1.784,
		noteY: 3.386,
		label: "U_BAT_BUCKBOOST: \nRegulates pack to 5V\nProtected AA /\nBAT_5V",
		role: "Regulates pack to 5V",
		connection: "Protected AA / BAT_5V",
		pinSpacing: 0.35,
	},
	{
		name: "L_BAT_BUCKBOOST",
		sheet: "battery",
		x: 6.31,
		y: 0.2,
		noteX: 5.194,
		noteY: -0.728,
		label: "L_BAT_BUCKBOOST: \nTransfers converter\nenergy\nU_BAT_BUCKBOOST L1 /\nL2",
		role: "Transfers converter energy",
		connection: "U_BAT_BUCKBOOST L1 / L2",
		rotation: 0,
		orientation: "vertical",
	},
	{
		name: "C_BAT_IN_LOCAL",
		sheet: "battery",
		x: 7,
		y: -3,
		noteX: 4.03,
		noteY: -2.532,
		label: "C_BAT_IN_LOCAL: \nBypasses pack input\nConverter VIN /\nground",
		role: "Bypasses pack input",
		connection: "Converter VIN / ground",
	},
	{
		name: "C_BAT_IN_BULK_A",
		sheet: "battery",
		x: 8.8,
		y: -3,
		noteX: 7.796,
		noteY: -3.95,
		label: "C_BAT_IN_BULK_A: \nBuffers pack input\nConverter VIN /\nground",
		role: "Buffers pack input",
		connection: "Converter VIN / ground",
	},
	{
		name: "C_BAT_IN_BULK_B",
		sheet: "battery",
		x: 10.6,
		y: -3,
		noteX: 11.45,
		noteY: -2.532,
		label: "C_BAT_IN_BULK_B: \nBuffers pack input\nConverter VIN /\nground",
		role: "Buffers pack input",
		connection: "Converter VIN / ground",
	},
	{
		name: "C_BAT_OUT_LOCAL",
		sheet: "battery",
		x: -9,
		y: -3,
		noteX: -11.747,
		noteY: -2.532,
		label: "C_BAT_OUT_LOCAL: \nSmooths 5V output\nConverter VOUT /\nground",
		role: "Smooths 5V output",
		connection: "Converter VOUT / ground",
	},
	{
		name: "C_BAT_OUT_BULK_A",
		sheet: "battery",
		x: -7.2,
		y: -3,
		noteX: -8.204,
		noteY: -3.95,
		label: "C_BAT_OUT_BULK_A: \nBuffers 5V output\nConverter VOUT /\nground",
		role: "Buffers 5V output",
		connection: "Converter VOUT / ground",
	},
	{
		name: "C_BAT_OUT_BULK_B",
		sheet: "battery",
		x: -5.4,
		y: -3,
		noteX: -5.804,
		noteY: -3.95,
		label: "C_BAT_OUT_BULK_B: \nBuffers 5V output\nConverter VOUT /\nground",
		role: "Buffers 5V output",
		connection: "Converter VOUT / ground",
	},
	{
		name: "C_BAT_OUT_BULK_C",
		sheet: "battery",
		x: -3.6,
		y: -3,
		noteX: -3.604,
		noteY: -3.95,
		label: "C_BAT_OUT_BULK_C: \nBuffers 5V output\nConverter VOUT /\nground",
		role: "Buffers 5V output",
		connection: "Converter VOUT / ground",
	},
	{
		name: "C_BAT_VAUX",
		sheet: "battery",
		x: -1.3,
		y: 2,
		noteX: -1.704,
		noteY: 4.12,
		label: "C_BAT_VAUX: \nBypasses auxiliary\nrail\nConverter VAUX /\nground",
		role: "Bypasses auxiliary rail",
		connection: "Converter VAUX / ground",
	},
	{
		name: "R_BAT_FB_TOP",
		sheet: "battery",
		x: -1,
		y: -2,
		noteX: -0.15,
		noteY: -1.532,
		label: "R_BAT_FB_TOP: \nSets 5V feedback\nBAT_5V / converter\nFB",
		role: "Sets 5V feedback",
		connection: "BAT_5V / converter FB",
		rotation: -90,
	},
	{
		name: "R_BAT_FB_BOTTOM",
		sheet: "battery",
		x: -1,
		y: -6,
		noteX: -0.15,
		noteY: -5.415,
		label: "R_BAT_FB_BOTTOM: \nReturns feedback\ndivider\nConverter FB /\nground",
		role: "Returns feedback divider",
		connection: "Converter FB / ground",
		rotation: -90,
	},
	{
		name: "R_BAT_MODE",
		sheet: "battery",
		x: -2.5,
		y: 4,
		noteX: -5.136,
		noteY: 4.885,
		label: "R_BAT_MODE: \nBiases converter\nmode\nConverter VIN /\nPS_SYNC",
		role: "Biases converter mode",
		connection: "Converter VIN / PS_SYNC",
		rotation: -90,
	},
	{
		name: "R_BAT_EN_TOP",
		sheet: "battery",
		x: 9,
		y: 4,
		noteX: 9.85,
		noteY: 4.468,
		label: "R_BAT_EN_TOP: \nSets pack cutoff\nSwitched pack /\nconverter EN",
		role: "Sets pack cutoff",
		connection: "Switched pack / converter EN",
		rotation: -90,
	},
	{
		name: "R_BAT_EN_BOTTOM",
		sheet: "battery",
		x: 9,
		y: 0,
		noteX: 9.85,
		noteY: -0.015,
		label: "R_BAT_EN_BOTTOM: \nSelects 3/4-AA\ncutoff\nConverter EN /\nground",
		role: "Selects 3/4-AA cutoff",
		connection: "Converter EN / ground",
		rotation: -90,
	},
	{
		name: "D_BAT_POWER",
		sheet: "battery",
		x: -4,
		y: 3,
		noteX: -4.593,
		noteY: 2.33,
		label: "D_BAT_POWER: \nIsolates battery\nsource\nBAT_5V / VSYS",
		role: "Isolates battery source",
		connection: "BAT_5V / VSYS",
	},
	{
		name: "J_PWR_SW",
		sheet: "battery",
		x: -0.26,
		y: 7,
		noteX: -1.097,
		noteY: 9.22,
		label: "J_PWR_SW: \nEnables battery\npower\nProtected AA /\nconverter EN",
		role: "Enables battery power",
		connection: "Protected AA / converter EN",
	},
	{
		name: "D_USB_POWER",
		sheet: "rails",
		x: -8,
		y: 2,
		noteX: -9.06,
		noteY: 1.33,
		label: "D_USB_POWER: \nIsolates USB source\nVBUS / VSYS",
		role: "Isolates USB source",
		connection: "VBUS / VSYS",
	},
	{
		name: "U_3V3",
		sheet: "rails",
		x: 0,
		y: 2,
		noteX: -0.837,
		noteY: 0.95,
		label: "U_3V3: \nRegulates logic\nsupply\nVSYS / 3V2",
		role: "Regulates logic supply",
		connection: "VSYS / 3V2",
	},
	{
		name: "L_3V3",
		sheet: "rails",
		x: 4,
		y: 2,
		noteX: 3.219,
		noteY: 1.37,
		label: "L_3V3: \nSmooths buck\nswitching\nU_3V2 SW / 3V2",
		role: "Smooths buck switching",
		connection: "U_3V2 SW / 3V2",
	},
	{
		name: "C_3V3_IN",
		sheet: "rails",
		x: -4,
		y: 0,
		noteX: -3.15,
		noteY: 0.351,
		label: "C_3V3_IN: \nBypasses buck input\nVSYS / ground",
		role: "Bypasses buck input",
		connection: "VSYS / ground",
	},
	{
		name: "C_3V3_BST",
		sheet: "rails",
		x: 3,
		y: 5,
		noteX: 3.85,
		noteY: 5.468,
		label: "C_3V3_BST: \nBootstraps buck\ndriver\nU_3V2 BST / SW",
		role: "Bootstraps buck driver",
		connection: "U_3V2 BST / SW",
		rotation: 180,
		orientation: "pos_bottom",
	},
	{
		name: "C_3V3_OUT_A",
		sheet: "rails",
		x: 6,
		y: -1,
		noteX: 2.918,
		noteY: -0.649,
		label: "C_3V3_OUT_A: \nSmooths logic output\n3V2 / ground",
		role: "Smooths logic output",
		connection: "3V2 / ground",
	},
	{
		name: "C_3V3_OUT_B",
		sheet: "rails",
		x: 7.8,
		y: -1,
		noteX: 8.65,
		noteY: -0.649,
		label: "C_3V3_OUT_B: \nBuffers logic output\n3V2 / ground",
		role: "Buffers logic output",
		connection: "3V2 / ground",
	},
	{
		name: "U2",
		sheet: "flash",
		x: 0,
		y: 1,
		noteX: 1.09,
		noteY: 1.351,
		label: "U2: \nStores firmware\nU1 QSPI bus",
		role: "Stores firmware",
		connection: "U1 QSPI bus",
	},
	{
		name: "R_BOOT",
		sheet: "flash",
		x: -3,
		y: 4,
		noteX: -4.06,
		noteY: 5.402,
		label: "R_BOOT: \nHolds flash CS high\n3V2 / flash CS",
		role: "Holds flash CS high",
		connection: "3V2 / flash CS",
		rotation: 90,
	},
	{
		name: "C_FLASH",
		sheet: "flash",
		x: 4,
		y: 1,
		noteX: 4.85,
		noteY: 1.468,
		label: "C_FLASH: \nBypasses flash\nsupply\nU2 VCC / ground",
		role: "Bypasses flash supply",
		connection: "U2 VCC / ground",
	},
	{
		name: "U_PSRAM",
		sheet: "psram",
		x: 0,
		y: 1,
		noteX: -0.893,
		noteY: -0.25,
		label: "U_PSRAM: \nAdds working RAM\nU1 QSPI / PSRAM\nselect",
		role: "Adds working RAM",
		connection: "U1 QSPI / PSRAM select",
	},
	{
		name: "C_PSRAM",
		sheet: "psram",
		x: 4,
		y: 1,
		noteX: 2.584,
		noteY: 0.05,
		label: "C_PSRAM: \nBypasses RAM supply\nU_PSRAM VDD / ground",
		role: "Bypasses RAM supply",
		connection: "U_PSRAM VDD / ground",
	},
	{
		name: "R_PSRAM_CE",
		sheet: "psram",
		x: -3,
		y: 4,
		noteX: -2.15,
		noteY: 4.051,
		label: "R_PSRAM_CE: \nHolds RAM deselected\n3V2 / U_PSRAM CE",
		role: "Holds RAM deselected",
		connection: "3V2 / U_PSRAM CE",
		rotation: 90,
	},
	{
		name: "C_PSRAM_BULK",
		sheet: "psram",
		x: 5.8,
		y: 1,
		noteX: 6.65,
		noteY: 1.351,
		label: "C_PSRAM_BULK: \nBuffers RAM supply\nU_PSRAM VDD / ground",
		role: "Buffers RAM supply",
		connection: "U_PSRAM VDD / ground",
	},
	{
		name: "J_SD",
		sheet: "storage",
		x: 0,
		y: 1,
		noteX: -1.116,
		noteY: -0.45,
		label: "J_SD: \nAccepts game storage\nU1 SD bus / 3V2",
		role: "Accepts game storage",
		connection: "U1 SD bus / 3V2",
	},
	{
		name: "C_SD",
		sheet: "storage",
		x: 6,
		y: -3,
		noteX: 2.918,
		noteY: -2.649,
		label: "C_SD: \nBypasses card supply\nJ_SD VDD / ground",
		role: "Bypasses card supply",
		connection: "J_SD VDD / ground",
	},
	{
		name: "R_SD_CMD",
		sheet: "storage",
		x: -7,
		y: 4,
		noteX: -7.949,
		noteY: 5.636,
		label: "R_SD_CMD: \nHolds card signal\nhigh\n3V2 / J_SD CMD",
		role: "Holds card signal high",
		connection: "3V2 / J_SD CMD",
		rotation: 90,
	},
	{
		name: "R_SD_CS",
		sheet: "storage",
		x: -5,
		y: 4,
		noteX: -5.949,
		noteY: 6.736,
		label: "R_SD_CS: \nHolds card signal\nhigh\n3V2 / J_SD CS",
		role: "Holds card signal high",
		connection: "3V2 / J_SD CS",
		rotation: 90,
	},
	{
		name: "R_SD_DAT0",
		sheet: "storage",
		x: -3,
		y: 4,
		noteX: -3.949,
		noteY: 5.636,
		label: "R_SD_DAT0: \nHolds card signal\nhigh\n3V2 / J_SD DAT0",
		role: "Holds card signal high",
		connection: "3V2 / J_SD DAT0",
		rotation: 90,
	},
	{
		name: "R_SD_DAT1",
		sheet: "storage",
		x: 3,
		y: 4,
		noteX: 2.051,
		noteY: 5.636,
		label: "R_SD_DAT1: \nHolds card signal\nhigh\n3V2 / J_SD DAT1",
		role: "Holds card signal high",
		connection: "3V2 / J_SD DAT1",
		rotation: 90,
	},
	{
		name: "R_SD_DAT2",
		sheet: "storage",
		x: 5,
		y: 4,
		noteX: 5.85,
		noteY: 4.168,
		label: "R_SD_DAT2: \nHolds card signal\nhigh\n3V2 / J_SD DAT2",
		role: "Holds card signal high",
		connection: "3V2 / J_SD DAT2",
		rotation: 90,
	},
	{
		name: "C_SD_BULK",
		sheet: "storage",
		x: 7.8,
		y: -3,
		noteX: 8.65,
		noteY: -2.832,
		label: "C_SD_BULK: \nBuffers card\ntransients\nJ_SD VDD / ground",
		role: "Buffers card transients",
		connection: "J_SD VDD / ground",
	},
	{
		name: "R_AMP_IN",
		sheet: "audio",
		x: -13,
		y: 5,
		noteX: -13.949,
		noteY: 4.275,
		label: "R_AMP_IN: \nFilters PWM audio\nU1 GPIO22 / audio\nfilter",
		role: "Filters PWM audio",
		connection: "U1 GPIO22 / audio filter",
	},
	{
		name: "C_AMP_PWM_FILTER",
		sheet: "audio",
		x: -10,
		y: 2,
		noteX: -9.15,
		noteY: 2.351,
		label: "C_AMP_PWM_FILTER: \nRemoves PWM carrier\nPWM filter / ground",
		role: "Removes PWM carrier",
		connection: "PWM filter / ground",
	},
	{
		name: "C_AMP_IN_COUPLE",
		sheet: "audio",
		x: -1,
		y: 5,
		noteX: -1.704,
		noteY: 7.436,
		label: "C_AMP_IN_COUPLE: \nBlocks input DC\nVolume wiper / amp\ninput",
		role: "Blocks input DC",
		connection: "Volume wiper / amp input",
	},
	{
		name: "C_AMP_POT_COUPLE",
		sheet: "audio",
		x: -7,
		y: 6,
		noteX: -8.06,
		noteY: 8.12,
		label: "C_AMP_POT_COUPLE: \nCouples filtered\naudio\nPWM filter / volume\ncontrol",
		role: "Couples filtered audio",
		connection: "PWM filter / volume control",
	},
	{
		name: "RV_VOLUME",
		sheet: "audio",
		x: -3,
		y: 5,
		noteX: -4.116,
		noteY: 7.086,
		label: "RV_VOLUME: \nAdjusts loudness\nFiltered audio / amp\ninput",
		role: "Adjusts loudness",
		connection: "Filtered audio / amp input",
	},
	{
		name: "U_SPK_AMP",
		sheet: "audio",
		x: 3,
		y: 5,
		noteX: 1.94,
		noteY: 3.45,
		label: "U_SPK_AMP: \nDrives mono speaker\nFiltered audio /\nJ_SPK",
		role: "Drives mono speaker",
		connection: "Filtered audio / J_SPK",
	},
	{
		name: "C_AMP_VDD",
		sheet: "audio",
		x: 0,
		y: -1,
		noteX: -2.859,
		noteY: -0.532,
		label: "C_AMP_VDD: \nBypasses amplifier\nrail\nVSYS / amp ground",
		role: "Bypasses amplifier rail",
		connection: "VSYS / amp ground",
	},
	{
		name: "C_AMP_VDD_BULK",
		sheet: "audio",
		x: 1.8,
		y: -1,
		noteX: 0.74,
		noteY: -2.2,
		label: "C_AMP_VDD_BULK: \nBuffers audio peaks\nVSYS / amp ground",
		role: "Buffers audio peaks",
		connection: "VSYS / amp ground",
	},
	{
		name: "C_AMP_VREF",
		sheet: "audio",
		x: -1,
		y: 2,
		noteX: -0.15,
		noteY: 2.468,
		label: "C_AMP_VREF: \nStabilizes audio\nbias\nAmp VREF / ground",
		role: "Stabilizes audio bias",
		connection: "Amp VREF / ground",
	},
	{
		name: "FB_SPK_POS",
		sheet: "audio",
		x: 7,
		y: 7,
		noteX: 5.884,
		noteY: 6.15,
		label: "FB_SPK_POS: \nFilters speaker EMI\nAmp L+ / J_SPK pin 1",
		role: "Filters speaker EMI",
		connection: "Amp L+ / J_SPK pin 1",
	},
	{
		name: "FB_SPK_NEG",
		sheet: "audio",
		x: 7,
		y: 3,
		noteX: 5.884,
		noteY: 2.15,
		label: "FB_SPK_NEG: \nFilters speaker EMI\nAmp L- / J_SPK pin 2",
		role: "Filters speaker EMI",
		connection: "Amp L- / J_SPK pin 2",
	},
	{
		name: "C_SPK_EMI_POS",
		sheet: "audio",
		x: 10,
		y: 7,
		noteX: 10.85,
		noteY: 7.468,
		label: "C_SPK_EMI_POS: \nShunts positive-\noutput RF\nSpeaker + / ground",
		role: "Shunts positive-output RF",
		connection: "Speaker + / ground",
	},
	{
		name: "C_SPK_EMI_NEG",
		sheet: "audio",
		x: 10,
		y: 3,
		noteX: 10.85,
		noteY: 3.468,
		label: "C_SPK_EMI_NEG: \nShunts negative-\noutput RF\nSpeaker - / ground",
		role: "Shunts negative-output RF",
		connection: "Speaker - / ground",
	},
	{
		name: "J_SPK",
		sheet: "audio",
		x: 14,
		y: 5,
		noteX: 13.051,
		noteY: 4.05,
		label: "J_SPK: \nJST-SH speaker\noutput\nAmp L+ / L-; no\nground",
		role: "JST-SH speaker output",
		connection: "Amp L+ / L-; no ground",
	},
	{
		name: "J_LCD",
		sheet: "display",
		x: 0,
		y: 2,
		noteX: -1.116,
		noteY: 6.52,
		label: "J_LCD: \nConnects LCD and\ntouch\nU1 SPI / touch I2C /\nrails",
		role: "Connects LCD and touch",
		connection: "U1 SPI / touch I2C / rails",
	},
	{
		name: "C_LCD_VDDI",
		sheet: "display",
		x: -5,
		y: -3,
		noteX: -7.97,
		noteY: -2.649,
		label: "C_LCD_VDDI: \nBypasses display IO\nLCD VDDI / ground",
		role: "Bypasses display IO",
		connection: "LCD VDDI / ground",
	},
	{
		name: "C_LCD_VCI",
		sheet: "display",
		x: -3.2,
		y: -3,
		noteX: -4.093,
		noteY: -3.95,
		label: "C_LCD_VCI: \nBypasses display\nlogic\nLCD VCI / ground",
		role: "Bypasses display logic",
		connection: "LCD VCI / ground",
	},
	{
		name: "R_TOUCH_SCL",
		sheet: "display",
		x: -7,
		y: 4,
		noteX: -7.949,
		noteY: 5.636,
		label: "R_TOUCH_SCL: \nPulls touch clock\nhigh\n3V2 / touch SCL",
		role: "Pulls touch clock high",
		connection: "3V2 / touch SCL",
		rotation: 90,
	},
	{
		name: "R_TOUCH_SDA",
		sheet: "display",
		x: -5,
		y: 4,
		noteX: -5.893,
		noteY: 3.05,
		label: "R_TOUCH_SDA: \nPulls touch data\nhigh\n3V2 / touch SDA",
		role: "Pulls touch data high",
		connection: "3V2 / touch SDA",
		rotation: 90,
	},
	{
		name: "R_TOUCH_IRQ",
		sheet: "display",
		x: -3,
		y: 4,
		noteX: -3.837,
		noteY: 5.636,
		label: "R_TOUCH_IRQ: \nPulls touch\ninterrupt high\n3V2 / touch IRQ",
		role: "Pulls touch interrupt high",
		connection: "3V2 / touch IRQ",
		rotation: 90,
	},
	{
		name: "R_LCD_LED",
		sheet: "display",
		x: 6,
		y: 4,
		noteX: 4.884,
		noteY: 5.886,
		label: "R_LCD_LED: \nLimits backlight\ncurrent\nVSYS / LCD backlight",
		role: "Limits backlight current",
		connection: "VSYS / LCD backlight",
		rotation: -90,
	},
	{
		name: "Q_LCD_BL",
		sheet: "display",
		x: 6,
		y: 0,
		noteX: 5.136,
		noteY: -0.85,
		label: "Q_LCD_BL: \nSwitches backlight\nPWM\nU1 GPIO24 / LED\ncathodes",
		role: "Switches backlight PWM",
		connection: "U1 GPIO24 / LED cathodes",
	},
	{
		name: "R_LCD_BL_PULLDOWN",
		sheet: "display",
		x: 3,
		y: -1,
		noteX: 1.94,
		noteY: -1.95,
		label: "R_LCD_BL_PULLDOWN: \nKeeps backlight off\nat reset\nBacklight gate /\nground",
		role: "Keeps backlight off at reset",
		connection: "Backlight gate / ground",
		rotation: -90,
	},
	{
		name: "SW_UP",
		sheet: "controls",
		x: -6,
		y: 5,
		noteX: -6.949,
		noteY: 4.15,
		label: "SW_UP: \nUp button\nU1 GPIO2 / ground",
		role: "Up button",
		connection: "U1 GPIO2 / ground",
	},
	{
		name: "SW_DOWN",
		sheet: "controls",
		x: -2,
		y: 5,
		noteX: -2.949,
		noteY: 4.4,
		label: "SW_DOWN: \nDown button\nU1 GPIO3 / ground",
		role: "Down button",
		connection: "U1 GPIO3 / ground",
	},
	{
		name: "SW_LEFT",
		sheet: "controls",
		x: 2,
		y: 5,
		noteX: 1.051,
		noteY: 4.15,
		label: "SW_LEFT: \nLeft button\nU1 GPIO4 / ground",
		role: "Left button",
		connection: "U1 GPIO4 / ground",
	},
	{
		name: "SW_RIGHT",
		sheet: "controls",
		x: 6,
		y: 5,
		noteX: 5.051,
		noteY: 4.4,
		label: "SW_RIGHT: \nRight button\nU1 GPIO5 / ground",
		role: "Right button",
		connection: "U1 GPIO5 / ground",
	},
	{
		name: "SW_A",
		sheet: "controls",
		x: -6,
		y: 1,
		noteX: -6.949,
		noteY: 0.15,
		label: "SW_A: \nA button\nU1 GPIO6 / ground",
		role: "A button",
		connection: "U1 GPIO6 / ground",
	},
	{
		name: "SW_B",
		sheet: "controls",
		x: -2,
		y: 1,
		noteX: -2.949,
		noteY: 0.4,
		label: "SW_B: \nB button\nU1 GPIO7 / ground",
		role: "B button",
		connection: "U1 GPIO7 / ground",
	},
	{
		name: "SW_X",
		sheet: "controls",
		x: 2,
		y: 1,
		noteX: 0.996,
		noteY: 0.15,
		label: "SW_X: \nX button\nU1 GPIO12 / ground",
		role: "X button",
		connection: "U1 GPIO12 / ground",
	},
	{
		name: "SW_Y",
		sheet: "controls",
		x: 6,
		y: 1,
		noteX: 5.051,
		noteY: 0.4,
		label: "SW_Y: \nY button\nU1 GPIO9 / ground",
		role: "Y button",
		connection: "U1 GPIO9 / ground",
	},
	{
		name: "SW_SELECT",
		sheet: "controls",
		x: -6,
		y: -3,
		noteX: -7.004,
		noteY: -3.85,
		label: "SW_SELECT: \nSelect button\nU1 GPIO15 / ground",
		role: "Select button",
		connection: "U1 GPIO15 / ground",
	},
	{
		name: "SW_START",
		sheet: "controls",
		x: -2,
		y: -3,
		noteX: -3.004,
		noteY: -3.6,
		label: "SW_START: \nStart button\nU1 GPIO11 / ground",
		role: "Start button",
		connection: "U1 GPIO11 / ground",
	},
	{
		name: "SW_L",
		sheet: "controls",
		x: 2,
		y: -3,
		noteX: 0.996,
		noteY: -3.6,
		label: "SW_L: \nL button\nU1 GPIO13 / ground",
		role: "L button",
		connection: "U1 GPIO13 / ground",
	},
	{
		name: "SW_R",
		sheet: "controls",
		x: 6,
		y: -3,
		noteX: 4.996,
		noteY: -3.85,
		label: "SW_R: \nR button\nU1 GPIO14 / ground",
		role: "R button",
		connection: "U1 GPIO14 / ground",
	},
{"name": "R_LOGIC_FB_TOP", "sheet": "rails", "x": 10, "y": 2, "noteX": 10.85, "noteY": 2.35, "label": "R_LOGIC_FB_TOP: \nSets3.23V supply\nLogic output / FB", "role": "Sets3.23V supply", "connection": "Logic output / FB"},{"name": "R_LOGIC_FB_BOTTOM", "sheet": "rails", "x": 10, "y": -2, "noteX": 10.85, "noteY": -1.65, "label": "R_LOGIC_FB_BOTTOM: \nSets feedback ratio\nFB / ground", "role": "Sets feedback ratio", "connection": "FB / ground"},{"name": "R_SPK_LIMIT", "sheet": "audio", "x": 3, "y": -7, "noteX": 3.85, "noteY": -6.65, "label": "R_SPK_LIMIT: \nLimits audio gain\nCoupling cap / INL", "role": "Limits audio gain", "connection": "Coupling cap / INL"},
{"name": "R_LOGIC_FB_TRIM", "sheet": "rails", "x": 10, "y": 6, "noteX": 10.85, "noteY": 6.35, "label": "R_LOGIC_FB_TRIM: \nAdds voltage margin\nOutput / upper divider", "role": "Adds voltage margin", "connection": "Output / upper divider"},
] as const;

export const SchematicSheets = () => (
	<>
		{sheets.map((sheet, sheetIndex) => {
			const sheetNotes = notes.filter((note) => note.sheet === sheet.name);
			const headingY = Math.max(...sheetNotes.map((note) => Math.max(note.y, note.noteY))) + 1.6;
			return (
				<SchematicSheet
					key={sheet.name}
					name={sheet.name}
					displayName={sheet.title}
					sheetIndex={sheetIndex}
					sheetSize="A4"
				>
					<SchematicText
						text={sheet.title}
						schX={-13.5}
						schY={headingY}
						fontSize={0.55}
						anchor="top_left"
					/>
					{sheetNotes.map((note) => (
						<SchematicText
							key={note.name}
							text={note.label}
							schX={note.noteX}
							schY={note.noteY}
							fontSize={0.18}
							anchor="top_left"
							color="#334155"
						/>
					))}
				</SchematicSheet>
			);
		})}
	</>
);