--- /dev/null
+#!/usr/bin/python
+# Copyright 2011 by Bdale Garbee <bdale@gag.com>. GPLv2
+#
+# Program to emit PCB footprint for MO-220 package used by the ATTiny85
+#
+
+# dimensions in mm from the ATTiny datasheed
+
+PinWidth = 0.23 # b
+PinHeight = 0.55 # L
+PinSpacing = 0.50 # e
+Overall = 4.25 # E
+GndSquare = 2.60 # D2 & E2
+CoreSquare = 2.60
+PinClearance = 2 * (PinSpacing - PinWidth)
+
+# ATMEL specifies 120-150 microns between pad and solder mask
+# AT88RF1354 Appplication note
+#
+PinResist = PinWidth + (2 * 0.07)
+
+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: Keith Packard'
+print '# email: keithp@keithp.com'
+print '# dist-license: GPL 2'
+print '# use-license: unlimited'
+
+print 'Element[0x0 "MO-220" "" "" 0 0 0 0 0 100 0x0]'
+print "("
+
+# pad under the chip, must be grounded
+print ' Pad[',\
+ mm2mils100(0), \
+ mm2mils100(0), \
+ mm2mils100(0), \
+ mm2mils100(0), \
+ mm2mils100(GndSquare), \
+ mm2mils100(PinClearance), \
+ mm2mils100(PinResist), \
+ '"pin21" "21" "square,nopaste"]'
+
+# vias in the ground pad under the chip
+#for viarow in range (-1,2):
+# for viacol in range (-1,2):
+# print ' Pin[',\
+# mm2mils100(2 * viacol * CoreSquare / 5), \
+# mm2mils100(2 * viarow * CoreSquare / 5), \
+# 2900, \
+# 2500, \
+# 0, \
+# 1500, \
+# '"pin21" "21" 0x0002]'
+
+# break pad under chip into a grid to control the resist and paste masks
+
+blocks=3;
+
+for viarow in range (-1, 2):
+ for viacol in range (-1, 2):
+ if (viarow in (-1, 1)) and (viacol in (-1, 1)):
+ # copper sub-square with resist over vias
+ print ' Pad[',\
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ mm2mils100((CoreSquare)/blocks), \
+ 0, \
+ 0, \
+ '"pin21" "21" "square,nopaste"]'
+ else:
+ # copper sub-square without resist
+ print ' Pad[',\
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ mm2mils100((CoreSquare)/blocks), \
+ 0, \
+ mm2mils100((CoreSquare)/blocks), \
+ '"pin21" "21" "square,nopaste"]'
+ # copper spot to control paste mask generation
+ print ' Pad[',\
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ mm2mils100(viacol * CoreSquare / blocks), \
+ mm2mils100(viarow * CoreSquare / blocks), \
+ 1500, \
+ 0, \
+ mm2mils100((CoreSquare)/blocks), \
+ '"pin21" "21" "square"]'
+
+# pins
+for pin in range (1,6):
+ print ' Pad[',\
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(-Overall/2 + PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(-Overall/2 + PinHeight - PinWidth/2), \
+ mm2mils100(PinWidth), \
+ mm2mils100(PinClearance), \
+ mm2mils100(PinResist), \
+ '"pin%i"' % (16-pin), '"%i"' % (16-pin), '0x0000]'
+
+ print ' Pad[',\
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(+Overall/2 - PinHeight + PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(+Overall/2 - PinWidth/2), \
+ mm2mils100(PinWidth), \
+ mm2mils100(PinClearance), \
+ mm2mils100(PinResist), \
+ '"pin%i"' % pin, '"%i"' % pin, '0x0000]'
+
+ print ' Pad[',\
+ mm2mils100(Overall/2 - PinHeight + PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(Overall/2 - PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(PinWidth), \
+ mm2mils100(PinClearance), \
+ mm2mils100(PinResist), \
+ '"pin%i"' % (11-pin), '"%i"' % (11-pin), '0x0000]'
+
+ print ' Pad[',\
+ mm2mils100(-Overall/2 + PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(-Overall/2 + PinHeight - PinWidth/2), \
+ mm2mils100((-3 + pin) * PinSpacing), \
+ mm2mils100(PinWidth), \
+ mm2mils100(PinClearance), \
+ mm2mils100(PinResist), \
+ '"pin%i"' % (15+pin), '"%i"' % (15+pin), '0x0000]'
+
+print ' ElementArc[',\
+ mm2mils100(-2.0), \
+ mm2mils100(2.0), \
+ '500 500 0 360 1000 ]'
+print ")"
--- /dev/null
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * 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 hole_spacing = 3;
+real hole_diameter = 0.9;
+real hole_x = hole_spacing / 2;
+real hole_y = 0;
+real pad_height = 1.5;
+real pad_width = 0.7;
+real hold_width = 1;
+real hold_height = 0.8;
+real hold_y = -1;
+real hold_x = 6.3 / 2 + 1/2;
+real package_width = 6.7;
+real package_height = 2.6;
+real outline_x = package_width / 2;
+real outline_y = package_height / 2;
+
+real switch_travel = 1.5;
+real switch_width = 1.3;
+real switch_height = 1.5;
+real switch_x = switch_travel / 2 - switch_width / 2;
+real switch_y = package_height / 2;
+
+/* to center */
+real pad_1_x = -2.25;
+real pad_2_x = 0.75;
+real pad_3_x = 2.25;
+
+/* to top */
+real pad_y = 2.5;
+
+element_start("cus-12");
+
+/* pad 1 */
+pad_mm (pad_1_x, -(pad_y - pad_height / 2),
+ pad_width, pad_height,
+ "1", "1");
+
+/* pad 2 */
+pad_mm (pad_2_x, -(pad_y - pad_height / 2),
+ pad_width, pad_height,
+ "2", "2");
+
+pad_mm (pad_3_x, -(pad_y - pad_height / 2),
+ pad_width, pad_height,
+ "3", "3");
+
+pad_mm (-hold_x, -hold_y,
+ hold_width, hold_height,
+ "GND", "GND");
+
+pad_mm (hold_x, -hold_y,
+ hold_width, hold_height,
+ "GND", "GND");
+
+pad_mm (-hold_x, hold_y,
+ hold_width, hold_height,
+ "GND", "GND");
+
+pad_mm (hold_x, hold_y,
+ hold_width, hold_height,
+ "GND", "GND");
+
+pin_mm (-hole_x, hole_y, hole_diameter,
+ 0.17, "GND", "GND");
+
+pin_mm (hole_x, hole_y, hole_diameter,
+ 0.17, "GND", "GND");
+
+rect (-outline_x, -outline_y, outline_x * 2, outline_y * 2);
+rect (switch_x, switch_y, switch_width, switch_height);
+element_end();
+