bcdf62eec96e87c5f93840bd2b0fb63ea9ed5b0c
[hw/altusmetrum] / packages / hvqfn33.5c
1 /*
2  * Copyright © 2013 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 process_clearance = 0.26;
22
23 real package_width = 5;
24 real package_height = 5;
25 real pad_spacing = 0.5;         /* P */
26 real pad_height = 0.85;         /* C */
27 real pad_width = 0.27;          /* D */
28 real pad_center_x = 5.25 / 2;   /* Gx/2 */
29 real pad_center_y = 5.25 / 2;   /* Gy/2 */
30
31 real center_width = 3.75;       /* SLx */
32 real center_height = 3.75;      /* SLy */
33
34 real center_drill = 0.015 * 25.4;
35 real center_mask = 0.60 / 2;
36
37 real center_space = 1.1;
38
39 int num_pad = 8;        /* per side */
40
41 real pad_off(int n) {
42         return pad_spacing * (n - (num_pad - 1) / 2);
43 }
44
45 element_start("hvqfn33");
46
47 for (pad = 0; pad < num_pad; pad++) {
48         /* left side (1-8) */
49
50         pad_mm(-pad_center_x,
51                pad_off(pad),
52                pad_height,
53                pad_width,
54                sprintf("%d", pad + 1),
55                sprintf("%d", pad + 1));
56
57         /* bottom (9-16) */
58
59         pad_mm(pad_off(pad),
60                pad_center_y,
61                pad_width,
62                pad_height,
63                sprintf("%d", pad + 9),
64                sprintf("%d", pad + 9));
65
66         /* right (17-24) */
67
68         pad_mm(pad_center_x,
69                -pad_off(pad),
70                pad_height,
71                pad_width,
72                sprintf("%d", pad + 17),
73                sprintf("%d", pad + 17));
74
75         /* top (25-32) */
76
77         pad_mm(-pad_off(pad),
78                -pad_center_y,
79                pad_width,
80                pad_height,
81                sprintf("%d", pad + 25),
82                sprintf("%d", pad + 25));
83 }
84
85 /* center */
86
87 pad_mm_clear_mask_options(0, 0, center_width, center_height, process_clearance, 0,
88                           "33", "33", "square,nopaste");
89
90
91 real clear_top = center_space * 0.5 + center_mask;
92 real clear_bottom = center_height / 2;
93 real clear_height = clear_bottom - clear_top;
94 real clear_y = (clear_top + clear_bottom) / 2;
95
96 for (y = -1; y <= 1; y+= 2) {
97         pad_mm_clear_mask_options(0, y * clear_y, center_width, clear_height,
98                                   0, clear_height, "33", "33", "square,nopaste");
99
100         pad_mm_clear_mask_options(y * clear_y, 0, clear_height, center_height,
101                                   0, clear_height, "33", "33", "square,nopaste");
102 }
103
104 real hole_pos = 0.5 * center_space;
105 real strip_top = -hole_pos + center_mask;
106 real strip_bot = hole_pos - center_mask;
107 real strip_size = strip_bot - strip_top;
108
109 pad_mm_clear_mask_options(0, 0, center_width, strip_size,
110                           0, strip_size, "33", "33", "square,nopaste");
111
112 pad_mm_clear_mask_options(0, 0, strip_size, center_height,
113                           0, strip_size, "33", "33", "square,nopaste");
114
115 /* center solder spots */
116
117 for (y = -1; y <= 1; y += 1) {
118         for (x = -1; x <= 1; x += 1) {
119                 pad_mm_clear_mask_options(x * center_space, y * center_space,
120                                           center_mask*2, center_mask*2, 0, center_mask * 2, "33", "33", "");
121         }
122 }
123
124 /* center holes */
125
126 for (y = -0.5; y <= 0.5; y += 1) {
127         for (x = -0.5; x <= 0.5; x += 1) {
128                 pin_mm_clear_mask_options(x * center_space, y * center_space,
129                                           center_drill, center_mask, 0.012 * 25.4, 0, "33", "33",
130                                           "square,via");
131         }
132 }
133
134 /* outline */
135
136 rect(-package_width/2, -package_height/2, package_width, package_height);
137
138 dot_off = 0.3;
139 dot_x = -package_width/2 - dot_off;
140 dot_y = -package_height/2 - dot_off;
141
142 line(dot_x, dot_y, dot_x, dot_y);
143
144 element_end();