From 6d91fc8b750c4543ebacae5d9d0f11acc5820689 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 20 Jan 2013 23:56:51 -0800 Subject: [PATCH] Add a few custom packages Signed-off-by: Keith Packard --- packages/MS5607.py | 83 +++++++++++++++ packages/Makefile | 13 +++ packages/footprint.5c | 235 ++++++++++++++++++++++++++++++++++++++++++ packages/uson-8.5c | 79 ++++++++++++++ packages/wson6x5.5c | 83 +++++++++++++++ 5 files changed, 493 insertions(+) create mode 100755 packages/MS5607.py create mode 100644 packages/Makefile create mode 100644 packages/footprint.5c create mode 100644 packages/uson-8.5c create mode 100644 packages/wson6x5.5c diff --git a/packages/MS5607.py b/packages/MS5607.py new file mode 100755 index 0000000..94c30d5 --- /dev/null +++ b/packages/MS5607.py @@ -0,0 +1,83 @@ +#!/usr/bin/python +# Copyright 2007 by Bdale Garbee . GPLv2 +# +# Program to emit PCB footprint for Measurement Systems MS5607 & MS5611 sensors +# + +# dimensions in mm from MP3H6115A.pdf Motorola packaging datasheet +PinWidth = 0.6 +PinHeight = 1.1 +PinSpacing = 1.25 +RowCenters = 2.2 +RowSpacing = RowCenters - PinHeight +BodyWidth = 3.0 +BodyHeight = 5.0 + +import sys + +# we're going to use the 1/100 of a mil fundamental unit form +def mm2mils100( mm ): + return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 ) + +print '# author: Bdale Garbee' +print '# email: bdale@gag.com' +print '# dist-license: GPL 2' +print '# use-license: unlimited' + +print 'Element[0x0 "MOT1317" "" "" 0 0 -10161 -12011 0 100 0x0]' +print "(" +for pin in range (0,4): + print ' Pad[',\ + mm2mils100((pin-1.5) * PinSpacing), \ + mm2mils100(-(RowSpacing/2 + PinWidth/2)), \ + mm2mils100((pin-1.5) * PinSpacing), \ + mm2mils100(-(RowSpacing/2 + PinHeight - PinWidth/2)), \ + mm2mils100(PinWidth), \ + mm2mils100(PinSpacing - PinWidth), \ + mm2mils100(PinWidth)+600, \ + '"pin%i"' % (8 - pin), '"%i"' % (8 - pin), '0x0100]' + + print ' Pad[',\ + mm2mils100((pin-1.5) * PinSpacing), \ + mm2mils100(RowSpacing/2 + PinWidth/2), \ + mm2mils100((pin-1.5) * PinSpacing), \ + mm2mils100(RowSpacing/2 + PinHeight - PinWidth/2), \ + mm2mils100(PinWidth), \ + mm2mils100(PinSpacing - PinWidth), \ + mm2mils100(PinWidth)+600, \ + '"pin%i"' % (1 + pin), '"%i"' % (1 + pin), '0x0100]' + +print ' ElementLine[',\ + mm2mils100(-BodyHeight/2), \ + mm2mils100(-BodyWidth/2), \ + mm2mils100(-BodyHeight/2), \ + mm2mils100( BodyWidth/2), \ + '1000 ]' + +print ' ElementLine[',\ + mm2mils100(-BodyHeight/2), \ + mm2mils100( BodyWidth/2), \ + mm2mils100( BodyHeight/2), \ + mm2mils100( BodyWidth/2), \ + '1000 ]' + +print ' ElementLine[',\ + mm2mils100( BodyHeight/2), \ + mm2mils100( BodyWidth/2), \ + mm2mils100( BodyHeight/2), \ + mm2mils100(-BodyWidth/2), \ + '1000 ]' + +print ' ElementLine[',\ + mm2mils100( BodyHeight/2), \ + mm2mils100(-BodyWidth/2), \ + mm2mils100(-BodyHeight/2), \ + mm2mils100(-BodyWidth/2), \ + '1000 ]' + +print ' ElementArc[',\ + mm2mils100(-1.75 * PinSpacing), \ + mm2mils100(RowSpacing*1.75), \ + '500 500 0 360 1000 ]' + +print ")" diff --git a/packages/Makefile b/packages/Makefile new file mode 100644 index 0000000..81c1d06 --- /dev/null +++ b/packages/Makefile @@ -0,0 +1,13 @@ +.SUFFIXES: .5c .py .fp + +FOOTPRINTS= \ + MS5607.fp \ + uson-8.fp + +.5c.fp: + nickle $*.5c > $@ + +.py.fp: + python $*.py > $@ + +all: $(FOOTPRINTS) \ No newline at end of file diff --git a/packages/footprint.5c b/packages/footprint.5c new file mode 100644 index 0000000..885c21a --- /dev/null +++ b/packages/footprint.5c @@ -0,0 +1,235 @@ +/* + * Copyright © 2012 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +namespace Footprint { + + /* process clearance requirement */ + public real process_clearance = 0.6; + + public int mm2mils100(real mm) = floor (mm / 25.4 * 1000 * 100 + 0.5); + + public real mils1002mm(real mils100) = mils100 * 25.4 / 100 / 1000; + + public int line_thickness = 1000; + + public void element_start(string name) { + printf ("# author: Keith Packard\n"); + printf ("# email: keithp@keithp.com\n"); + printf ("# dist-license: GPL 2\n"); + printf ("# use-license: unlimited\n"); + printf ("Element [\"\" \"%s\" \"\" \"\" 0 0 0 0 0 100 \"\"]\n", + name); + printf ("(\n"); + + } + + public void element_end() { + printf (")\n"); + } + + public void pad_mm_clear_mask_options(real center_x, + real center_y, + real width, + real height, + real clearance, + real mask, + string name, + string num, + string options) + { + real x1 = 0; + real y1 = 0; + real x2 = 0; + real y2 = 0; + real thickness = 0; + + if (width > height) { + thickness = height; + y1 = center_y; + x1 = center_x - (width - height) / 2; + y2 = center_y; + x2 = center_x + (width - height) / 2; + } else { + thickness = width; + x1 = center_x; + y1 = center_y - (height - width) / 2; + x2 = center_x; + y2 = center_y + (height - width) / 2; + } + + + printf (" Pad["); + printf (" %6d %6d %6d %6d", + mm2mils100(x1), + mm2mils100(y1), + mm2mils100(x2), + mm2mils100(y2)); + printf (" %6d %6d %6d", + mm2mils100(thickness), + mm2mils100(clearance), + mm2mils100(mask)); + printf (" \"%s\" \"%s\" \"square%s%s\"]\n", + name, num, options == "" ? "" : ",", options); + } + + public void pad_mm_clear_options(real center_x, + real center_y, + real width, + real height, + real clearance, + string name, + string num, + string options) + { + real x1 = 0; + real y1 = 0; + real x2 = 0; + real y2 = 0; + real thickness = 0; + + if (width > height) { + thickness = height; + y1 = center_y; + x1 = center_x - (width - height) / 2; + y2 = center_y; + x2 = center_x + (width - height) / 2; + } else { + thickness = width; + x1 = center_x; + y1 = center_y - (height - width) / 2; + x2 = center_x; + y2 = center_y + (height - width) / 2; + } + + real mask = thickness + clearance / 2; + + printf (" Pad["); + printf (" %6d %6d %6d %6d", + mm2mils100(x1), + mm2mils100(y1), + mm2mils100(x2), + mm2mils100(y2)); + printf (" %6d %6d %6d", + mm2mils100(thickness), + mm2mils100(clearance), + mm2mils100(mask)); + printf (" \"%s\" \"%s\" \"square%s%s\"]\n", + name, num, options == "" ? "" : ",", options); + } + + public void pad_mm_clear(real center_x, + real center_y, + real width, + real height, + real clearance, + string name, + string num) + { + pad_mm_clear_options(center_x, + center_y, + width, + height, + clearance, + name, + num, + ""); + } + + public void pad_mm(real center_x, + real center_y, + real width, + real height, + string name, + string num) + { + pad_mm_clear(center_x, + center_y, + width, + height, + process_clearance, + name, + num); + } + + public void pin_mm_clear(real x, real y, real drill, real copper, real clearance, + string name, + string number) + { + real thickness = drill + copper * 2; + real mask = thickness + clearance / 2; + printf(" Pin["); + printf(" %6d %6d", + mm2mils100(x), + mm2mils100(y)); + printf(" %6d %6d %6d %6d", + mm2mils100(thickness), + mm2mils100(clearance), + mm2mils100(mask), + mm2mils100(drill)); + printf (" \"%s\" \"%s\"", + name, number); + printf (" \"\"]\n"); + + } + + public void pin_mm_clear_mask(real x, real y, + real drill, real copper, real clearance, real mask, + string name, string number) + { + real thickness = drill + copper * 2; + printf(" Pin["); + printf(" %6d %6d", + mm2mils100(x), + mm2mils100(y)); + printf(" %6d %6d %6d %6d", + mm2mils100(thickness), + mm2mils100(clearance), + mm2mils100(mask), + mm2mils100(drill)); + printf (" \"%s\" \"%s\"", + name, number); + printf (" \"\"]\n"); + + } + + public void pin_mm(real x, real y, real drill, real copper, + string name, + string number) + { + pin_mm_clear(x, y, drill, copper, process_clearance, + name, number); + } + + public void line (real x1, real y1, real x2, real y2) + { + printf (" ElementLine["); + printf (" %6d %6d %6d %6d", + mm2mils100(x1), + mm2mils100(y1), + mm2mils100(x2), + mm2mils100(y2)); + printf (" %d]\n", line_thickness); + } + + public void rect (real x, real y, real w, real h) + { + line(x,y,x+w,y); + line(x+w,y,x+w,y+h); + line(x+w,y+h,x,y+h); + line(x,y+h,x,y); + } +} diff --git a/packages/uson-8.5c b/packages/uson-8.5c new file mode 100644 index 0000000..ddd163e --- /dev/null +++ b/packages/uson-8.5c @@ -0,0 +1,79 @@ +/* + * Copyright © 2012 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +load "footprint.5c" +import Footprint; + +real pad_expose = 0.1; +real pad_width = 0.50 + pad_expose; +real pad_height = 0.30; +real pad_spacing = 0.50; + +real package_width = 3; +real package_height = 2; + +real pad_x_off = package_width / 2 - (pad_width - pad_expose) / 2 + pad_expose; + +real num_pad = 4; /* per side */ + +element_start("uson-8"); + +real pad_off(int n) { + return pad_spacing * (n - (num_pad - 1) / 2); +} + +real corner(int dx, int dy) { + real x = dx * package_width / 2; + real y = dy * package_height / 2; + real len = 0.4; + + line(x, y, x - dx * len, y); + line(x, y, x, y - dy * len); +} + +corner(-1, -1); +corner(1, -1); +corner(-1, 1); +corner(1, 1); + +real dot_off = -.3; + +line(-package_width/2 + dot_off, -package_height/2 + dot_off, + -package_width/2 + dot_off, -package_height/2 + dot_off); + +for (pad = 0; pad < num_pad; pad++) { + /* left side (1-4) */ + + pad_mm(-pad_x_off, + pad_off(pad), + pad_width, + pad_height, + sprintf("%d", pad + 1), + sprintf("%d", pad + 1)); + + /* right side (5-8) */ + + pad_mm(pad_x_off, + -pad_off(pad), + pad_width, + pad_height, + sprintf("%d", pad + 5), + sprintf("%d", pad + 5)); + +} + +element_end(); diff --git a/packages/wson6x5.5c b/packages/wson6x5.5c new file mode 100644 index 0000000..2667469 --- /dev/null +++ b/packages/wson6x5.5c @@ -0,0 +1,83 @@ +/* + * Copyright © 2012 Keith Packard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +load "footprint.5c" +import Footprint; + +real pad_width = 0.80; +real pad_height = 0.50; +real pad_spacing = 1.27; + +real pad_x_off = 6.00 / 2 - 1; + +real center_width = 3.4; +real center_height = 4.; + +real package_width = 6; +real package_height = 5; + +real num_pad = 4; /* per side */ + +element_start("wson-6x5"); + +real pad_off(int n) { + return pad_spacing * (n - (num_pad - 1) / 2); +} + +real corner(int dx, int dy) { + real x = dx * package_width / 2; + real y = dy * package_height / 2; + real len = 0.4; + + line(x, y, x - dx * len, y); + line(x, y, x, y - dy * len); +} + +corner(-1, -1); +corner(1, -1); +corner(-1, 1); +corner(1, 1); + +real dot_off = .3; + +line(-package_width/2 + dot_off, -package_height/2 + dot_off, + -package_width/2 + dot_off, -package_height/2 + dot_off); + +for (pad = 0; pad < num_pad; pad++) { + /* left side (1-4) */ + + pad_mm(-pad_x_off - pad_width, + pad_off(pad), + pad_width, + pad_height, + sprintf("%d", pad + 1), + sprintf("%d", pad + 1)); + + /* right side (5-8) */ + + pad_mm(pad_x_off + pad_width, + -pad_off(pad), + pad_width, + pad_height, + sprintf("%d", pad + 5), + sprintf("%d", pad + 5)); + +} + +pad_mm(0, 0, center_width, center_height, "GND", "GND"); + +element_end(); -- 2.30.2