seveibar/am3352-dev-board

A 324-ball TI AM3352 ARM processor with DDR3, LCD, USB, Ethernet, storage, serial, analog, clock, reset, power, and JTAG interfaces, paired with configurable JST-GH board connectors and constrained PCB routing.

Version
1.0.2
License
unset
Stars
0

scripts/render-pad-escapes.mjs

import fs from 'node:fs'
import path from 'node:path'
import { convertCircuitJsonToPcbSvg } from 'circuit-to-svg'
import { Resvg } from '@resvg/resvg-js'
const [input = 'dist/index/circuit.json', output = 'dist/pad-escapes', prefix = 'after'] = process.argv.slice(2)
const circuit = JSON.parse(fs.readFileSync(input, 'utf8'))
fs.mkdirSync(output, { recursive: true })
const viewports = {
  cpu: { minX: -8, minY: -8, maxX: 8, maxY: 8 },
  ram: { minX: -6, minY: -25, maxX: 6, maxY: -13 },
  pmic: { minX: -27, minY: -7, maxX: -19, maxY: 1 },
  'cpu-detail': { minX: -1.2, minY: -5.2, maxX: 1.2, maxY: -2.8 },
}
for (const [name, viewport] of Object.entries(viewports)) {
  const svg = convertCircuitJsonToPcbSvg(circuit, {
    width: 1200, height: 1200, layer: 'top', viewport,
    showSolderMask: false, showCourtyards: false, showPcbGroups: false,
    showPcbNotes: false, showFabricationNotes: false, showDebugObjects: false,
  })
  fs.writeFileSync(path.join(output, `${prefix}-${name}.svg`), svg)
  fs.writeFileSync(path.join(output, `${prefix}-${name}.png`), new Resvg(svg).render().asPng())
}