diff --git a/README.md b/README.md index d2e03b66..cdc4417c 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ The package currently exports these subcircuit components: - `LevelShifter_TXB0104` - `LevelShifter_TXS0102` - `RFIDReader_TRF7960` +- `PowerSupply_TIDA00699` ## Exported Chips @@ -154,6 +155,7 @@ chip is listed individually below, including whether it supports a | `CC2564C` | `-` | `CC2564C` | | `CC2745R10` | `-` | `CC2745R10E0WRHARQ1` | | `CC3235SF` | `vqfn_64_ep` | `CC3235SF12RGKR` | +| `CSD18531Q5A` | `-` | `CSD18531Q5A` | | `DRV8833` | `-` | `DRV8833` | | `DRV8876` | `-` | `DRV8876` | | `HDC2080` | `wson_6_ep_3x3` | `HDC2080DMBR` | @@ -161,6 +163,9 @@ chip is listed individually below, including whether it supports a | `HDC3022` | `wson_8_ep_2p5x2p5` | `HDC3022DEJR` | | `INA237` | `vssop_10` | `INA237AQDGSRQ1` | | `ISOW7841` | `soic_16_wide` | `ISOW7841DWR` | +| `LM25122Q1` | `htssop_20` | `LM25122QPWPTQ1` | +| `LM53603Q1` | `htssop_16` | `LM536035QPWPRQ1` | +| `LM74610Q1` | `vssop_8` | `LM74610QDGKRQ1` | | `LMK1C1104` | `tssop_8` | `LMK1C1104PWR` | | `MSP430G2230ID` | `-` | `MSP430G2230ID` | | `MSP430F5229` | `-` | `MSP430F5229IRGCR` | @@ -171,6 +176,7 @@ chip is listed individually below, including whether it supports a | `TMP1827` | `-` | `TMP1827` | | `TMP1075` | `wson_8_ep_2x2` | `TMP1075DSGR` | | `TPS22919` | `-` | `TPS22919` | +| `TPS3808` | `sot_23_6` | `TPS3808G01QDBVRQ1` | | `TPS6293` | `-` | `TPS6293` | | `TPS61299X` | `sot_563_6` | `TPS61299DRLR` | | `TPS63802` | `vson_hr_10` | `TPS63802DLAR` | diff --git a/index.ts b/index.ts index ec87353f..0b803e07 100644 --- a/index.ts +++ b/index.ts @@ -13,6 +13,7 @@ import { CC2564C, CC2745R10, CC3235SF, + CSD18531Q5A, DRV8833, DRV8876, HDC2080, @@ -20,6 +21,9 @@ import { HDC3022, INA237, ISOW7841, + LM25122Q1, + LM53603Q1, + LM74610Q1, LMK1C1104, MSP430G2230ID, MSP430G2332IPW20, @@ -43,6 +47,7 @@ import { TPS63802, TPS7A02, TPS7A20, + TPS3808, TPS78230DRVR, TPSM82823, TRF7960RHB, @@ -95,6 +100,7 @@ import { LevelShifter_TXB0104 } from "./lib/subcircuits/LevelShifter_TXB0104.cir import { LevelShifter_TXS0102 } from "./lib/subcircuits/LevelShifter_TXS0102.circuit.tsx"; import { RFIDReader_TRF7960 } from "./lib/subcircuits/RFIDReader_TRF7960.circuit.tsx"; import { FlashMemory_W25Q128JVSIQ } from "./lib/subcircuits/FlashMemory_W25Q128JVSIQ.circuit.tsx"; +import { PowerSupply_TIDA00699 } from "./lib/subcircuits/PowerSupply_TIDA00699.circuit.tsx"; import { BatteryCharging_2to5CellNVDCBuckBoost_BQ25731 } from "./lib/subcircuits/BatteryCharging_2to5CellNVDCBuckBoost_BQ25731.circuit.tsx"; import { BoostConverter_TPS61236 } from "./lib/subcircuits/BoostConverter_TPS61236.circuit.tsx"; import { Microcontroller_MSP430G2332 } from "./lib/subcircuits/Microcontroller_MSP430G2332.circuit.tsx"; @@ -146,6 +152,7 @@ export { LevelShifter_TXS0102, RFIDReader_TRF7960, FlashMemory_W25Q128JVSIQ, + PowerSupply_TIDA00699, BatteryCharging_2to5CellNVDCBuckBoost_BQ25731, BoostConverter_TPS61236, Microcontroller_MSP430G2332, @@ -167,6 +174,7 @@ export const TiChipComponents = { CC2564C, CC2745R10, CC3235SF, + CSD18531Q5A, DRV8833, DRV8876, HDC2080, @@ -174,6 +182,9 @@ export const TiChipComponents = { HDC3022, INA237, ISOW7841, + LM25122Q1, + LM53603Q1, + LM74610Q1, LMK1C1104, MSP430G2230ID, MSP430G2332IPW20, @@ -197,6 +208,7 @@ export const TiChipComponents = { TPS63802, TPS7A02, TPS7A20, + TPS3808, TPS78230DRVR, TPSM82823, TRF7960RHB, @@ -248,6 +260,7 @@ export const TiSubcircuitComponents = { LevelShifter_TXS0102, RFIDReader_TRF7960, FlashMemory_W25Q128JVSIQ, + PowerSupply_TIDA00699, BatteryCharging_2to5CellNVDCBuckBoost_BQ25731, BoostConverter_TPS61236, Microcontroller_MSP430G2332, diff --git a/lib/chips/CSD18531Q5A.circuit.tsx b/lib/chips/CSD18531Q5A.circuit.tsx new file mode 100644 index 00000000..d654802e --- /dev/null +++ b/lib/chips/CSD18531Q5A.circuit.tsx @@ -0,0 +1,21 @@ +import type { MosfetProps } from "@tscircuit/props"; +import "tscircuit"; + +/** CSD18531Q5A 60-V N-channel NexFET in the SON 5-mm x 6-mm package. */ +export const CSD18531Q5A = ( + props: Omit, +) => ( + +); + +export default CSD18531Q5A; diff --git a/lib/chips/LM25122Q1.circuit.tsx b/lib/chips/LM25122Q1.circuit.tsx new file mode 100644 index 00000000..1f7cbc3a --- /dev/null +++ b/lib/chips/LM25122Q1.circuit.tsx @@ -0,0 +1,22 @@ +import type { ComponentProps } from "react"; +import { LM25122QPWPTQ1 } from "./LM25122QPWPTQ1.circuit.tsx"; + +type LM25122Q1FootprintVariant = "htssop_20" | (string & {}); + +type LM25122Q1Props = ComponentProps & { + footprintVariant?: LM25122Q1FootprintVariant; +}; + +/** LM25122-Q1 synchronous boost controller. */ +export const LM25122Q1 = ({ + footprintVariant = "htssop_20", + ...props +}: LM25122Q1Props) => { + if (footprintVariant === "htssop_20") { + return ; + } + + return ; +}; + +export default LM25122Q1; diff --git a/lib/chips/LM25122QPWPTQ1.circuit.tsx b/lib/chips/LM25122QPWPTQ1.circuit.tsx new file mode 100644 index 00000000..453014fa --- /dev/null +++ b/lib/chips/LM25122QPWPTQ1.circuit.tsx @@ -0,0 +1,55 @@ +import type { ChipProps } from "@tscircuit/props"; +import "tscircuit"; + +const pinLabels = { + pin1: "SYNCOUT", + pin2: "OPT", + pin3: "CSN", + pin4: "CSP", + pin5: "VIN", + pin6: "UVLO", + pin7: "SS", + pin8: "SYNCIN_RT", + pin9: "AGND", + pin10: "FB", + pin11: "COMP", + pin12: "SLOPE", + pin13: "MODE", + pin14: "RES", + pin15: "PGND", + pin16: "LO", + pin17: "VCC", + pin18: "SW", + pin19: "HO", + pin20: "BST", + pin21: "PAD", +} as const; + +/** LM25122-Q1 synchronous boost controller in the PWP HTSSOP-20 package. */ +export const LM25122QPWPTQ1 = (props: ChipProps) => ( + +); + +export default LM25122QPWPTQ1; diff --git a/lib/chips/LM536035QPWPRQ1.circuit.tsx b/lib/chips/LM536035QPWPRQ1.circuit.tsx new file mode 100644 index 00000000..6125bed8 --- /dev/null +++ b/lib/chips/LM536035QPWPRQ1.circuit.tsx @@ -0,0 +1,52 @@ +import type { ChipProps } from "@tscircuit/props"; +import "tscircuit"; + +const pinLabels = { + pin1: "SW_1", + pin2: "SW_2", + pin3: "CBOOT", + pin4: "VCC", + pin5: "BIAS", + pin6: "SYNC", + pin7: "FPWM", + pin8: "RESET", + pin9: "FB", + pin10: "AGND", + pin11: "EN", + pin12: "VIN_1", + pin13: "VIN_2", + pin14: "NC", + pin15: "PGND_1", + pin16: "PGND_2", + pin17: "PAD", +} as const; + +/** LM53603-Q1 3-A automotive buck regulator in the PWP HTSSOP-16 package. */ +export const LM536035QPWPRQ1 = (props: ChipProps) => ( + +); + +export default LM536035QPWPRQ1; diff --git a/lib/chips/LM53603Q1.circuit.tsx b/lib/chips/LM53603Q1.circuit.tsx new file mode 100644 index 00000000..9794032f --- /dev/null +++ b/lib/chips/LM53603Q1.circuit.tsx @@ -0,0 +1,22 @@ +import type { ComponentProps } from "react"; +import { LM536035QPWPRQ1 } from "./LM536035QPWPRQ1.circuit.tsx"; + +type LM53603Q1FootprintVariant = "htssop_16" | (string & {}); + +type LM53603Q1Props = ComponentProps & { + footprintVariant?: LM53603Q1FootprintVariant; +}; + +/** LM53603-Q1 3-A automotive buck regulator. */ +export const LM53603Q1 = ({ + footprintVariant = "htssop_16", + ...props +}: LM53603Q1Props) => { + if (footprintVariant === "htssop_16") { + return ; + } + + return ; +}; + +export default LM53603Q1; diff --git a/lib/chips/LM74610Q1.circuit.tsx b/lib/chips/LM74610Q1.circuit.tsx new file mode 100644 index 00000000..c5a276ed --- /dev/null +++ b/lib/chips/LM74610Q1.circuit.tsx @@ -0,0 +1,22 @@ +import type { ComponentProps } from "react"; +import { LM74610QDGKRQ1 } from "./LM74610QDGKRQ1.circuit.tsx"; + +type LM74610Q1FootprintVariant = "vssop_8" | (string & {}); + +type LM74610Q1Props = ComponentProps & { + footprintVariant?: LM74610Q1FootprintVariant; +}; + +/** LM74610-Q1 smart-diode controller. */ +export const LM74610Q1 = ({ + footprintVariant = "vssop_8", + ...props +}: LM74610Q1Props) => { + if (footprintVariant === "vssop_8") { + return ; + } + + return ; +}; + +export default LM74610Q1; diff --git a/lib/chips/LM74610QDGKRQ1.circuit.tsx b/lib/chips/LM74610QDGKRQ1.circuit.tsx new file mode 100644 index 00000000..aff97c1d --- /dev/null +++ b/lib/chips/LM74610QDGKRQ1.circuit.tsx @@ -0,0 +1,39 @@ +import type { ChipProps } from "@tscircuit/props"; +import "tscircuit"; + +const pinLabels = { + pin1: "VCAPL", + pin2: "GATE_PULL_DOWN", + pin3: "NC_1", + pin4: "ANODE", + pin5: "NC_2", + pin6: "GATE_DRIVE", + pin7: "VCAPH", + pin8: "CATHODE", +} as const; + +/** LM74610-Q1 smart-diode controller in the DGK VSSOP-8 package. */ +export const LM74610QDGKRQ1 = (props: ChipProps) => ( + +); + +export default LM74610QDGKRQ1; diff --git a/lib/chips/TPS3808.circuit.tsx b/lib/chips/TPS3808.circuit.tsx new file mode 100644 index 00000000..40f816d1 --- /dev/null +++ b/lib/chips/TPS3808.circuit.tsx @@ -0,0 +1,22 @@ +import type { ComponentProps } from "react"; +import { TPS3808G01QDBVRQ1 } from "./TPS3808G01QDBVRQ1.circuit.tsx"; + +type TPS3808FootprintVariant = "sot_23_6" | (string & {}); + +type TPS3808Props = ComponentProps & { + footprintVariant?: TPS3808FootprintVariant; +}; + +/** TPS3808 programmable-delay supervisor. */ +export const TPS3808 = ({ + footprintVariant = "sot_23_6", + ...props +}: TPS3808Props) => { + if (footprintVariant === "sot_23_6") { + return ; + } + + return ; +}; + +export default TPS3808; diff --git a/lib/chips/TPS3808G01QDBVRQ1.circuit.tsx b/lib/chips/TPS3808G01QDBVRQ1.circuit.tsx new file mode 100644 index 00000000..514675d9 --- /dev/null +++ b/lib/chips/TPS3808G01QDBVRQ1.circuit.tsx @@ -0,0 +1,87 @@ +import type { ChipProps } from "@tscircuit/props"; +import "tscircuit"; + +const pinLabels = { + pin1: "RESET", + pin2: "GND", + pin3: "MR", + pin4: "CT", + pin5: "SENSE", + pin6: "VDD", +} as const; + +/** TPS3808G01-Q1 programmable-delay supervisor in the DBV SOT-23-6 package. */ +export const TPS3808G01QDBVRQ1 = (props: ChipProps) => ( + + + + + + + + + } + schWidth="3.2mm" + schHeight="2.8mm" + pinLabels={pinLabels} + schPinArrangement={{ + leftSide: { + direction: "top-to-bottom", + pins: [6, 5, 4], + }, + rightSide: { + direction: "bottom-to-top", + pins: [1, 3, 2], + }, + }} + {...props} + /> +); + +export default TPS3808G01QDBVRQ1; diff --git a/lib/chips/index.tsx b/lib/chips/index.tsx index 3b8607f5..85519468 100644 --- a/lib/chips/index.tsx +++ b/lib/chips/index.tsx @@ -9,6 +9,7 @@ export { CC2340R5 } from "./CC2340R5.circuit.tsx"; export { CC2564C } from "./CC2564C.circuit.tsx"; export { CC2745R10 } from "./CC2745R10.circuit.tsx"; export { CC3235SF } from "./CC3235SF.circuit.tsx"; +export { CSD18531Q5A } from "./CSD18531Q5A.circuit.tsx"; export { DRV8833 } from "./DRV8833.circuit.tsx"; export { DRV8876 } from "./DRV8876.circuit.tsx"; export { HDC2080 } from "./HDC2080.circuit.tsx"; @@ -16,6 +17,9 @@ export { HDC3020 } from "./HDC3020.circuit.tsx"; export { HDC3022 } from "./HDC3022.circuit.tsx"; export { INA237 } from "./INA237.circuit.tsx"; export { ISOW7841 } from "./ISOW7841.circuit.tsx"; +export { LM25122Q1 } from "./LM25122Q1.circuit.tsx"; +export { LM53603Q1 } from "./LM53603Q1.circuit.tsx"; +export { LM74610Q1 } from "./LM74610Q1.circuit.tsx"; export { LMK1C1104 } from "./LMK1C1104.circuit.tsx"; export { MSP430G2230ID } from "./MSP430G2230ID.circuit.tsx"; export { MSP430F5229 } from "./MSP430F5229.circuit.tsx"; @@ -36,6 +40,7 @@ export { TPS63802 } from "./TPS63802.circuit.tsx"; export { TRF7960RHB } from "./TRF7960RHB.circuit.tsx"; export { TPS7A02 } from "./TPS7A02.circuit.tsx"; export { TPS7A20 } from "./TPS7A20.circuit.tsx"; +export { TPS3808 } from "./TPS3808.circuit.tsx"; export { TPSM82823 } from "./TPSM82823.circuit.tsx"; export { TXB0104 } from "./TXB0104.circuit.tsx"; export { TXS0102 } from "./TXS0102.circuit.tsx"; @@ -56,6 +61,9 @@ export { HDC3020DEFR } from "./HDC3020DEFR.circuit.tsx"; export { HDC3022DEJR } from "./HDC3022DEJR.circuit.tsx"; export { INA237AQDGSRQ1 } from "./INA237AQDGSRQ1.circuit.tsx"; export { ISOW7841DWR } from "./ISOW7841DWR.circuit.tsx"; +export { LM25122QPWPTQ1 } from "./LM25122QPWPTQ1.circuit.tsx"; +export { LM536035QPWPRQ1 } from "./LM536035QPWPRQ1.circuit.tsx"; +export { LM74610QDGKRQ1 } from "./LM74610QDGKRQ1.circuit.tsx"; export { LMK1C1104PWR } from "./LMK1C1104PWR.circuit.tsx"; export { MSP430F5229IRGCR } from "./MSP430F5229IRGCR.circuit.tsx"; export { MSP430G2332IPW20 } from "./MSP430G2332IPW20.circuit.tsx"; @@ -69,6 +77,7 @@ export { TPS7A0230PDBVR } from "./TPS7A0230PDBVR.circuit.tsx"; export { TPS7A2018PDBVR } from "./TPS7A2018PDBVR.circuit.tsx"; export { TPS7A2028PDBVR } from "./TPS7A2028PDBVR.circuit.tsx"; export { TPS7A2033PDBVR } from "./TPS7A2033PDBVR.circuit.tsx"; +export { TPS3808G01QDBVRQ1 } from "./TPS3808G01QDBVRQ1.circuit.tsx"; export { TLV75533PDBVR } from "./TLV75533PDBVR.circuit.tsx"; export { TLV9152IDR } from "./TLV9152IDR.circuit.tsx"; export { TPS61236RWLR } from "./TPS61236RWLR.circuit.tsx"; diff --git a/lib/subcircuits/PowerSupply_TIDA00699.circuit.tsx b/lib/subcircuits/PowerSupply_TIDA00699.circuit.tsx new file mode 100644 index 00000000..b45e1f6c --- /dev/null +++ b/lib/subcircuits/PowerSupply_TIDA00699.circuit.tsx @@ -0,0 +1,1519 @@ +import type { + CapacitorProps, + ChipProps, + DiodeProps, + InductorProps, + MosfetProps, + PinHeaderProps, + ResistorProps, + SubcircuitProps, + TestpointProps, +} from "@tscircuit/props"; +import "tscircuit"; +import { CSD18531Q5A } from "../chips/CSD18531Q5A.circuit.tsx"; +import { LM25122QPWPTQ1 } from "../chips/LM25122QPWPTQ1.circuit.tsx"; +import { LM74610QDGKRQ1 } from "../chips/LM74610QDGKRQ1.circuit.tsx"; +import { LM536035QPWPRQ1 } from "../chips/LM536035QPWPRQ1.circuit.tsx"; +import { TPS3808G01QDBVRQ1 } from "../chips/TPS3808G01QDBVRQ1.circuit.tsx"; + +const schematicScale = 1.4; + +const referenceSchematicRotations: Record = { + C1: 180, + C2: 270, + C3: 270, + C4: 270, + C5: 270, + C6: 270, + C7: 270, + C8: 270, + C9: 270, + C10: 270, + C12: 180, + C14: 270, + C15: 270, + C16: 270, + C17: 270, + C18: 180, + C19: 270, + C20: 270, + C21: 270, + C22: 270, + C23: 270, + C24: 270, + C25: 270, + C26: 270, + C27: 270, + C28: 270, + D2: 270, + D3: 90, + D4: 90, + D5: 270, + R3: 180, + R4: 180, + R5: 90, + R6: 90, + R7: 90, + R8: 90, + R9: 90, + R10: 90, + R11: 90, + R12: 270, + R16: 90, + R17: 90, + R18: 90, + R19: 90, + R20: 180, + R21: 90, + R22: 180, + R23: 180, + TP1: 90, + TP2: 90, + TP3: 90, + TP4: 90, + TP5: 90, + TP6: 90, + TP7: 90, +}; + +const getReferenceSchematicRotation = (name: string | undefined) => + name ? (referenceSchematicRotations[name] ?? 0) : 0; + +type ReferenceSchematicPlacement = { + referenceSchX: number; + referenceSchY: number; +}; + +type ReferenceCapacitorProps = CapacitorProps & ReferenceSchematicPlacement; +type ReferenceResistorProps = ResistorProps & ReferenceSchematicPlacement; +type ReferenceInductorProps = InductorProps & ReferenceSchematicPlacement; +type ReferenceDiodeProps = DiodeProps & ReferenceSchematicPlacement; +type ReferencePinHeaderProps = PinHeaderProps & ReferenceSchematicPlacement; +type ReferenceTestpointProps = TestpointProps & ReferenceSchematicPlacement; + +const ReferenceCapacitor = ({ + referenceSchX, + referenceSchY, + ...capacitorProps +}: ReferenceCapacitorProps) => ( + +); + +const ReferenceResistor = ({ + referenceSchX, + referenceSchY, + ...resistorProps +}: ReferenceResistorProps) => ( + +); + +const ReferenceInductor = ({ + referenceSchX, + referenceSchY, + ...inductorProps +}: ReferenceInductorProps) => ( + +); + +const ReferenceDiode = ({ + referenceSchX, + referenceSchY, + ...diodeProps +}: ReferenceDiodeProps) => ( + +); + +const ReferencePinHeader = ({ + referenceSchX, + referenceSchY, + ...pinHeaderProps +}: ReferencePinHeaderProps) => ( + +); + +const ReferenceTestpoint = ({ + referenceSchX, + referenceSchY, + ...testpointProps +}: ReferenceTestpointProps) => ( + +); + +const createPanasonicFk47uFootprint = () => ( + + + + +); + +const createCga9nFootprint = () => ( + + + + +); + +const createXal5030Footprint = () => ( + + + + +); + +const createXal4020Footprint = () => ( + + + + +); + +const createUmk212Footprint = () => ( + + + + +); + +const createPmeg6010Footprint = () => ( + + + + +); + +const SQ4850EY = (props: Omit) => ( + +); + +const bas40PinLabels = { + pin1: "1", + pin2: "2", + pin3: "3", +} as const; + +const BAS4005 = (props: ChipProps) => ( + +); + +const referenceCapacitors = [ + { + name: "C1", + capacitance: "470pF", + maxVoltageRating: "50V", + footprint: "0402", + referenceSchX: -1.1881, + referenceSchY: -0.9139, + connections: { pin1: "net.VBST", pin2: "net.NetC1_2" }, + }, + { + name: "C2", + capacitance: "47uF", + maxVoltageRating: "50V", + polarized: true, + footprint: createPanasonicFk47uFootprint(), + referenceSchX: 2.5589, + referenceSchY: 4.9077, + connections: { pin1: "net.VBAT_FILT", pin2: "net.GND" }, + }, + { + name: "C3", + capacitance: "10uF", + maxVoltageRating: "50V", + footprint: createCga9nFootprint(), + referenceSchX: -11.698, + referenceSchY: -2.2848, + connections: { pin1: "net.NetC3_1", pin2: "net.GND" }, + }, + { + name: "C4", + capacitance: "47uF", + maxVoltageRating: "50V", + polarized: true, + footprint: createPanasonicFk47uFootprint(), + referenceSchX: -0.3656, + referenceSchY: -2.7691, + connections: { pin1: "net.VBST", pin2: "net.GND" }, + }, + { + name: "C5", + capacitance: "10uF", + maxVoltageRating: "50V", + footprint: createCga9nFootprint(), + referenceSchX: 0.1828, + referenceSchY: -2.8331, + connections: { pin1: "net.VBST", pin2: "net.GND" }, + }, + { + name: "C6", + capacitance: "0.1uF", + maxVoltageRating: "16V", + footprint: "0603", + referenceSchX: 6.9457, + referenceSchY: 4.2954, + connections: { pin1: "net.VSYS", pin2: "net.GND" }, + }, + { + name: "C7", + capacitance: "1uF", + maxVoltageRating: "100V", + footprint: "1206", + referenceSchX: -8.2252, + referenceSchY: -2.8331, + connections: { pin1: "net.NetC7_1", pin2: "net.GND" }, + }, + { + name: "C8", + capacitance: "0.1uF", + maxVoltageRating: "50V", + footprint: "0402", + referenceSchX: -11.5152, + referenceSchY: 5.2093, + connections: { pin1: "net.VBAT", pin2: "net.NetC8_2" }, + }, + { + name: "C9", + capacitance: "2.2uF", + maxVoltageRating: "10V", + footprint: "0603", + referenceSchX: -8.9563, + referenceSchY: 4.8437, + connections: { pin1: "net.NetC9_1", pin2: "net.NetC9_2" }, + }, + { + name: "C10", + capacitance: "100pF", + maxVoltageRating: "25V", + footprint: "0402", + referenceSchX: -4.5695, + referenceSchY: -3.3815, + connections: { pin1: "net.CS_P", pin2: "net.CS_N" }, + }, + { + name: "C11", + capacitance: "0.1uF", + maxVoltageRating: "50V", + footprint: "0402", + referenceSchX: -11.0583, + referenceSchY: 4.7523, + connections: { pin1: "net.NetC8_2", pin2: "net.GND" }, + }, + { + name: "C12", + capacitance: "4.7uF", + maxVoltageRating: "10V", + footprint: "0805", + referenceSchX: -4.5, + referenceSchY: -4.6179, + connections: { pin1: "net.GND", pin2: "net.NetC12_2" }, + }, + { + name: "C13", + capacitance: "0.47uF", + maxVoltageRating: "50V", + footprint: createUmk212Footprint(), + referenceSchX: -3.3815, + referenceSchY: -4.9036, + connections: { pin1: "net.NetC13_1", pin2: "net.NetC13_2" }, + }, + { + name: "C14", + capacitance: "2200pF", + maxVoltageRating: "16V", + footprint: "0402", + referenceSchX: -10.9669, + referenceSchY: -5.0265, + connections: { pin1: "net.NetC14_1", pin2: "net.NetC14_2" }, + }, + { + name: "C15", + capacitance: "330pF", + maxVoltageRating: "50V", + footprint: "0402", + referenceSchX: -11.698, + referenceSchY: -5.5748, + connections: { pin1: "net.NetC14_1", pin2: "net.NetC15_2" }, + }, + { + name: "C16", + capacitance: "0.047uF", + maxVoltageRating: "25V", + footprint: "0603", + referenceSchX: -10.2358, + referenceSchY: -6.6715, + connections: { pin1: "net.NetC16_1", pin2: "net.GND" }, + }, + { + name: "C17", + capacitance: "0.68uF", + maxVoltageRating: "10V", + footprint: "0805", + referenceSchX: -9.6874, + referenceSchY: -6.6715, + connections: { pin1: "net.NetC17_1", pin2: "net.GND" }, + }, + { + name: "C18", + capacitance: "0.47uF", + maxVoltageRating: "25V", + footprint: "0603", + referenceSchX: 9.9616, + referenceSchY: -4.0212, + connections: { pin1: "net.NetC18_1", pin2: "net.NetC18_2" }, + }, + { + name: "C19", + capacitance: "10uF", + maxVoltageRating: "50V", + footprint: createCga9nFootprint(), + referenceSchX: 3.2901, + referenceSchY: -4.6609, + connections: { pin1: "net.NetC19_1", pin2: "net.GND" }, + }, + { + name: "C20", + capacitance: "10uF", + maxVoltageRating: "50V", + footprint: createCga9nFootprint(), + referenceSchX: 4.0212, + referenceSchY: -4.6609, + connections: { pin1: "net.NetC19_1", pin2: "net.GND" }, + }, + { + name: "C21", + capacitance: "0.1uF", + maxVoltageRating: "50V", + footprint: "0402", + referenceSchX: 4.7523, + referenceSchY: -4.6609, + connections: { pin1: "net.NetC19_1", pin2: "net.GND" }, + }, + { + name: "C22", + capacitance: "22uF", + maxVoltageRating: "16V", + footprint: "1210", + referenceSchX: 12.2464, + referenceSchY: -5.3921, + connections: { pin1: "net.VSYS", pin2: "net.GND" }, + }, + { + name: "C23", + capacitance: "22uF", + maxVoltageRating: "16V", + footprint: "1210", + referenceSchX: 12.7947, + referenceSchY: -5.3921, + connections: { pin1: "net.VSYS", pin2: "net.GND" }, + }, + { + name: "C24", + capacitance: "22uF", + maxVoltageRating: "16V", + footprint: "1210", + referenceSchX: 13.343, + referenceSchY: -5.3921, + connections: { pin1: "net.VSYS", pin2: "net.GND" }, + }, + { + name: "C25", + capacitance: "10uF", + maxVoltageRating: "50V", + footprint: createCga9nFootprint(), + referenceSchX: 0.1828, + referenceSchY: 4.8437, + connections: { pin1: "net.VBAT_PROTECT", pin2: "net.GND" }, + }, + { + name: "C26", + capacitance: "0.1uF", + maxVoltageRating: "16V", + footprint: "0603", + referenceSchX: 7.8596, + referenceSchY: 4.2954, + connections: { pin1: "net.NetC26_1", pin2: "net.GND" }, + }, + { + name: "C27", + capacitance: "2.2uF", + maxVoltageRating: "6.3V", + footprint: "0603", + referenceSchX: 4.7523, + referenceSchY: -6.1232, + connections: { pin1: "net.NetC27_1", pin2: "net.GND" }, + }, + { + name: "C28", + capacitance: "0.1uF", + maxVoltageRating: "16V", + footprint: "0603", + referenceSchX: 10.2358, + referenceSchY: -5.9404, + connections: { pin1: "net.NetC28_1", pin2: "net.GND" }, + }, +] satisfies ReferenceCapacitorProps[]; + +const referenceResistors = [ + { + name: "R1", + resistance: "8.2ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: -2.0106, + referenceSchY: -0.9139, + connections: { pin1: "net.NetC13_2", pin2: "net.NetC1_2" }, + }, + { + name: "R2", + resistance: "0.008ohm", + tolerance: "1%", + footprint: "2010", + referenceSchX: -5.4834, + referenceSchY: -1.4623, + connections: { pin1: "net.NetC3_1", pin2: "net.NetL1_1" }, + }, + { + name: "R3", + resistance: "100ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: -4.5695, + referenceSchY: -2.0106, + connections: { pin1: "net.CS_N", pin2: "net.NetL1_1" }, + }, + { + name: "R4", + resistance: "100ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: -5.4834, + referenceSchY: -2.3762, + connections: { pin1: "net.CS_P", pin2: "net.NetC3_1" }, + }, + { + name: "R5", + resistance: "49.9kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -13.5258, + referenceSchY: -3.2901, + connections: { pin1: "net.SHT_BST", pin2: "net.NetC3_1" }, + }, + { + name: "R6", + resistance: "49.9kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -13.5258, + referenceSchY: -4.3868, + connections: { pin1: "net.GND", pin2: "net.SHT_BST" }, + }, + { + name: "R7", + resistance: "64.9kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -12.4291, + referenceSchY: -5.849, + connections: { pin1: "net.NetC15_2", pin2: "net.VBST" }, + }, + { + name: "R8", + resistance: "24.3kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -10.9669, + referenceSchY: -5.849, + connections: { pin1: "net.NetC15_2", pin2: "net.NetC14_2" }, + }, + { + name: "R9", + resistance: "28kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -12.9775, + referenceSchY: -6.7629, + connections: { pin1: "net.GND", pin2: "net.NetR9_2" }, + }, + { + name: "R10", + resistance: "19.1kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -9.1391, + referenceSchY: -6.7629, + connections: { pin1: "net.GND", pin2: "net.SYNC_BST" }, + }, + { + name: "R11", + resistance: "10kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: -12.4291, + referenceSchY: -6.9457, + connections: { pin1: "net.GND", pin2: "net.NetC15_2" }, + }, + { + name: "R12", + resistance: "10kohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: 5.6662, + referenceSchY: -4.3868, + connections: { pin1: "net.NetC19_1", pin2: "net.SHT_BCK" }, + }, + { + name: "R13", + resistance: "5.1ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: 10.9669, + referenceSchY: -5.4834, + connections: { pin1: "net.NetC28_1", pin2: "net.VSYS" }, + }, + { + name: "R14", + resistance: "0ohm", + footprint: "2512", + referenceSchX: -13.7086, + referenceSchY: -1.4623, + connections: { pin1: "net.VBAT_FILT", pin2: "net.NetC3_1" }, + }, + { + name: "R15", + resistance: "0ohm", + footprint: "1206", + referenceSchX: 2.3762, + referenceSchY: -4.0212, + connections: { pin1: "net.VBST", pin2: "net.NetC19_1" }, + }, + { + name: "R16", + resistance: "10kohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: 11.5152, + referenceSchY: 5.849, + connections: { pin1: "net.SVS_OUT", pin2: "net.VSYS" }, + }, + { + name: "R17", + resistance: "10kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: 13.5258, + referenceSchY: 5.4834, + connections: { pin1: "net.NetR17_1", pin2: "net.VSYS" }, + }, + { + name: "R18", + resistance: "102kohm", + tolerance: "1%", + footprint: "0402", + referenceSchX: 13.5258, + referenceSchY: 4.0212, + connections: { pin1: "net.GND", pin2: "net.NetR17_1" }, + }, + { + name: "R19", + resistance: "0ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: -3.9, + referenceSchY: -4.4036, + connections: { pin1: "net.NetC12_2", pin2: "net.NetR19_2" }, + }, + { + name: "R20", + resistance: "0ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: -3.3, + referenceSchY: -4.3322, + connections: { pin1: "net.GND", pin2: "net.NetR19_2" }, + }, + { + name: "R21", + resistance: "0ohm", + tolerance: "5%", + footprint: "0402", + referenceSchX: 6.0318, + referenceSchY: -6.5801, + connections: { pin1: "net.GND", pin2: "net.SYNC_BUCK" }, + }, + { + name: "R22", + resistance: "0ohm", + tolerance: "5%", + footprint: "0402", + doNotPlace: true, + referenceSchX: -4.0212, + referenceSchY: -6.0318, + connections: { pin1: "net.NetR22_1", pin2: "net.NetR22_2" }, + }, + { + name: "R23", + resistance: "0ohm", + tolerance: "5%", + footprint: "0402", + doNotPlace: true, + referenceSchX: -2.7417, + referenceSchY: -7.494, + connections: { pin1: "net.NetR23_1", pin2: "net.NetR23_2" }, + }, +] satisfies ReferenceResistorProps[]; + +const referenceInductors = [ + { + name: "L1", + inductance: "2.2uH", + maxCurrentRating: "10.1A", + footprint: createXal5030Footprint(), + referenceSchX: -3.4728, + referenceSchY: -1.2338, + connections: { pin1: "net.NetL1_1", pin2: "net.NetC13_2" }, + }, + { + name: "L2", + inductance: "2.2uH", + maxCurrentRating: "8.6A", + footprint: createXal4020Footprint(), + referenceSchX: 11.1497, + referenceSchY: -4.3411, + connections: { pin1: "net.NetC18_1", pin2: "net.VSYS" }, + }, + { + name: "L3", + inductance: "2.2uH", + maxCurrentRating: "10.1A", + footprint: createXal5030Footprint(), + referenceSchX: 1.645, + referenceSchY: 6.0775, + connections: { pin1: "net.VBAT_PROTECT", pin2: "net.VBAT_FILT" }, + }, +] satisfies ReferenceInductorProps[]; + +const referenceDiodes = [ + { + name: "D2", + variant: "tvs", + footprint: "smb", + manufacturerPartNumber: "SMBJ26A-13-F", + referenceSchX: -12.9775, + referenceSchY: 5.4834, + connections: { pin1: "net.VBAT", pin2: "net.NetD2_2" }, + }, + { + name: "D3", + variant: "tvs", + footprint: "smb", + manufacturerPartNumber: "SMBJ14A-13-F", + referenceSchX: -12.9775, + referenceSchY: 4.0212, + connections: { pin1: "net.GND", pin2: "net.NetD2_2" }, + }, + { + name: "D4", + variant: "schottky", + footprint: createPmeg6010Footprint(), + manufacturerPartNumber: "PMEG6010CEH,115", + referenceSchX: -3.9, + referenceSchY: -4.7607, + connections: { pin1: "net.NetC13_1", pin2: "net.NetC12_2" }, + }, + { + name: "D5", + variant: "zener", + footprint: "sod123", + manufacturerPartNumber: "MMSZ5232B-7-F", + referenceSchX: -14.0742, + referenceSchY: -4.4416, + connections: { pin1: "net.SHT_BST", pin2: "net.GND" }, + }, +] satisfies ReferenceDiodeProps[]; + +const referenceConnectors = [ + { + name: "J1", + pinCount: 1, + manufacturerPartNumber: "575-8", + holeDiameter: "5.450mm", + platedDiameter: "10mm", + pinLabels: ["1"], + schFacingDirection: "right", + referenceSchX: -13.8914, + referenceSchY: 5.6662, + connections: { pin1: "net.VBAT" }, + }, + { + name: "J2", + pinCount: 1, + manufacturerPartNumber: "575-8", + holeDiameter: "5.450mm", + platedDiameter: "10mm", + pinLabels: ["1"], + schFacingDirection: "left", + referenceSchX: 14.6225, + referenceSchY: -4.3868, + connections: { pin1: "net.VSYS" }, + }, + { + name: "J3", + pinCount: 1, + manufacturerPartNumber: "575-8", + holeDiameter: "5.450mm", + platedDiameter: "10mm", + pinLabels: ["1"], + schFacingDirection: "right", + referenceSchX: -13.8914, + referenceSchY: 4.9351, + connections: { pin1: "net.GND" }, + }, + { + name: "J4", + pinCount: 1, + manufacturerPartNumber: "575-8", + holeDiameter: "5.450mm", + platedDiameter: "10mm", + pinLabels: ["1"], + schFacingDirection: "left", + referenceSchX: 14.4397, + referenceSchY: -5.849, + connections: { pin1: "net.GND" }, + }, + { + name: "J5", + pinCount: 6, + pitch: "1.27mm", + rightAngle: true, + manufacturerPartNumber: "GRPB061VWCN-RC", + holeDiameter: "0.6604mm", + platedDiameter: "1.0668mm", + pinLabels: ["1", "2", "3", "4", "5", "6"], + schFacingDirection: "left", + referenceSchX: 11.6066, + referenceSchY: 2.0106, + connections: { + pin1: "net.SVS_OUT", + pin2: "net.SYNC_BUCK", + pin3: "net.RST_OUT", + pin4: "net.SYNC_BST", + pin5: "net.NetDSHT_3", + pin6: "net.GND", + }, + }, +] satisfies ReferencePinHeaderProps[]; + +const referenceTestpoints = [ + { + name: "TP1", + manufacturerPartNumber: "5010", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: -13.343, + referenceSchY: -0.8408, + connections: { pin1: "net.NetC3_1" }, + }, + { + name: "TP2", + manufacturerPartNumber: "5011", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: -14.2569, + referenceSchY: -1.9375, + connections: { pin1: "net.GND" }, + }, + { + name: "TP3", + manufacturerPartNumber: "5010", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: 0.3656, + referenceSchY: -0.8408, + connections: { pin1: "net.VBST" }, + }, + { + name: "TP4", + manufacturerPartNumber: "5010", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: 2.9245, + referenceSchY: -3.3997, + connections: { pin1: "net.NetC19_1" }, + }, + { + name: "TP5", + manufacturerPartNumber: "5010", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: -0.1828, + referenceSchY: 6.4705, + connections: { pin1: "net.VBAT_PROTECT" }, + }, + { + name: "TP6", + manufacturerPartNumber: "5011", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: 2.5589, + referenceSchY: -4.4964, + connections: { pin1: "net.GND" }, + }, + { + name: "TP7", + manufacturerPartNumber: "5011", + footprintVariant: "through_hole", + holeDiameter: "1.6002mm", + padDiameter: "2.2098mm", + referenceSchX: -0.7311, + referenceSchY: 5.191, + connections: { pin1: "net.GND" }, + }, +] satisfies ReferenceTestpointProps[]; + +type ReferenceConnectedComponent = { + name: string; + connections: Record; + referenceSchX: number; + referenceSchY: number; +}; + +type ReferenceTraceProps = { + from: string; + to: string; +}; + +type ReferenceTraceEndpoint = { + componentPortSelector: string; + referenceSchX: number; + referenceSchY: number; +}; + +const ReferenceTrace = ({ from, to }: ReferenceTraceProps) => ( + +); + +const referenceLabeledNetNames = new Set([ + "GND", + "VBAT", + "VBAT_PROTECT", + "VBAT_FILT", + "VBST", + "VSYS", + "CS_P", + "CS_N", + "SHT_BST", + "SHT_BCK", + "SYNC_BST", + "SYNC_BUCK", + "RST_OUT", + "SVS_OUT", +]); + +const referenceTraceOverridesByNetName: Partial< + Record +> = { + NetC13_1: [ + { from: ".U2 > .pin20", to: ".C13 > .pin1" }, + { from: ".U2 > .pin20", to: ".D4 > .pin1" }, + ], + NetC12_2: [ + { from: ".U2 > .pin17", to: ".C12 > .pin2" }, + { from: ".U2 > .pin17", to: ".D4 > .pin2" }, + { from: ".R19 > .pin1", to: ".D4 > .pin2" }, + ], + NetR19_2: [ + { from: ".U2 > .pin13", to: ".R20 > .pin2" }, + { from: ".U2 > .pin13", to: ".R19 > .pin2" }, + ], +}; + +const d1Connections = { + pin1: "net.NetC3_1", + pin2: "net.VBST", + pin3: "net.NetC7_1", +}; + +const dshtConnections = { + pin1: "net.SHT_BST", + pin2: "net.SHT_BCK", + pin3: "net.NetDSHT_3", +}; + +const q1Connections = { + source: "net.GND", + drain: "net.NetC13_2", + gate: "net.NetR22_1", +}; + +const q2Connections = { + source: "net.NetC13_2", + drain: "net.VBST", + gate: "net.NetR23_1", +}; + +const q3Connections = { + source: "net.VBAT", + gate: "net.NetQ3_4", + drain: "net.VBAT_PROTECT", +}; + +const u1Connections = { + pin1: "net.NetC9_2", + pin2: "net.NetQ3_4", + pin4: "net.VBAT", + pin6: "net.NetQ3_4", + pin7: "net.NetC9_1", + pin8: "net.VBAT_PROTECT", +}; + +const u2Connections = { + pin2: "net.GND", + pin3: "net.CS_N", + pin4: "net.CS_P", + pin5: "net.NetC7_1", + pin6: "net.SHT_BST", + pin7: "net.NetC16_1", + pin8: "net.SYNC_BST", + pin9: "net.GND", + pin10: "net.NetC15_2", + pin11: "net.NetC14_1", + pin12: "net.NetR9_2", + pin13: "net.NetR19_2", + pin14: "net.NetC17_1", + pin15: "net.GND", + pin16: "net.NetR22_2", + pin17: "net.NetC12_2", + pin18: "net.NetC13_2", + pin19: "net.NetR23_2", + pin20: "net.NetC13_1", + pin21: "net.GND", +}; + +const u3Connections = { + pin1: "net.NetC18_1", + pin2: "net.NetC18_1", + pin3: "net.NetC18_2", + pin4: "net.NetC27_1", + pin5: "net.NetC28_1", + pin6: "net.SYNC_BUCK", + pin7: "net.NetC27_1", + pin8: "net.RST_OUT", + pin9: "net.VSYS", + pin10: "net.GND", + pin11: "net.SHT_BCK", + pin12: "net.NetC19_1", + pin13: "net.NetC19_1", + pin15: "net.GND", + pin16: "net.GND", + pin17: "net.GND", +}; + +const u4Connections = { + pin1: "net.SVS_OUT", + pin2: "net.GND", + pin4: "net.NetC26_1", + pin5: "net.NetR17_1", + pin6: "net.VSYS", +}; + +const referenceSpecialComponentConnections = [ + { + name: "D1", + connections: d1Connections, + referenceSchX: -10.4, + referenceSchY: -2.1, + }, + { + name: "DSHT", + connections: dshtConnections, + referenceSchX: 9.5046, + referenceSchY: 0.1828, + }, + { + name: "Q1", + connections: q1Connections, + referenceSchX: -2.6229, + referenceSchY: -5.849, + }, + { + name: "Q2", + connections: q2Connections, + referenceSchX: -1.645, + referenceSchY: -1.5262, + }, + { + name: "Q3", + connections: q3Connections, + referenceSchX: -6.5801, + referenceSchY: 7.0645, + }, + { + name: "U1", + connections: u1Connections, + referenceSchX: -6.7629, + referenceSchY: 4.5695, + }, + { + name: "U2", + connections: u2Connections, + referenceSchX: -6.3973, + referenceSchY: -5.1179, + }, + { + name: "U3", + connections: u3Connections, + referenceSchX: 7.8596, + referenceSchY: -5.3007, + }, + { + name: "U4", + connections: u4Connections, + referenceSchX: 10.053, + referenceSchY: 4.7523, + }, +] satisfies ReferenceConnectedComponent[]; + +const createReferenceTraceProps = ({ + connectedComponents, +}: { + connectedComponents: ReferenceConnectedComponent[]; +}): ReferenceTraceProps[] => { + const directTraceEndpointsByNetName: Record< + string, + ReferenceTraceEndpoint[] + > = {}; + const referenceTraceProps: ReferenceTraceProps[] = []; + + for (const connectedComponent of connectedComponents) { + for (const [portName, netSelector] of Object.entries( + connectedComponent.connections, + )) { + if (!netSelector) continue; + + const componentPortSelector = `.${connectedComponent.name} > .${portName}`; + const netName = netSelector.slice("net.".length); + + if (referenceLabeledNetNames.has(netName)) { + referenceTraceProps.push({ + from: componentPortSelector, + to: netSelector, + }); + continue; + } + + directTraceEndpointsByNetName[netName] ??= []; + directTraceEndpointsByNetName[netName].push({ + componentPortSelector, + referenceSchX: connectedComponent.referenceSchX, + referenceSchY: connectedComponent.referenceSchY, + }); + } + } + + for (const [netName, traceEndpoints] of Object.entries( + directTraceEndpointsByNetName, + )) { + const referenceTraceOverrides = referenceTraceOverridesByNetName[netName]; + if (referenceTraceOverrides) { + referenceTraceProps.push(...referenceTraceOverrides); + continue; + } + + const [firstTraceEndpoint, ...unconnectedTraceEndpoints] = traceEndpoints; + + if (!firstTraceEndpoint || unconnectedTraceEndpoints.length === 0) { + throw new Error( + `Internal reference net ${netName} has fewer than two endpoints`, + ); + } + + const connectedTraceEndpoints = [firstTraceEndpoint]; + + while (unconnectedTraceEndpoints.length > 0) { + let nearestConnectedEndpointIndex = 0; + let nearestUnconnectedEndpointIndex = 0; + let nearestSquaredDistance = Number.POSITIVE_INFINITY; + + for ( + let connectedEndpointIndex = 0; + connectedEndpointIndex < connectedTraceEndpoints.length; + connectedEndpointIndex += 1 + ) { + const connectedTraceEndpoint = + connectedTraceEndpoints[connectedEndpointIndex]; + if (!connectedTraceEndpoint) continue; + + for ( + let unconnectedEndpointIndex = 0; + unconnectedEndpointIndex < unconnectedTraceEndpoints.length; + unconnectedEndpointIndex += 1 + ) { + const unconnectedTraceEndpoint = + unconnectedTraceEndpoints[unconnectedEndpointIndex]; + if (!unconnectedTraceEndpoint) continue; + + const deltaX = + connectedTraceEndpoint.referenceSchX - + unconnectedTraceEndpoint.referenceSchX; + const deltaY = + connectedTraceEndpoint.referenceSchY - + unconnectedTraceEndpoint.referenceSchY; + const squaredDistance = deltaX * deltaX + deltaY * deltaY; + + if (squaredDistance < nearestSquaredDistance) { + nearestConnectedEndpointIndex = connectedEndpointIndex; + nearestUnconnectedEndpointIndex = unconnectedEndpointIndex; + nearestSquaredDistance = squaredDistance; + } + } + } + + const nearestConnectedTraceEndpoint = + connectedTraceEndpoints[nearestConnectedEndpointIndex]; + const nearestUnconnectedTraceEndpoint = unconnectedTraceEndpoints.splice( + nearestUnconnectedEndpointIndex, + 1, + )[0]; + + if (!nearestConnectedTraceEndpoint || !nearestUnconnectedTraceEndpoint) { + throw new Error(`Could not connect internal reference net ${netName}`); + } + + referenceTraceProps.push({ + from: nearestConnectedTraceEndpoint.componentPortSelector, + to: nearestUnconnectedTraceEndpoint.componentPortSelector, + }); + connectedTraceEndpoints.push(nearestUnconnectedTraceEndpoint); + } + } + + return referenceTraceProps; +}; + +const referenceTraceProps = createReferenceTraceProps({ + connectedComponents: [ + ...referenceCapacitors, + ...referenceResistors, + ...referenceInductors, + ...referenceDiodes, + ...referenceConnectors, + ...referenceTestpoints, + ...referenceSpecialComponentConnections, + ], +}); + +/** + * Complete automotive off-battery power supply from TI reference design + * TIDA-00699: https://www.ti.com/tool/TIDA-00699 + * + * The source reference combines input transient and reverse-polarity + * protection, a 9-V/2-A synchronous boost, a 5-V/3-A buck, and a + * programmable-delay supply supervisor. + */ +export const PowerSupply_TIDA00699 = (props: SubcircuitProps) => ( + + {referenceCapacitors.map((capacitorProps) => ( + + ))} + {referenceResistors.map((resistorProps) => ( + + ))} + {referenceInductors.map((inductorProps) => ( + + ))} + {referenceDiodes.map((diodeProps) => ( + + ))} + {referenceConnectors.map((pinHeaderProps) => ( + + ))} + {referenceTestpoints.map((testpointProps) => ( + + ))} + + + + + + + + + + + + + + {referenceTraceProps.map((traceProps) => ( + ${traceProps.to}`} + {...traceProps} + /> + ))} + + + + + + + + +); + +export default PowerSupply_TIDA00699; diff --git a/lib/subcircuits/__snapshots__/PowerSupply_TIDA00699.circuit-schematic.snap.svg b/lib/subcircuits/__snapshots__/PowerSupply_TIDA00699.circuit-schematic.snap.svg new file mode 100644 index 00000000..c82aa31b --- /dev/null +++ b/lib/subcircuits/__snapshots__/PowerSupply_TIDA00699.circuit-schematic.snap.svg @@ -0,0 +1,89 @@ +C1470pFC247uFC310uFC447uFC510uFC60.1uFC71uFC80.1uFC92.2uFC10100pFC110.1uFC124.7uFC130.47uFC142200pFC15330pFC160.047uFC170.68uFC180.47uFC1910uFC2010uFC210.1uFC2222uFC2322uFC2422uFC2510uFC260.1uFC272.2uFC280.1uFR18.2ΩR28mΩR3100ΩR4100ΩR549.9kΩR649.9kΩR764.9kΩR824.3kΩR928kΩR1019.1kΩR1110kΩR1210kΩR135.1ΩR140ΩR150ΩR1610kΩR1710kΩR18102kΩR190ΩR200ΩR210ΩR220ΩR230ΩL12.2µHL22.2µHL32.2µHD2D3Could not match ports for symbol diode_upD5575-8J111575-8J211575-8J311575-8J411GRPB061VWCN-RCJ5112233445566TP1TP2TP3TP4TP5TP6TP7BAS40-05-7-FD1123BAS40-05-7-FDSHT123Q1Q2Q3LM74610QDGKRQ1U11VCAPL2GATE_PULL_DOWN3NC_14ANODE5NC_26GATE_DRIVE7VCAPH8CATHODELM25122QPWPTQ1U21SYNCOUT2OPT3CSN4CSP5VIN6UVLO7SS8SYNCIN_RT9AGND10FB11COMP12SLOPE13MODE14RES15PGND16LO17VCC18SW19HO20BST21PADLM536035QPWPRQ1U31SW_12SW_23CBOOT4VCC5BIAS6SYNC7FPWM8RESET9FB10AGND11EN12VIN_113VIN_214NC15PGND_116PGND_217PADTPS3808G01QDBVRQ1U41RESET2GND3MR4CT5SENSE6VDDVBSTVBSTVBSTGNDGNDGNDVBAT_FILTVBAT_FILTVSYSVSYSVBATCS_PVBAT_PROTECTSHT_BSTSHT_BSTSYNC_BSTSYNC_BSTSYNC_BSTSHT_BCKSVS_OUTSYNC_BUCKSYNC_BUCKU2_VCCRST_OUTRST_OUT diff --git a/package.json b/package.json index 71c61d60..e130d556 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "devDependencies": { "@biomejs/biome": "^2.4.16", "@types/react": "^19.2.17", - "tscircuit": "^0.0.2413", + "tscircuit": "^0.0.2422", "typescript": "^5.0.0" }, "peerDependencies": {