glauber/sois-controller-rev-c
Source code for the SOIS Controller PCB, featuring an Adafruit Feather microcontroller, two EC11 rotary encoders, multiple push buttons and a slide switch. View more at glauber.org
- Version
- 0.1.3
- License
- UNLICENSED
- Stars
- 0
src/PushButton12mm.tsx
import type { ChipProps } from "tscircuit"
import { modelUrl } from "./models"
/**
* 12mm THT tactile switch, from KiCad's `Button_Switch_THT:SW_PUSH-12mm`.
* Four holes, two ports — each pole is duplicated across the 12.5mm span.
* Footprint origin is pad 1; body centre is at local (6.25, -2.5).
*/
const pinLabels = { pin1: "A", pin2: "B" } as const
const pads: Array<[string, number, number]> = [
["1", 0, 0],
["1", 12.5, 0],
["2", 0, -5],
["2", 12.5, -5],
]
export const PushButton12mm = (props: ChipProps<typeof pinLabels>) => (
<chip
{...props}
pinLabels={pinLabels}
cadModel={{
stepUrl: modelUrl("sw_push_12mm_wuerth.step"),
positionOffset: { x: -6.25, y: 2.5, z: 0 },
}}
footprint={
<footprint>
{pads.map(([hint, x, y], i) => (
<platedhole
key={i}
portHints={[hint, hint === "1" ? "A" : "B"]}
shape="pill"
pcbX={`${x}mm`}
pcbY={`${y}mm`}
outerWidth="3.2mm"
outerHeight="1.9mm"
holeWidth="1.3mm"
holeHeight="1.3mm"
/>
))}
{/* 12 x 12 body outline */}
<silkscreenpath
strokeWidth="0.12mm"
route={[
{ x: 0.25, y: 3.5 },
{ x: 12.25, y: 3.5 },
{ x: 12.25, y: -8.5 },
{ x: 0.25, y: -8.5 },
{ x: 0.25, y: 3.5 },
]}
/>
</footprint>
}
/>
)