rushabhcodes/wireless-split-keyboard

Wireless Split Keyboard — custom routed nRF52840 split PCBs with a printable enclosure

Version
0.4.5
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/wireless-split-keyboard  # download the package files into ./wireless-split-keyboard
tsci add rushabhcodes/wireless-split-keyboard    # add it to your project as @tsci/rushabhcodes.wireless-split-keyboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

imports/PEC11R_4215K_S0012.tsx

import * as React from 'react'
import { encoderCadModel } from '../src/mechanicalModels'
import type { ChipProps } from "@tscircuit/props"

const pinLabels = {
  pin1: ["S1"],
  pin2: ["S2"],
  pin3: ["A"],
  pin4: ["C"],
  pin5: ["B"],
  pin6: ["MT1"],
  pin7: ["MT2"]
} as const

export const PEC11R_4215K_S0012 = (props: ChipProps<typeof pinLabels>) => {
  return (
    <chip
      pinLabels={pinLabels}
      pinAttributes={Object.fromEntries(Object.keys(pinLabels).map(pin=>[pin,{isPassive:true,requiresPower:false,requiresGround:pin==='pin4'||pin==='pin6'||pin==='pin7'}]))}
      symbol={
        <symbol>
          <schematicrect schX={0} schY={0} width={1.2} height={1.2} strokeWidth={0.02} color="#8D2323" />
          <schematicpath points={[{"x":-0.4,"y":0},{"x":-0.4,"y":0.2}]} strokeColor="#8D2323" />
          <schematiccircle center={{ x: -0.4, y: 0 }} radius={0.02} strokeWidth={0.02} color="#8D2323" />
          <port name="pin5" pinNumber={5} aliases={["B"]} direction="left" schX={-0.8} schY={-0.4} schStemLength={0.4} />
          <port name="pin4" pinNumber={4} aliases={["C"]} direction="left" schX={-0.8} schY={0} schStemLength={0.4} />
          <port name="pin3" pinNumber={3} aliases={["A"]} direction="left" schX={-0.8} schY={0.4} schStemLength={0.4} />
          <schematicrect schX={0.39} schY={0.1} width={0.02} height={0.52} strokeWidth={0.02} color="#8D2323" />
          <schematicpath points={[{"x":0.38,"y":0.02},{"x":0.3,"y":0.02},{"x":0.3,"y":0.18},{"x":0.38,"y":0.18}]} strokeColor="#8D2323" />
          <port name="pin1" pinNumber={1} aliases={["1"]} direction="right" schX={0.8} schY={0.4} schStemLength={0.2} />
          <port name="pin2" pinNumber={2} aliases={["2"]} direction="right" schX={0.8} schY={-0.2} schStemLength={0.2} />
          <schematiccircle center={{ x: 0.52, y: -0.12 }} radius={0.04} strokeWidth={0.02} color="#8D2323" />
          <schematiccircle center={{ x: 0.52, y: 0.32 }} radius={0.04} strokeWidth={0.02} color="#8D2323" />
          <schematicpath points={[{"x":0.52,"y":-0.2},{"x":0.52,"y":-0.16}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":0.52,"y":0.36},{"x":0.52,"y":0.4}]} strokeColor="#8D2323" />
          <port name="pin6" pinNumber={6} aliases={["MT1"]} direction="down" schX={-0.2} schY={-0.8} schStemLength={0.2} />
          <port name="pin7" pinNumber={7} aliases={["MT2"]} direction="down" schX={0.2} schY={-0.8} schStemLength={0.2} />
          <schematicpath points={[{"x":-0.4,"y":0},{"x":-0.4,"y":-0.2}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":-0.4,"y":0.2},{"x":-0.34,"y":0.3}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":-0.4,"y":0.3},{"x":-0.4,"y":0.4}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":-0.4,"y":-0.4},{"x":-0.4,"y":-0.3}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":-0.4,"y":-0.2},{"x":-0.34,"y":-0.3}]} strokeColor="#8D2323" />
          <schematicpath svgPath="M -0.04 -0.24 A 0.24 0.24 0 0 1 -0.04 0.24" strokeColor="#840000" />
          <schematicpath svgPath="M 0.11 0 A 0.15 0.15 0 1 1 0.109852 -0.006648" strokeColor="#840000" />
          <schematicpath points={[{"x":-0.06,"y":-0.14},{"x":-0.06,"y":0.14}]} strokeColor="#840000" />
          <schematicpath points={[{"x":-0.04,"y":-0.24},{"x":0,"y":-0.28}]} strokeColor="#840000" />
          <schematicpath points={[{"x":-0.04,"y":-0.24},{"x":0,"y":-0.2}]} strokeColor="#840000" />
          <schematicpath points={[{"x":-0.04,"y":-0.14},{"x":-0.04,"y":0.14}]} strokeColor="#840000" />
          <schematicpath points={[{"x":-0.04,"y":0.24},{"x":0,"y":0.2}]} strokeColor="#840000" />
          <schematicpath points={[{"x":-0.02,"y":0.14},{"x":-0.02,"y":-0.14}]} strokeColor="#840000" />
          <schematicpath points={[{"x":0,"y":0.28},{"x":-0.04,"y":0.24}]} strokeColor="#840000" />
          <schematicpath points={[{"x":0.6,"y":0.4},{"x":0.52,"y":0.4}]} strokeColor="#8D2323" />
          <schematicpath points={[{"x":0.6,"y":-0.2},{"x":0.52,"y":-0.2}]} strokeColor="#8D2323" />
          <schematictext schX={0} schY={0.808} text="{NAME}" fontSize={0.2} anchor="bottom_center" />
        </symbol>
      }
      supplierPartNumbers={{
  "jlcpcb": [
    "C18164806"
  ]
}}
      manufacturerPartNumber="PEC11R-4215K-S0012"
      // Nominal PEC11R mounting-side drawing, not the catalog's offset footprint.
      footprint={<footprint>
        {([-2.5,0,2.5] as const).map((x,i)=><React.Fragment key={i}><platedhole portHints={[`pin${i+3}`]} pcbX={x} pcbY={-7.5} outerDiameter={1.8} holeDiameter={1.1} shape="circle"/></React.Fragment>)}
        <platedhole portHints={['pin1']} pcbX={-2.5} pcbY={7} outerDiameter={1.8} holeDiameter={1.1} shape="circle"/>
        <platedhole portHints={['pin2']} pcbX={2.5} pcbY={7} outerDiameter={1.8} holeDiameter={1.1} shape="circle"/>
        {([-5.7,5.7] as const).map((x,i)=><React.Fragment key={i}><platedhole portHints={[`pin${i+6}`]} pcbX={x} pcbY={0} holeWidth={1.8} holeHeight={2.6} outerWidth={2.4} outerHeight={3.2} shape="pill"/></React.Fragment>)}
        <silkscreentext text="{NAME}" pcbX={0} pcbY={-6.6} fontSize={.8} layer="bottom"/>
      <courtyardrect width={13.5} height={17.5}/></footprint>}
      // Supplier OBJ has a 4 mm D shaft; use the manufacturer's 6 mm knurled
      // shaft envelope instead. PCB top is z=0 in this local model.
      cadModel={{jscad:encoderCadModel}}
      {...props}
    />
  )
}