2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
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.
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.
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.
21 real pad_width = 0.55;
22 real pad_height = 0.30;
23 real pad_spacing = 0.50;
24 real pad_clearance = 12 / 1000 * 25.4;
26 real pad_x_off = 6.20 / 2;
27 real pad_y_off = 6.20 / 2;
29 real center_width = 5.6;
30 real center_height = 5.6;
32 real package_width = 7;
33 real package_height = 7;
35 real num_pad = 12; /* per side */
37 element_start("ufqfpn-48");
40 return pad_spacing * (n - (num_pad - 1) / 2);
43 real corner(int dx, int dy) {
44 real x = dx * package_width / 2;
45 real y = dy * package_height / 2;
48 line(x, y, x - dx * len, y);
49 line(x, y, x, y - dy * len);
59 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
60 -package_width/2 + dot_off, -package_height/2 + dot_off);
62 for (pad = 0; pad < num_pad; pad++) {
63 /* left side (1-12) */
65 pad_mm_clear(-pad_x_off - pad_width / 2,
70 sprintf("%d", pad + 1),
71 sprintf("%d", pad + 1));
75 pad_mm_clear(pad_off(pad),
76 pad_y_off + pad_width / 2,
80 sprintf("%d", pad + 13),
81 sprintf("%d", pad + 13));
83 /* right side (25-36) */
85 pad_mm_clear(pad_x_off + pad_width / 2,
90 sprintf("%d", pad + 25),
91 sprintf("%d", pad + 25));
95 pad_mm_clear(-pad_off(pad),
96 -pad_y_off - pad_width / 2,
100 sprintf("%d", pad + 37),
101 sprintf("%d", pad + 37));
107 real block_width = center_width / pad_blocks;
108 real block_height = center_height / pad_blocks;
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;
113 bool via_block(int x, int y) {
114 return (x & 1) == 0 && (y & 1) == 0;
117 real via_hole = 15/1000 * 25.4; /* 15 mil drill */
118 real via_copper = 7/1000 * 25.4; /* 7 mil anulus */
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_hole + 2 * via_copper, pad_clearance, 0,
126 pad_mm_clear_mask_options(block_x(pad_x), block_y(pad_y),
127 block_width, block_height,
129 "GND", "GND","square,nopaste");
131 /* full square of metal */
132 pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
133 block_width, block_height,
135 "GND", "GND","square,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,
140 "GND", "GND","square");