ShiboSoftwareDev/mspm0g3507-usb-c-dev-board
This circuit features a USB Type-C connector with integrated resistors and passives, a USB ESD protection device, a CH340 USB-to-serial interface chip, a 3.3V regulator (AP2112K), multiple decoupling and bulk capacitors, and a Microcontroller (MSPM0G3507) with associated I2C and SPI connections, providing USB communication, power regulation, and RGB LED control.
- Version
- 1.4.1
- License
- unset
- Stars
- 0
scripts/export-schematic.mjs
import { readFile, writeFile } from "node:fs/promises"
import {
convertCircuitJsonToAssemblySvg,
convertCircuitJsonToPcbSvg,
convertCircuitJsonToSchematicSvg,
} from "circuit-to-svg"
const circuitJsonPath = new URL("../dist/index/circuit.json", import.meta.url)
const schematicSvgPath = new URL(
"../outputs/MSPM0G3507_USB_C_Schematic.svg",
import.meta.url,
)
const pcbSvgPath = new URL(
"../outputs/MSPM0G3507_USB_C_PCB.svg",
import.meta.url,
)
const assemblySvgPath = new URL(
"../outputs/MSPM0G3507_USB_C_Assembly.svg",
import.meta.url,
)
const circuitJson = JSON.parse(await readFile(circuitJsonPath, "utf8"))
const schematicSvg = convertCircuitJsonToSchematicSvg(circuitJson, {
width: 1600,
height: 1000,
includeVersion: true,
showErrorsInTextOverlay: true,
})
await writeFile(schematicSvgPath, schematicSvg)
await writeFile(
pcbSvgPath,
convertCircuitJsonToPcbSvg(circuitJson, {
width: 1600,
height: 700,
matchBoardAspectRatio: true,
includeVersion: true,
shouldDrawErrors: true,
shouldDrawWarnings: true,
showErrorsInTextOverlay: true,
showSolderMask: true,
}),
)
const assemblySvg = convertCircuitJsonToAssemblySvg(circuitJson, {
width: 1600,
height: 700,
includeVersion: true,
showErrorsInTextOverlay: true,
})
.replace(/<[^>]*(?:NaN|undefined)[^>]*\/>/g, "")
.replace(/font-size="([\d.]+)px"/g, (_, size) =>
`font-size="${Math.min(Number(size), 12).toFixed(1)}px"`)
await writeFile(assemblySvgPath, assemblySvg)
console.log(`Exported ${schematicSvgPath.pathname}`)
console.log(`Exported ${pcbSvgPath.pathname}`)
console.log(`Exported ${assemblySvgPath.pathname}`)