MustafaMulla29/usb-pd-motherboard

4-layer USB-C PD hub motherboard with 20 V USB-C input, Linux T113-S3 computer, CH338F USB hub, four individually controlled 5–20 V PD outputs, USB data/camera ports, regulated rails, and hardware watchdog/E-stop safety interlock.

Version
1.0.24
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/usb-pd-motherboard  # download the package files into ./usb-pd-motherboard
tsci add MustafaMulla29/usb-pd-motherboard    # add it to your project as @tsci/MustafaMulla29.usb-pd-motherboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

tools/render-schematic.ts

import { readFileSync,writeFileSync,mkdirSync } from 'node:fs'
import { convertCircuitJsonToSchematicSvg } from 'circuit-to-svg'
import { Resvg } from '@resvg/resvg-js'
const cj=JSON.parse(readFileSync('dist/codex-schematic.circuit.json','utf8'))
mkdirSync('dist/schematic-preview',{recursive:true})
for(const sheet of cj.filter((e:any)=>e.type==='schematic_sheet')){
 const svg=convertCircuitJsonToSchematicSvg(cj,{schematicSheetId:sheet.schematic_sheet_id,width:1800,height:1200})
 writeFileSync(`dist/schematic-preview/${sheet.name}.svg`,svg)
 writeFileSync(`dist/schematic-preview/${sheet.name}.png`,new Resvg(svg).render().asPng())
}