astra/pd-power-supply

USB-PD Power Supply with RP2040 controller

Version
1.1.6
License
unset
Stars
0

mechanical.tsx

import { knobModel, oledModel, cap8Model, cap10Model } from './models'
import type { ChipProps } from '@tscircuit/props'
// Generic SSD1306 module, 27 x 27 mm. Header order explicitly GND/VCC/SCL/SDA.
// Buy a module matching this pin order and verify hole locations before fabrication.
export const Oled128x64 = (props:ChipProps) => <chip cadModel={{glbUrl:oledModel,positionOffset:{x:0,y:-11,z:0}}} manufacturerPartNumber="SSD1306 0.96in I2C module, GND-VCC-SCL-SDA" pinLabels={{pin1:'GND',pin2:'VCC',pin3:'SCL',pin4:'SDA'}} footprint={<footprint>
  {[0,1,2,3].map(i=><platedhole portHints={[`pin${i+1}`]} pcbX={(i-1.5)*2.54} pcbY={11} holeDiameter={1} outerDiameter={1.8} shape="circle"/>)}
  <silkscreenrect width={27} height={27} filled={false} strokeWidth={0.2}/>
  <silkscreenrect pcbY={-1} width={24} height={14} filled={false} strokeWidth={0.2}/>
  <silkscreentext text="128 x 64 OLED" pcbY={-1} fontSize={1.4}/>
</footprint>} {...props}/>
export const Knob = () => <>
  <silkscreencircle pcbX={15} pcbY={3.85} radius={13} strokeWidth={0.2}/>
  {Array.from({length:5},(_,i)=>{const a=(225-i*67.5)*Math.PI/180;return <silkscreenpath route={[{x:15+13.8*Math.cos(a),y:3.85+13.8*Math.sin(a)},{x:15+15*Math.cos(a),y:3.85+15*Math.sin(a)}]} strokeWidth={0.25}/>})}
</>

export const RadialCap = ({diameter,pitch,...props}:any) => <capacitor polarized cadModel={{glbUrl:diameter===8?cap8Model:cap10Model}} footprint={<footprint>
  <platedhole portHints={["pin1"]} pcbX={-pitch/2} holeDiameter={0.9} outerDiameter={1.8} shape="circle"/>
  <platedhole portHints={["pin2"]} pcbX={pitch/2} holeDiameter={0.9} outerDiameter={1.8} shape="circle"/>
  <silkscreencircle radius={diameter/2} strokeWidth={0.15}/>
  <silkscreentext text="+" pcbX={-diameter/2-0.8} fontSize={1}/>
  <courtyardcircle radius={diameter/2+0.25}/>
</footprint>} {...props}/>