gokul/lora-device
A compact LoRa/GNSS device PCB integrating an SX1262 radio, GNSS module, USB/UART interface, 1.5 µH inductor, LiPo battery connector with NTC, and supporting passives.
- Version
- 0.1.6
- License
- unset
- Stars
- 0
validation/reproductions/assembly-pin1.ts.txt
import {convertCircuitJsonToAssemblySvg} from 'circuit-to-svg'
import {Resvg} from '@resvg/resvg-js'
const entries=[{type:'pcb_board',pcb_board_id:'board',center:{x:0,y:0},width:20,height:10,num_layers:2,thickness:1.6}]
for(const [index,cx,rotation] of [[1,-5,0],[2,5,180]]){
const sc=`sc${index}`,pc=`pc${index}`,sp=`sp${index}`
const x=cx+(rotation===0?-2:2),y=rotation===0?1:-1
entries.push({type:'source_component',source_component_id:sc,name:`U${index}`,ftype:'simple_chip'},
{type:'source_port',source_port_id:sp,source_component_id:sc,name:'pin1',pin_number:1},
{type:'pcb_component',pcb_component_id:pc,source_component_id:sc,center:{x:cx,y:0},width:4,height:4,layer:'top',rotation,pin1_location:'leftside_top'},
{type:'pcb_port',pcb_port_id:`port${index}`,pcb_component_id:pc,source_port_id:sp,x,y,layers:['top']},
{type:'pcb_smtpad',pcb_smtpad_id:`pad${index}`,pcb_component_id:pc,pcb_port_id:`port${index}`,shape:'rect',x,y,width:.8,height:.8,layer:'top'})
}
const svg=convertCircuitJsonToAssemblySvg(entries)
await Bun.write('work/repros/assembly-pin1.svg',svg)
await Bun.write('work/repros/assembly-pin1.png',new Resvg(svg,{fitTo:{mode:'width',value:1000}}).render().asPng())
await Bun.write('work/repros/assembly-pin1.circuit.json',JSON.stringify(entries,null,2))