create a "hybrid" footprint that can handle either a 10 position screw strip
[hw/bdale] / pkg / newlib / tyco / tphybrid.py
1 #!/usr/bin/python
2 # Copyright 2011 by Bdale Garbee <bdale@gag.com>.  GPLv2
3 #
4 # Program to emit PCB footprint for a 16 pin
5 #   Tyco/AMP Micro-MaTch vertical through-hole female connectors
6 # overlaid with a 10-pin 
7 #   Tyco Electronics Buchanan 2.54mm pitch terminal blocks
8 #
9
10 # dimensions in mm from C_215079_v.pdf datasheet
11 #PinDiam = 1.15         # screw terminals
12 PinDiam = 0.8           # micromatch
13 PinSpacing = 1.27
14 RowSpacing = 2.54
15
16 MntX = 1.4
17 MntY = 1.8
18 MntDiam = 1.5
19
20 BoxY = 5.1
21
22 LineWidth = 600
23
24 import sys
25
26 # we're going to use the 1/100 of a mil fundamental unit form
27 def mm2mils100( mm ):
28         return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
29
30 pins = 17
31
32 BoxXbase = 5.89
33 BoxEnd = 1.5
34
35 print '# author: Bdale Garbee'
36 print '# email: bdale@gag.com'
37 print '# dist-license: GPL 2'
38 print '# use-license: unlimited'
39
40 print 'Element[0x0 "tphybrid" "" "" 0 0 0 0 0 100 0x0]'
41 print "("
42 for col in range ((pins+1)/2):
43     for row in range (2):
44         if row == 1:
45             spacing=0
46         else:
47             spacing=RowSpacing
48         pinnum = (col * 2) + row + 1
49         if pinnum != 18:
50             if pinnum == 1:
51                 Flags = '0x0101'
52             else:
53                 Flags = '0x0001'
54             print '   Pin[', \
55                 mm2mils100((pinnum-1)*PinSpacing), \
56                 mm2mils100(spacing), \
57                 mm2mils100(PinDiam*2), \
58                 1200, \
59                 mm2mils100(PinDiam*2)+1000, \
60                 mm2mils100(PinDiam), \
61                 '"pin%i"' % pinnum, '"%i"' % pinnum, Flags, ']'
62
63 print '   Pin[', \
64     mm2mils100((-2)*PinSpacing), \
65     mm2mils100(RowSpacing), \
66     mm2mils100(PinDiam*2), \
67     1200, \
68     mm2mils100(PinDiam*2)+1000, \
69     mm2mils100(PinDiam), \
70     '"pin18"' , '"18"', Flags, ']'
71
72 # add a hole for the index pin.  plated to save non-plated-hole extra fab cost.
73 print '   Pin[', \
74     mm2mils100(-MntX), \
75     mm2mils100(RowSpacing-MntY), \
76     mm2mils100(MntDiam)+1400, \
77     1400, \
78     mm2mils100(MntDiam)+1400+600, \
79     mm2mils100(MntDiam), \
80     '"mnt" "0"', '0x0001', ']'
81
82 # pins-2 accounts for the extra pin used by screw terminal overlay
83 BoxX = (pins - 2) * PinSpacing + BoxXbase
84 BoxX1 = -(BoxXbase/2)
85 BoxX2 = BoxX1 + BoxX
86 # re-compute X1 after computing X2 to account for screw terminal overlay
87 BoxX1 = -2*PinSpacing - BoxEnd
88 BoxY1 = -(BoxY - RowSpacing)/2
89 BoxY2 = BoxY1 + BoxY
90
91 print '   ElementLine[', \
92         mm2mils100(BoxX1), \
93         mm2mils100(BoxY1), \
94         mm2mils100(BoxX1), \
95         mm2mils100(BoxY2), \
96         LineWidth, ']'
97
98 print '   ElementLine[', \
99         mm2mils100(BoxX1), \
100         mm2mils100(BoxY2), \
101         mm2mils100(BoxX2), \
102         mm2mils100(BoxY2), \
103         LineWidth, ']'
104
105 print '   ElementLine[', \
106         mm2mils100(BoxX2), \
107         mm2mils100(BoxY2), \
108         mm2mils100(BoxX2), \
109         mm2mils100(BoxY1), \
110         LineWidth, ']'
111
112 print '   ElementLine[', \
113         mm2mils100(BoxX2), \
114         mm2mils100(BoxY1), \
115         mm2mils100(BoxX1), \
116         mm2mils100(BoxY1), \
117         LineWidth, ']'
118   
119 print ")"