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.

src/components.tsx

import * as React from 'react'
import { schematicPlacement } from './schematicPlacement'
import { CL05B104KO5NNNC } from '../imports/CL05B104KO5NNNC'
import { CL05A105KA5NQNC } from '../imports/CL05A105KA5NQNC'
import { CL10A105KB8NNNC } from '../imports/CL10A105KB8NNNC'
import { CL10A475KO8NNNC } from '../imports/CL10A475KO8NNNC'
import type { Half } from './mechanicalGeometry'
import { offsetPlacement, pcbProps } from './componentPlacement'
export type PassiveSpec={ref:string;kind:'C'|'R'|'L';value:string;from:string;to:string;dx:number;dy:number;rotation?:number;footprint?:string|React.ReactElement;mpn?:string;doNotPlace?:boolean}
export function Passives({half,anchor,section,specs,schX=0,schY=0}:{half:Half;anchor:string;section:string;specs:PassiveSpec[];schX?:number;schY?:number}) {
 return <>{specs.map((p,i)=>{
 const props={name:p.ref,footprint:p.footprint??'0402',manufacturerPartNumber:p.mpn,doNotPlace:p.doNotPlace,
 ...pcbProps(offsetPlacement(half,p.ref,anchor,p.dx,p.dy,p.rotation)),
 schX:schX+(i%4)*2,schY:schY-Math.floor(i/4)*3,schSectionName:section,
 schRotation:p.to==='GND'?-90:p.to==='VCC'?90:p.from==='VBAT'||p.from==='VBAT_SENSE_PWR'?-90:0,
 connections:{pin1:`net.${p.from}`,pin2:`net.${p.to}`},...schematicPlacement[p.ref]}
 const {footprint,manufacturerPartNumber,...importedProps}=props
 if(p.kind==='C'&&p.value==='100nF'&&p.footprint===undefined) return <CL05B104KO5NNNC key={p.ref} {...importedProps}/>
 if(p.kind==='C'&&p.value==='1uF') return p.footprint==='0603'?<CL10A105KB8NNNC key={p.ref} {...importedProps}/>:<CL05A105KA5NQNC key={p.ref} {...importedProps}/>
 if(p.kind==='C'&&p.value==='4.7uF'&&p.footprint==='0603') return <CL10A475KO8NNNC key={p.ref} {...importedProps}/>
 return p.kind==='C'?<capacitor key={p.ref} {...props} capacitance={p.value}/>:p.kind==='R'?<resistor key={p.ref} {...props} resistance={p.value}/>:<inductor key={p.ref} {...props} inductance={p.value}/>
 })}</>
}