gokul/cm4-media-carrier
A tscircuit package created by gokul.
- Version
- 0.1.0
- License
- unset
- Stars
- 0
components/HybridPad.tsx
import type { SmtPadProps } from "@tscircuit/props"
const mm = (dimension: string | number | undefined) => typeof dimension === "number" ? dimension : Number.parseFloat(dimension ?? "0")
/** Explicit top stencil for a hybrid connector whose stakes are hand soldered. */
export const HybridPad = (props: SmtPadProps) => {
if (props.shape === "polygon") {
// These four imported USB-C power pads are rectangles with sub-micron steps.
// Use an inset rectangular stencil aperture to avoid those import artifacts.
const xs = props.points.map(point => mm(point.x))
const ys = props.points.map(point => mm(point.y))
return <>
<smtpad {...props} />
<solderpaste shape="rect" layer="top"
pcbX={(Math.min(...xs) + Math.max(...xs)) / 2}
pcbY={(Math.min(...ys) + Math.max(...ys)) / 2}
width={Math.max(...xs) - Math.min(...xs) - 0.02}
height={Math.max(...ys) - Math.min(...ys) - 0.02} />
</>
}
if (props.shape !== "rect") throw new Error("HybridPad requires a rectangular or USB-C polygon pad")
return <>
<smtpad {...props} />
<solderpaste shape="rect" layer="top" pcbX={props.pcbX} pcbY={props.pcbY}
width={props.width} height={props.height} />
</>
}