imrishabh18/rp2040-motor-controller

The circuit implements a powered USB interface with a W25Q16 flash memory chip, a RP2040 microcontroller, and AO3400A MOSFETs for switch control, enabling USB communication, memory storage, and device power management.

Version
1.0.14
License
unset
Stars
0

scripts/render-pcb.ts

import { readFileSync, writeFileSync } from "node:fs";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const json = JSON.parse(readFileSync("dist/index/circuit.json", "utf8"));
for (const layer of ["top", "bottom"] as const) {
  const svg = convertCircuitJsonToPcbSvg(json, {
    layer, width: 1400, matchBoardAspectRatio: true,
    shouldDrawErrors: true, showErrorsInTextOverlay: true,
  });
  writeFileSync(`dist/index/pcb-${layer}.svg`, svg);
  writeFileSync(`dist/index/pcb-${layer}.png`, new Resvg(svg).render().asPng());
}