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
src/schematic-boxes.tsx
import { PIN_NETS, RAILS } from "./pin-map";
export const SCHEMATIC_BANKS = [
{
name: "U1A",
title: "RGB666 LCD",
pins: Object.keys(PIN_NETS)
.map(Number)
.filter((p) => PIN_NETS[p]!.startsWith("LCD_")),
side: "rightSide",
},
{
name: "U1B",
title: "SPI / SDMMC",
pins: [59, 60, 61, 62, 53, 54, 55, 56, 57, 58],
side: "rightSide",
},
{
name: "U1C",
title: "UART / I2C / GPIO",
pins: [48, 49, 38, 37, 47, 46, 45, 44, 43, 42, 41, 40, 39],
side: "rightSide",
},
{
name: "U1D",
title: "Audio",
pins: [1, 88, 2, 3, 87, 86, 84, 85, 81, 83],
side: "rightSide",
},
{
name: "U1E",
title: "Video / touch",
pins: [72, 77, 78, 75, 76, 79, 63, 64, 65, 66],
side: "rightSide",
},
{
name: "U1F",
title: "Clock / reset / USB",
pins: [51, 52, 70, 68, 69, 33],
side: "leftSide",
},
{
name: "U1G",
title: "Power",
pins: Object.keys(PIN_NETS)
.map(Number)
.filter(
(p) =>
(RAILS as readonly string[]).includes(PIN_NETS[p]!) ||
PIN_NETS[p] === "GND",
),
side: "leftSide",
},
].map((bank) => ({
...bank,
width: 2.6,
height: Math.round((bank.pins.length * 0.35 + 0.3) * 100) / 100,
}));
export const SCHEMATIC_BANK_PINS = SCHEMATIC_BANKS.flatMap((b) => b.pins);
export const SCHEMATIC_PIN_LABELS = Object.fromEntries(
Object.entries(PIN_NETS).map(([p, net]) => [
p,
Object.values(PIN_NETS).filter((n) => n === net).length > 1
? `${net}_${p}`
: net,
]),
);
export interface F1C100SSchematicBoxProps {
/** Name of the placed F1C100SModule. */
moduleName: string;
name?: string;
schX?: number;
schY?: number;
schSheetName?: string;
schSectionName?: string;
width?: number;
height?: number;
}
export function createSchematicBox(
bank: (typeof SCHEMATIC_BANKS)[number],
props: Omit<F1C100SSchematicBoxProps, "moduleName"> & { chipRef: string },
) {
return (
<schematicbox
name={bank.name}
width={bank.width}
height={bank.height}
pinLabels={Object.fromEntries(
bank.pins.map((p) => [`pin${p}`, SCHEMATIC_PIN_LABELS[p]!]),
)}
schPinArrangement={{ [bank.side]: bank.pins.map((p) => `pin${p}`) }}
schPinStyle={Object.fromEntries(
bank.pins.map((p) => [`pin${p}`, { marginTop: 0.15 }]),
)}
{...props}
/>
);
}
function unit(index: number) {
return ({ moduleName, ...props }: F1C100SSchematicBoxProps) =>
createSchematicBox(SCHEMATIC_BANKS[index]!, {
chipRef: `.${moduleName} .MODULE .U1`,
name: `${moduleName}_${SCHEMATIC_BANKS[index]!.name}`,
...props,
});
}
export const F1C100SLcdSchematicBox = unit(0);
export const F1C100SStorageSchematicBox = unit(1);
export const F1C100SGpioSchematicBox = unit(2);
export const F1C100SAudioSchematicBox = unit(3);
export const F1C100SVideoTouchSchematicBox = unit(4);
export const F1C100SSystemSchematicBox = unit(5);
export const F1C100SPowerSchematicBox = unit(6);