0hmX/esp32-s3-usb-webcam-ov2640

This code defines and integrates a variety of surface-mount, through-hole, and connector hardware components (including microcontrollers, regulators, resistors, capacitors, and connectors) into a PCB design framework, enabling schematic symbol creation, footprint definition, and automated routing within an electronic circuit layout.

Version
1.0.7
License
unset
Stars
0

src/routing-phases.ts

PCBPCB preview for src/routing-phases.ts
SchematicSchematic preview for src/routing-phases.ts
export const BOARD_ROUTING_PHASES = [
  {
    name: "critical-local-power",
    phaseIndex: 0,
    connections: [
      ".U_3V3 > .VIN",
      ".U_3V3 > .SW",
      ".U_3V3 > .FB",
      ".L_3V3 > .pin1",
      ".L_3V3 > .pin2",
      ".C_BUCK_IN > .pin1",
      ".C_BUCK_IN_HF > .pin1",
      ".C_BUCK_OUT > .pin1",
      ".C_BUCK_FF > .pin1",
      ".C_BUCK_FF > .pin2",
      ".R_BUCK_TOP > .pin1",
      ".R_BUCK_TOP > .pin2",
      ".R_BUCK_BOT > .pin1",
      ".U_CAM_2V8 > .VIN",
      ".U_CAM_2V8 > .VOUT",
      ".C_2V8_IN > .pin1",
      ".C_2V8_OUT > .pin1",
      ".U_CAM_1V3 > .IN",
      ".U_CAM_1V3 > .OUT",
      ".U_CAM_1V3 > .FB",
      ".C_1V3_IN > .pin1",
      ".C_1V3_OUT > .pin1",
      ".R_1V3_TOP > .pin1",
      ".R_1V3_TOP > .pin2",
      ".R_1V3_BOT > .pin1",
    ],
  },
  {
    name: "camera-bus-and-clocks",
    phaseIndex: 1,
    connections: [
      ".U1 > .IO9",
      ".U1 > .IO10",
      ".U1 > .IO11",
      ".U1 > .IO12",
      ".U1 > .IO13",
      ".U1 > .IO14",
      ".U1 > .IO21",
      ".U1 > .IO47",
      ".U1 > .IO48",
      ".U1 > .IO15",
      ".U1 > .IO6",
      ".U1 > .IO7",
    ],
  },
  {
    name: "usb-data",
    phaseIndex: 2,
    connections: [
      ".U1 > .IO19",
      ".R_USB_DN > .pin2",
      ".U1 > .IO20",
      ".R_USB_DP > .pin2",
    ],
  },
  {
    name: "camera-sccb-and-control",
    phaseIndex: 3,
    connections: [
      ".U1 > .IO4",
      ".U1 > .IO5",
      ".U1 > .EN",
      ".U1 > .IO0",
    ],
  },
] as const

export function assertBoardRoutingPhaseSelectorsAreUnique() {
  const seen = new Map<string, string>()
  for (const phase of BOARD_ROUTING_PHASES) {
    for (const selector of phase.connections) {
      const previousPhase = seen.get(selector)
      if (previousPhase) {
        throw new Error(
          `Routing selector "${selector}" is assigned to both "${previousPhase}" and "${phase.name}"`,
        )
      }
      seen.set(selector, phase.name)
    }
  }
  return seen
}

assertBoardRoutingPhaseSelectorsAreUnique()