krishnax12/t113-minimal-linux

Allwinner T113-S3 dual-Cortex-A7 SoC with integrated 128MB DDR3, multi-rail decoupling, 24MHz and 32.768kHz oscillators, filtering, and exposed test points.

Version
0.1.1
License
unset
Stars
0

circuits/helpers.tsx

type PassiveProps = {
  name: string
  value: string
  a: string
  b?: string
  x: number
  y: number
  rotation?: number
  footprint?: string
  layer?: "top" | "bottom"
}

export function Wire({
  from,
  net,
  width = 0.15,
}: { from: string; net: string; width?: number }) {
  return (
    <trace from={from} to={`net.${net}`} width={width} schDisplayLabel={net} />
  )
}

export function R(resistor: PassiveProps) {
  return (
    <>
      <resistor
        name={resistor.name}
        resistance={resistor.value}
        footprint={resistor.footprint ?? "0603"}
        pcbX={resistor.x}
        pcbY={resistor.y}
        pcbRotation={resistor.rotation ?? 0}
        layer={resistor.layer}
      />
      <Wire from={`.${resistor.name} > .pin1`} net={resistor.a} />
      <Wire from={`.${resistor.name} > .pin2`} net={resistor.b ?? "GND"} />
    </>
  )
}

export function C(capacitor: PassiveProps) {
  return (
    <>
      <capacitor
        name={capacitor.name}
        capacitance={capacitor.value}
        maxVoltageRating="10V"
        footprint={capacitor.footprint ?? "0402"}
        pcbX={capacitor.x}
        pcbY={capacitor.y}
        pcbRotation={capacitor.rotation ?? 0}
        layer={capacitor.layer}
        schRotation={270}
      />
      <Wire from={`.${capacitor.name} > .pin1`} net={capacitor.a} />
      <Wire from={`.${capacitor.name} > .pin2`} net={capacitor.b ?? "GND"} />
    </>
  )
}

export function Silk({
  text,
  x,
  y,
  size = 1.1,
}: { text: string; x: number; y: number; size?: number }) {
  return <silkscreentext text={text} pcbX={x} pcbY={y} fontSize={size} />
}

export function TP({
  name,
  net,
  x,
  y,
}: { name: string; net: string; x: number; y: number }) {
  return (
    <>
      <testpoint
        name={name}
        doNotPlace
        footprintVariant="through_hole"
        padDiameter={1.8}
        holeDiameter={0.9}
        pcbX={x}
        pcbY={y}
      />
      <Wire from={`.${name} > .pin1`} net={net} />
      <Silk text={net} x={x} y={y - 2} size={0.85} />
    </>
  )
}