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/geometry.ts

/**
 * Fixed geometry, copied from `../controller-rev-c/` — the KiCad board that
 * was fabricated. Numbers below are in KiCad's frame: origin at the board's
 * top-left, +y down. `bx`/`by` convert to tscircuit's centre-origin, +y-up
 * frame; footprint-local y is negated the same way, which leaves rotations
 * unchanged between the two.
 */

export const W = 154.0
export const H = 64.0
export const CORNER_RADIUS = 3.0

/** KiCad design x (0 = left edge) -> tscircuit x (0 = board centre). */
export const bx = (x: number) => x - W / 2
/** KiCad design y (0 = top edge, +y down) -> tscircuit y (+y up). */
export const by = (y: number) => H / 2 - y

// The Ø48.2 knob caps and 24.1mm button caps are the fixed geometry; the rest
// of the board is placed to serve them.
/** Encoder shaft centres, 50mm pitch. */
export const KNOBS: Array<[number, number]> = [
  [26.6, 32.0],
  [76.6, 32.0],
]
/** 2x2 button block centre. */
export const BLOCK: [number, number] = [127.4, 32.0]
/** Button centres = block centre +/- this. */
export const BTN_OFF = 12.05
export const SW_CELL: Array<[number, number]> = [
  [BLOCK[0] - BTN_OFF, BLOCK[1] - BTN_OFF],
  [BLOCK[0] + BTN_OFF, BLOCK[1] - BTN_OFF],
  [BLOCK[0] - BTN_OFF, BLOCK[1] + BTN_OFF],
  [BLOCK[0] + BTN_OFF, BLOCK[1] + BTN_OFF],
]

/**
 * Feather origin (pad 1). Horizontal in the bottom-left corner, module edge
 * 0.30mm off the left board edge with the USB-C overhanging it, soldered
 * flush so the caps clear its 4.80mm top.
 */
export const FEATHER: [number, number] = [6.65, 61.73]
export const FEATHER_ROT = 90
/** EC11 footprint origin is pad A; the shaft sits at local (+7.5, +2.5). */
export const EC11_SHAFT_OFF: [number, number] = [7.5, 2.5]
/** SW_PUSH-12mm origin is pad 1; the body centre sits at local (+6.25, +2.5). */
export const SW_OFF: [number, number] = [6.25, 2.5]
/** C&K slide switch origin (pad 2, the common) on the left edge at mid-height. */
export const SW5: [number, number] = [4.0, H / 2]
/** Copper keep-out under the Feather's PCB antenna, both layers. x1,y1,x2,y2. */
export const ANT_KEEPOUT: [number, number, number, number] = [40.3, 39.5, 51.9, 63.5]
/**
 * Three only — the Feather owns the bottom-left corner, and its own four M2.5
 * NPTH holes anchor that end of the board.
 */
export const CORNER_HOLES: Array<[number, number]> = [
  [3.5, 3.5],
  [W - 3.5, 3.5],
  [W - 3.5, H - 3.5],
]