astra/f1c100s
The code defines the physical pin layout, labels, and footprint for the F1C100S system-on-chip (SoC) component used in electronic devices.
- Version
- 0.9.2
- License
- unset
- Stars
- 0
scripts/preview-schematic.tsx
import { Circuit } from "tscircuit";
import { ProfilePreview } from "../src/ProfilePreview";
import { convertCircuitJsonToSchematicSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const c = new Circuit();
c.add(<ProfilePreview layoutProfile="lcd_top_storage_right" />);
await c.renderUntilSettled();
const json = c.getCircuitJson();
for (const [i, name] of ["interfaces", "power"].entries()) {
const svg = convertCircuitJsonToSchematicSvg(json, {
width: 1800,
height: 1273,
schematicSheetIndex: i,
});
await Bun.write(`previews/schematic-${name}.svg`, svg);
await Bun.write(
`previews/schematic-${name}.png`,
new Resvg(svg).render().asPng(),
);
}
if (process.env.SCHEMATIC_DEBUG_JSON)
await Bun.write(process.env.SCHEMATIC_DEBUG_JSON, JSON.stringify(json));
console.log(
JSON.stringify(
{
errors: json.filter((e) => e.type.endsWith("_error")),
outsideSheet: json.filter(
(e) => e.type === "schematic_element_outside_sheet_warning",
),
sheets: json.filter((e) => e.type === "schematic_sheet"),
components: json.filter((e) => e.type === "schematic_component").length,
},
null,
2,
),
);
await Bun.write(
"previews/schematic.svg",
Bun.file("previews/schematic-interfaces.svg"),
);
await Bun.write(
"previews/schematic.png",
Bun.file("previews/schematic-interfaces.png"),
);