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

design/replay-router.ts

import copper from './routed-copper.json'
// Replay independently audited copper through tscircuit's custom-router interface.
// tscircuit still runs its ordinary copper connectivity and DRC checks on these results.
export async function replayRouter(input:any) {
 const handlers:Record<string,(event:any)=>void>={}
 return {
  stop(){},
  on(event:string,fn:(event:any)=>void){handlers[event]=fn;return this},
  start(){
   try {
    const traces:any[]=[]
    for (const connection of input.connections) {
     const key=connection.name as keyof typeof copper.nets
     const routes=copper.nets[key]
     for (const route of routes ?? []) for (const p of route) if (p.route_type === "wire" && !["top", "inner1", "inner2", "bottom"].includes(p.layer ?? "")) throw new Error(`Invalid four-layer route: ${p.layer}`)
     if (!routes?.length) continue // Unrouted connections remain visible to native connectivity DRC.
     const expected=copper.endpoints[key as keyof typeof copper.endpoints]
     for (const p of connection.pointsToConnect) {
      if (!expected.some(([x,y])=>Math.hypot(p.x-x,p.y-y)<0.002)) throw new Error(`Placement changed for ${connection.name}; reroute before building`)
     }
     for (let i=0;i<routes.length;i++) traces.push({type:'pcb_trace',pcb_trace_id:`fr_${key}_${i}`,connection_name:connection.name,source_trace_id:copper.sourceTraceIds[key as keyof typeof copper.sourceTraceIds],route:routes[i]})
    }
    handlers.complete?.({traces})
   } catch(error){handlers.error?.({error})}
  },
 }
}