From a77f800716d2d49265a5cd97d6f5d60b18588add Mon Sep 17 00:00:00 2001
From: Neil Gershenfeld <gersh@cba.mit.edu>
Date: Wed, 20 Dec 2023 19:57:24 -0500
Subject: [PATCH] wip

---
 python/pcb.py | 182 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 179 insertions(+), 3 deletions(-)

diff --git a/python/pcb.py b/python/pcb.py
index e05e38c..86b392d 100755
--- a/python/pcb.py
+++ b/python/pcb.py
@@ -6,7 +6,7 @@
 # usage:
 #    pcb.py | frep.py [dpi [filename]]
 #
-# Neil Gershenfeld 10/17/21
+# Neil Gershenfeld 12/16/23
 #
 # This work may be reproduced, modified, distributed,
 # performed, and displayed for any purpose, but must
@@ -23,7 +23,7 @@
 #output = "top, labels, holes, and exterior"
 #output = "top, bottom, labels, and exterior"
 output = "top, bottom, labels, holes, and exterior"
-#output = "top traces"
+output = "top traces"
 #output = "top traces and exterior"
 #output = "bottom traces"
 #output = "bottom traces reversed"
@@ -1321,7 +1321,7 @@ class header_IMU_4754_hole(part):
    # Adafruit 4754 IMU breakout through-hole
    #
    def __init__(self,value,zb,zt):
-      pad_header = cylinder(0,0,zb,zt,.03)
+      pad_header = cylinder(0,0,zb,zt,.04)
       pad_hole = cylinder(0,0,zb,zt,.018)
       self.value = value
       self.pad = [point(0,0,0)]
@@ -6651,6 +6651,182 @@ class PicoW(part):
          self.pad.append(point(board_width/2+pad_offset,(0.5+i)*pad_pitch))
          self.labels.append(self.text(self.pad[-1].x-label_offset,self.pad[-1].y,self.pad[-1].z,str(31+i)))
 
+class XIAO_RP2040(part):
+   #
+   # XIAO
+   #
+   def __init__(self,value=''):
+      self.value = value
+      self.pad = [point(0,0,0)]
+      self.labels = []
+      padl = cube(-0.03,0.081,-0.070/2,0.070/2,0,0)
+      padr = cube(-0.081,0.03,-0.070/2,0.070/2,0,0)
+      width = 0.713
+      length = 0.843
+      d = 0.015
+      pitch = 0.1
+      offset = 0.08
+      dx = 0.035
+      #
+      # pin 1
+      #
+      self.shape = translate(padl,-width/2,3*pitch,0)
+      self.pad.append(point(-width/2,3*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'D0'))
+      #
+      # pin 2
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,2*pitch,0))
+      self.pad.append(point(-width/2,2*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'D1'))
+      #
+      # pin 3
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,1*pitch,0))
+      self.pad.append(point(-width/2,1*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'D2'))
+      #
+      # pin 4
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,0*pitch,0))
+      self.pad.append(point(-width/2,0*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'D3'))
+      #
+      # pin 5
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,-1*pitch,0))
+      self.pad.append(point(-width/2,-1*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'SDA'))
+      #
+      # pin 6
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,-2*pitch,0))
+      self.pad.append(point(-width/2,-2*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'SCL'))
+      #
+      # pin 7
+      #
+      self.shape = add(self.shape,translate(padl,-width/2,-3*pitch,0))
+      self.pad.append(point(-width/2,-3*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x+dx,self.pad[-1].y,self.pad[-1].z,'TX'))
+      #
+      # pin 8
+      #
+      self.shape = add(self.shape,translate(padr,width/2,-3*pitch,0))
+      self.pad.append(point(width/2,-3*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'RX'))
+      #
+      # pin 9
+      #
+      self.shape = add(self.shape,translate(padr,width/2,-2*pitch,0))
+      self.pad.append(point(width/2,-2*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'SCK'))
+      #
+      # pin 10
+      #
+      self.shape = add(self.shape,translate(padr,width/2,-1*pitch,0))
+      self.pad.append(point(width/2,-1*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'SDI'))
+      #
+      # pin 11
+      #
+      self.shape = add(self.shape,translate(padr,width/2,0*pitch,0))
+      self.pad.append(point(width/2,0*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'SDO'))
+      #
+      # pin 12
+      #
+      self.shape = add(self.shape,translate(padr,width/2,1*pitch,0))
+      self.pad.append(point(width/2,1*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'3V3'))
+      #
+      # pin 13
+      #
+      self.shape = add(self.shape,translate(padr,width/2,2*pitch,0))
+      self.pad.append(point(width/2,2*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'G'))
+      #
+      # pin 14
+      #
+      self.shape = add(self.shape,translate(padr,width/2,3*pitch,0))
+      self.pad.append(point(width/2,3*pitch,0))
+      self.labels.append(self.text(self.pad[-1].x-dx,self.pad[-1].y,self.pad[-1].z,'5V'))
+      #
+      # VIN
+      #
+      self.shape = add(self.shape,cube(
+         -width/2+0.287-d,
+         -width/2+0.287+0.040+d,
+         -length/2+0.033-d,
+         -length/2+0.033+0.086+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.287+0.040/2,
+         -length/2+0.033+0.086/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VIN'))
+      #
+      # GND
+      #
+      self.shape = add(self.shape,cube(
+         -width/2+0.287+0.040+0.062-d,
+         -width/2+0.287+0.040+0.062+0.040+d,
+         -length/2+0.033-d,
+         -length/2+0.033+0.086+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.287+0.040+0.062+0.040/2,
+         -length/2+0.033+0.086/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
+      #
+      # prog
+      #
+      self.shape = add(self.shape,cube(
+         -width/2+0.288-d,
+         -width/2+0.288+0.045+d,
+         length/2-0.058-0.045-d,
+         length/2-0.058+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.288+0.045/2,
+         length/2-0.058-0.045/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DIO'))
+      self.shape = add(self.shape,cube(
+         -width/2+0.288+0.045+0.057-d,
+         -width/2+0.288+0.045+0.057+0.045+d,
+         length/2-0.058-0.045-d,
+         length/2-0.058+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.288+0.045+0.057+0.045/2,
+         length/2-0.058-0.045/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLK'))
+      self.shape = add(self.shape,cube(
+         -width/2+0.288-d,
+         -width/2+0.288+0.045+d,
+         length/2-0.058-0.045-0.058-0.045-d,
+         length/2-0.058-0.045-0.058+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.288+0.045/2,
+         length/2-0.058-0.045-0.058-0.045/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RST'))
+      self.shape = add(self.shape,cube(
+         -width/2+0.288+0.045+0.057-d,
+         -width/2+0.288+0.045+0.057+0.045+d,
+         length/2-0.058-0.045-0.058-0.045-d,
+         length/2-0.058-0.045-0.058+d,
+         0,0))
+      self.pad.append(point(
+         -width/2+0.288+0.045+0.057+0.045/2,
+         length/2-0.058-0.045-0.058-0.045/2,
+         0))
+      self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
+
 class XIAO(part):
    #
    # XIAO
-- 
GitLab