SMA connectors cheaper at DK now
[hw/altusmetrum] / packages / ufqfpn28.5c
1 /*
2  * Copyright © 2012 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 load "footprint.5c"
19 import Footprint;
20
21 real pad_width = 0.55;
22 real corner_pad_width = 0.50;
23 real pad_height = 0.30;
24
25 /* Required clearance between corner pads on the diagonal */
26 real corner_diag_clearance = 0.21;
27
28 /* horizontal/vertical size of corner cut out */
29 #real corner_pad_notch = corner_diag_clearance / sqrt(2);
30 real corner_pad_notch = 0.15;
31
32 real corner_pad_minimum_height = pad_height - corner_pad_notch;
33 real corner_pad_minimum_width = corner_pad_width - corner_pad_notch;
34
35 real pad_spacing = 0.50;
36
37 /* outer location of pad */
38
39 real pad_x_off = (3.30 + 2 * 0.5) / 2;
40 real pad_y_off = (3.30 + 2 * 0.5) / 2;
41
42 real package_width = 4;
43 real package_height = 4;
44
45 real num_pad = 7;       /* per side */
46
47 element_start("ufqfpn-28");
48
49 real pad_off(int n) {
50         return pad_spacing * (n - (num_pad - 1) / 2);
51 }
52
53 real corner(int dx, int dy) {
54         real    x = dx * package_width / 2;
55         real    y = dy * package_height / 2;
56         real    len = 0.4;
57
58         line(x, y, x - dx * len, y);
59         line(x, y, x, y - dy * len);
60 }
61
62 /*
63 corner(-1, -1);
64 corner(1, -1);
65 corner(-1, 1);
66 corner(1, 1);
67 */
68
69 real dot_off = .3;
70
71 line(-package_width/2 - dot_off, -package_height/2 - dot_off,
72      -package_width/2 - dot_off, -package_height/2 - dot_off);
73
74 for (int pad = 0; pad < num_pad; pad++) {
75         real pw = pad_width;
76         real ph = pad_height;
77         real pwa = 0;
78         real pha = 0;
79
80         int     nstep = 0;
81
82         if (pad == 0 || pad == num_pad-1)
83                 nstep = 3;
84
85         for (int s = 0; s <= nstep; s++) {
86
87                 real    pad_x, pad_y, pad_w, pad_h;
88
89                 if (nstep != 0) {
90                         real    ratio = s / nstep;
91
92                         pad_x = 0;
93                         if (pad == 0) {
94                                 pad_y = -pad_height / 2 * (1-ratio) + ((-pad_height / 2) + corner_pad_notch) * ratio;
95                         } else {
96                                 pad_y = -pad_height / 2;
97                         }
98                         pad_w = corner_pad_minimum_width * (1-ratio) + corner_pad_width * ratio;
99
100                         pad_h = pad_height * (1 - ratio) + corner_pad_minimum_height * ratio;
101
102                         /* Make sure we don't violate the process minimums */
103                         if (pad_h < process_trace)
104                                 pad_h = process_trace;
105
106                 } else {
107                         pad_x = 0;
108                         pad_y = -pad_height / 2;
109                         pad_w = pad_width;
110                         pad_h = pad_height;
111                 }
112
113                 /* left (1-7) */
114                 pad_mm(-pad_x_off + pad_x + pad_w / 2,
115                        pad_off(pad) + pad_y + pad_h / 2,
116                        pad_w,
117                        pad_h,
118                        sprintf("%d", pad + 1),
119                        sprintf("%d", pad + 1));
120
121                 /* bottom (8-14) */
122
123                 pad_mm(pad_off(pad) + pad_y + pad_h / 2,
124                        pad_y_off + pad_x - pad_w / 2,
125                        pad_h,
126                        pad_w,
127                        sprintf("%d", pad + 8),
128                        sprintf("%d", pad + 8));
129
130                 /* right side (15-21) */
131
132                 pad_mm(pad_x_off - pad_x - pad_w / 2,
133                        -pad_off(pad) - pad_y - pad_h / 2,
134                        pad_w,
135                        pad_h,
136                        sprintf("%d", pad + 15),
137                        sprintf("%d", pad + 15));
138
139                 /* top (22-28) */
140
141                 pad_mm(-pad_off(pad) - pad_y - pad_h / 2,
142                        -pad_y_off - pad_x + pad_w / 2,
143                        pad_h,
144                        pad_w,
145                        sprintf("%d", pad + 22),
146                        sprintf("%d", pad + 22));
147         }
148
149 }
150
151 element_end();