create a qspi flash memory symbol
[hw/altusmetrum] / packages / g6z1fe.5c
1 /*
2  * Copyright © 2013 Bdale Garbee <bdale@gag.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 int total_pad = 14;
22 real center_gap = 6.00;
23
24 real pad_width;
25 real rf_pad_width = 0.8;
26 real misc_pad_width = 1.1;
27 real pad_height = 2.3;
28 real pad_spacing = 2.54;
29
30 int num_pad = total_pad / 2;    /* per side */
31
32 string name = sprintf ("G6Z-1F");
33
34 real package_width = 20.0;
35 real package_height = 8.6;
36
37 real pad_y_off = center_gap / 2 + pad_height / 2;
38
39 element_start(name);
40
41 real pad_off(int n) {
42         return pad_spacing * (n - (num_pad - 1) / 2);
43 }
44
45 real corner(int dx, int dy) {
46         real    x = dx * package_width / 2;
47         real    y = dy * package_height / 2;
48         real    len = 0.4;
49
50         line(x, y, x - dx * len, y);
51         line(x, y, x, y - dy * len);
52 }
53
54 corner(-1, -1);
55 corner(1, -1);
56 corner(-1, 1);
57 corner(1, 1);
58
59 real dot_off = -.3;
60
61 line(-package_width/2 + dot_off, package_height/2 - dot_off,
62      -package_width/2 + dot_off, package_height/2 - dot_off);
63
64 for (int pad = 0; pad < num_pad; pad++) {
65         /* bottom (1-num_pad) */
66
67     pad_width = misc_pad_width;
68     if (pad == 0 || pad == 6) {
69         pad_mm(pad_off(pad),
70                pad_y_off,
71                pad_width,
72                pad_height,
73                sprintf("%d", pad + 1),
74                sprintf("%d", pad + 1));
75     }   
76
77         /* top side (total_pad - num_pad+1) */
78
79     if (pad == 0 || pad == 3 || pad == 6) {
80         pad_width = rf_pad_width;
81     } else {
82         pad_width = misc_pad_width;
83     }
84
85         pad_mm(-pad_off(pad),
86                -pad_y_off,
87                pad_width,
88                pad_height,
89                sprintf("%d", total_pad - pad),
90                sprintf("%d", total_pad - pad));
91         
92 }
93
94 element_end();