Switch to altusmetrum component directory
[hw/telegps] / packages / ufqfpn48.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 pad_height = 0.30;
23 real pad_spacing = 0.50;
24 real pad_clearance = 10 / 1000 * 25.4;  
25
26 real pad_x_off = 6.20 / 2;
27 real pad_y_off = 6.20 / 2;
28
29 real center_width = 5.6;
30 real center_height = 5.6;
31
32 real package_width = 7;
33 real package_height = 7;
34
35 real num_pad = 12;      /* per side */
36
37 element_start("ufqfpn-48");
38
39 real pad_off(int n) {
40         return pad_spacing * (n - (num_pad - 1) / 2);
41 }
42
43 real corner(int dx, int dy) {
44         real    x = dx * package_width / 2;
45         real    y = dy * package_height / 2;
46         real    len = 0.4;
47
48         line(x, y, x - dx * len, y);
49         line(x, y, x, y - dy * len);
50 }
51
52 corner(-1, -1);
53 corner(1, -1);
54 corner(-1, 1);
55 corner(1, 1);
56
57 real dot_off = .3;
58
59 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
60      -package_width/2 + dot_off, -package_height/2 + dot_off);
61
62 for (pad = 0; pad < num_pad; pad++) {
63         /* left side (1-12) */
64
65         pad_mm_clear(-pad_x_off - pad_width / 2,
66                      pad_off(pad),
67                      pad_width,
68                      pad_height,
69                      pad_clearance,
70                      sprintf("%d", pad + 1),
71                      sprintf("%d", pad + 1));
72         
73         /* bottom (13-24) */
74
75         pad_mm_clear(pad_off(pad),
76                      pad_y_off + pad_width / 2,
77                      pad_height,
78                      pad_width,
79                      pad_clearance,
80                      sprintf("%d", pad + 13),
81                      sprintf("%d", pad + 13));
82         
83         /* right side (25-36) */
84
85         pad_mm_clear(pad_x_off + pad_width / 2,
86                      -pad_off(pad),
87                      pad_width,
88                      pad_height,
89                      pad_clearance,
90                      sprintf("%d", pad + 25),
91                      sprintf("%d", pad + 25));
92         
93         /* top (37-48) */
94
95         pad_mm_clear(-pad_off(pad),
96                      -pad_y_off - pad_width / 2,
97                      pad_height,
98                      pad_width,
99                      pad_clearance,
100                      sprintf("%d", pad + 37),
101                      sprintf("%d", pad + 37));
102         
103 }
104
105 int pad_blocks = 3;
106
107 real block_width = center_width / pad_blocks;
108 real block_height = center_height / pad_blocks;
109
110 real block_x(int x) = (x - (pad_blocks - 1)/2) * block_width;
111 real block_y(int y) = (y - (pad_blocks - 1)/2) * block_height;
112
113 bool via_block(int x, int y) {
114         return (x & 1) == 0 && (y & 1) == 0;
115 }
116
117 real via_hole = 15/1000 * 25.4;         /* 15 mil drill */
118 real via_copper = 3.5/1000 * 25.4;      /* 7 mil anulus */
119
120 for (int pad_y = 0; pad_y < pad_blocks; pad_y++) {
121         for (int pad_x = 0; pad_x < pad_blocks; pad_x++)
122                 if (via_block(pad_x, pad_y)) {
123                         pin_mm_clear_mask(block_x(pad_x), block_y(pad_y),
124                                           via_hole, via_copper * 2, pad_clearance, 0,
125                                           "GND", "GND");
126                         pad_mm_clear_mask_options(block_x(pad_x), block_y(pad_y),
127                                                   block_width, block_height,
128                                                   pad_clearance, 0,
129                                                   "GND", "GND","nopaste");
130                 } else {
131                         /* full square of metal */
132                         pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
133                                              block_width, block_height,
134                                              0,
135                                              "GND", "GND","nopaste");
136                         /* 1/4 full of solder paste */
137                         pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
138                                              block_width/2, block_height/2,
139                                              0,
140                                              "GND", "GND","");
141                 }
142 }
143
144 element_end();