add footprint generators for samtec stacking connector series, not qa'ed yet
[hw/bdale] / pkg / newlib / samtec / BTE.py
1 #!/usr/bin/python
2 # Copyright 2007 by Bdale Garbee <bdale@gag.com>.  GPLv2
3 #
4 # Program to emit PCB footprint for Samtec BTE connectors
5
6 import sys
7
8 # dimensions in mm from BTE-XXX-XX-X-D-XX-FOOTPRINT.pdf and BSE.pdf
9
10 PinWidth = 0.457
11 PinHeight = 1.448
12 PinSpacing = 0.8
13 RowSpacing = 6.172 - PinHeight
14 HoleDiam = 1.016
15 HoleOffset= 2.032
16
17 # Needs pin count per row on command line, 20/40/60/80/100/120 are valid
18 positions = int(sys.argv[1])
19 ordinal = positions / 20.0
20 if (ordinal < 1) or (ordinal > 6) or (positions%20 != 0):
21         sys.stderr.write('Invalid number of positions, must be 20|40|60|80|100|120.\n')
22         sys.exit(1)
23
24 BodyWidth = (positions * PinSpacing) + 4.00
25 BodyHeight = 5.97
26 HoleSpacing = (positions * PinSpacing) + 2.477
27
28 # we're going to use the 1/100 of a mil fundamental unit form
29 def mm2mils100( mm ):
30         return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
31
32 print '# author: Bdale Garbee'
33 print '# email: bdale@gag.com'
34 print '# dist-license: GPL 2'
35 print '# use-license: unlimited'
36
37 print 'Element[0x0 "BSE" "" "" 0 0 -10161 -12011 0 100 0x0]'
38 print "("
39 for pin in range (0,positions):
40     print '   Pad[',\
41         mm2mils100((pin-(positions/2 - 0.5)) * PinSpacing), \
42         mm2mils100(-(RowSpacing/2 + PinWidth/2)), \
43         mm2mils100((pin-(positions/2 - 0.5)) * PinSpacing), \
44         mm2mils100(-(RowSpacing/2 + PinHeight - PinWidth/2)), \
45         mm2mils100(PinWidth), \
46         mm2mils100(PinSpacing - PinWidth), \
47         mm2mils100(PinWidth)+600, \
48         '"pin%i"' % (1 + pin*2), '"%i"' % (1 + pin*2), '0x0100]'
49
50     print '   Pad[',\
51         mm2mils100((pin-(positions/2 - 0.5)) * PinSpacing), \
52         mm2mils100(RowSpacing/2 + PinWidth/2), \
53         mm2mils100((pin-(positions/2 - 0.5)) * PinSpacing), \
54         mm2mils100(RowSpacing/2 + PinHeight - PinWidth/2), \
55         mm2mils100(PinWidth), \
56         mm2mils100(PinSpacing - PinWidth), \
57         mm2mils100(PinWidth)+600, \
58         '"pin%i"' % (2 + pin*2), '"%i"' % (2 + pin*2), '0x0100]'
59
60 print '   Pin[', \
61     mm2mils100(HoleSpacing/2), \
62     mm2mils100(-HoleOffset), \
63     mm2mils100(HoleDiam), \
64     0, \
65     mm2mils100(HoleDiam), \
66     mm2mils100(HoleDiam), \
67     '"mnt" "0"', '0x0008', ']'
68
69 print '   Pin[', \
70     mm2mils100(-HoleSpacing/2), \
71     mm2mils100(-HoleOffset), \
72     mm2mils100(HoleDiam), \
73     0, \
74     mm2mils100(HoleDiam), \
75     mm2mils100(HoleDiam), \
76     '"mnt" "0"', '0x0008', ']'
77
78 print '   ElementLine[',\
79         mm2mils100(-BodyWidth/2), \
80         mm2mils100(-BodyHeight/2), \
81         mm2mils100(-BodyWidth/2), \
82         mm2mils100( BodyHeight/2), \
83         '1000 ]'
84
85 print '   ElementLine[',\
86         mm2mils100(-BodyWidth/2), \
87         mm2mils100( BodyHeight/2), \
88         mm2mils100( BodyWidth/2), \
89         mm2mils100( BodyHeight/2), \
90         '1000 ]'
91
92 print '   ElementLine[',\
93         mm2mils100( BodyWidth/2), \
94         mm2mils100( BodyHeight/2), \
95         mm2mils100( BodyWidth/2), \
96         mm2mils100(-BodyHeight/2), \
97         '1000 ]'
98
99 print '   ElementLine[',\
100         mm2mils100( BodyWidth/2), \
101         mm2mils100(-BodyHeight/2), \
102         mm2mils100(-BodyWidth/2), \
103         mm2mils100(-BodyHeight/2), \
104         '1000 ]'
105
106 print '   ElementArc[',\
107         mm2mils100(-(positions/2 + 0.5) * PinSpacing), \
108         mm2mils100(-(RowSpacing/2+PinHeight*5/4)), \
109         '500 500 0 360 1000 ]'
110
111 print ")"