86da5f6b53f3aabf7d7d8e151908a4a1b60ab9e1
[hw/altusmetrum] / packages / UBLOX-ZOE.py
1 #!/usr/bin/python2
2 # Copyright 2020 by Bdale Garbee <bdale@gag.com>.  GPLv3
3 #
4 # Program to emit PCB footprint for U-Blox ZOE-8 GPS receiver
5 #
6
7 # dimensions in mm from:
8 #       ZOE-M8_HIM_(UBX-16030136).pdf
9
10 BodySize = 4.5
11 PadSpacing = 0.5
12 PadDiam = 0.27
13
14 Clearance = 0.254 
15 Mask = (2* 0.05) + PadDiam
16
17 ValidPin = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'B1', 'B9', 
18             'C1', 'C3', 'C4', 'C5', 'C6', 'C7', 'C9', 'D1', 'D3', 'D4', 'D6',
19             'D9', 'E1', 'E3', 'E7', 'E9', 'F1', 'F3', 'F4', 'F6', 'F7', 'F9',
20             'G1', 'G3', 'G4', 'G5', 'G6', 'G7', 'G9', 'H1', 'H9', 'J1', 'J2',
21             'J3', 'J4', 'J5', 'J6', 'J7', 'J8', 'J9']
22
23 import sys
24
25 # we're going to use the 1/100 of a mil fundamental unit form
26 def mm2mils100( mm ):
27         return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
28
29 print '# author: Bdale Garbee'
30 print '# email: bdale@gag.com'
31 print '# dist-license: GPL 3'
32 print '# use-license: unlimited'
33
34 print 'Element[0x0 "UBLOX-ZOE" "" "" 0 0 11000 0 0 100 0x0]'
35 print "("
36
37 rows = ['A','B','C','D','E','F','G','H','J']
38 for row in rows:
39   rownum = rows.index(row)      # rownum will run 0..8
40   for col in range (1,10):      # col wil run 1..9
41     ThisPin = row+str(col)
42     if ThisPin in ValidPin:
43       print '   Pad[',\
44         mm2mils100((col-5) * PadSpacing), \
45         mm2mils100((rownum-4) * PadSpacing), \
46         mm2mils100((col-5) * PadSpacing), \
47         mm2mils100((rownum-4) * PadSpacing), \
48         mm2mils100(PadDiam), \
49         mm2mils100(Clearance), \
50         mm2mils100(Mask), \
51         '"%s"' % ThisPin, '"%s"' % ThisPin, '""]'
52
53 print '   ElementLine[',\
54         mm2mils100(-BodySize/2), \
55         mm2mils100(-BodySize/2), \
56         mm2mils100(-BodySize/2), \
57         mm2mils100( BodySize/2), \
58         '1000 ]'
59
60 print '   ElementLine[',\
61         mm2mils100(-BodySize/2), \
62         mm2mils100( BodySize/2), \
63         mm2mils100( BodySize/2), \
64         mm2mils100( BodySize/2), \
65         '1000 ]'
66
67 print '   ElementLine[',\
68         mm2mils100( BodySize/2), \
69         mm2mils100( BodySize/2), \
70         mm2mils100( BodySize/2), \
71         mm2mils100(-BodySize/2), \
72         '1000 ]'
73
74 print '   ElementLine[',\
75         mm2mils100( BodySize/2), \
76         mm2mils100(-BodySize/2), \
77         mm2mils100(-BodySize/2), \
78         mm2mils100(-BodySize/2), \
79         '1000 ]'
80
81 print '   ElementArc[',\
82         mm2mils100(-5 * PadSpacing), \
83         mm2mils100(-5 * PadSpacing), \
84         '500 500 0 360 1000 ]'
85
86 print ")"