seveibar/am3352-dev-board-4layer-dogbone

Defines PCB footprints and pin mappings for a TI AM3352ZCZ100 processor, JST GH connectors, and assembly-part lookup helpers for capacitors, resistors, and headers.

Version
0.1.5
License
unset
Stars
0

scripts/render-schematic.mjs

import fs from 'node:fs'
import {convertCircuitJsonToSchematicSvg} from 'circuit-to-svg'
import {Resvg} from '@resvg/resvg-js'
const c=JSON.parse(fs.readFileSync('dist/index/circuit.json'))
fs.mkdirSync('schematic',{recursive:true})
for(const sheet of c.filter(e=>e.type==='schematic_sheet')){
 const svg=convertCircuitJsonToSchematicSvg(c,{schematicSheetId:sheet.schematic_sheet_id,width:2100,height:1750,shouldDrawWarnings:false,includeVersion:false})
 fs.writeFileSync(`schematic/${sheet.name}.svg`,svg)
 fs.writeFileSync(`schematic/${sheet.name}.png`,new Resvg(svg).render().asPng())
}
console.log('Rendered eight schematic sheets')
const pages=c.filter(e=>e.type==='schematic_sheet').map(s=>({name:s.name,title:s.display_name}))
fs.writeFileSync('schematic/index.html',`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>AM3352 schematic</title><style>
*{box-sizing:border-box}body{margin:0;font:14px system-ui;background:#f1efe8;color:#152a31}header{position:sticky;top:0;background:#fff;padding:14px 22px;border-bottom:1px solid #d6ddd9;z-index:2;display:flex;gap:22px;align-items:center;flex-wrap:wrap}h1{font-size:18px;margin:0}nav{display:flex;gap:6px;flex-wrap:wrap}button,a{font:inherit}button{border:1px solid #c9d5d3;border-radius:6px;padding:7px 10px;background:white;cursor:pointer}button[aria-current=true]{background:#174f51;color:white;border-color:#174f51}a{color:#174f51}#viewport{overflow:auto;height:calc(100vh - 140px);padding:18px}#sheet{display:block;max-width:none;margin:auto;box-shadow:0 2px 16px #0001}#title{padding:10px 24px;font-size:14px;margin:0}label{display:flex;align-items:center;gap:8px}</style><header><h1>AM3352 schematic</h1><nav id="nav"></nav><label>Zoom <input id="zoom" type="range" min="60" max="260" value="100"></label><a id="download" target="_blank">Open SVG</a><a href="../index.html#file=index.circuit.tsx">Board viewer</a></header><p id="title"></p><main id="viewport"><img id="sheet" alt="Circuit schematic sheet"></main><script>
const pages=${JSON.stringify(pages)};const nav=document.querySelector('#nav'),sheet=document.querySelector('#sheet');
function select(name){const p=pages.find(p=>p.name===name)||pages[0];sheet.src=p.name+'.svg';document.querySelector('#download').href=sheet.src;document.querySelector('#title').textContent=p.title;location.hash=p.name;document.querySelectorAll('button').forEach(b=>b.setAttribute('aria-current',String(b.dataset.name===p.name)));}
pages.forEach((p,i)=>{const b=document.createElement('button');b.textContent=(i+1)+'. '+p.title;b.dataset.name=p.name;b.onclick=()=>select(p.name);nav.append(b)});
function zoom(){sheet.style.width=document.querySelector('#zoom').value+'%'}document.querySelector('#zoom').oninput=zoom;zoom();select(decodeURIComponent(location.hash.slice(1)));window.onhashchange=()=>select(decodeURIComponent(location.hash.slice(1)));
</script></html>`)
fs.cpSync('schematic','dist/schematic',{recursive:true})