working on metadata for TeleBT
[hw/altusmetrum] / packages / mlp8-4x3.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 /*
22  * These values come from the Carsem MLP spec */
23 real pad_outside = 0.20;
24 real pad_inside = 0.05;
25 real pad_side = 0.025;  /* for pad pitch > 0.65mm */
26
27 real pad_width = 0.30;
28 real pad_height = 0.60;
29 real pad_spacing = 0.80;
30
31 real package_width = 4;
32 real package_height = 3;
33
34 real pad_y_off = package_height / 2;
35
36 real num_pad = 4;       /* per side */
37
38 element_start("mlp8");
39
40 real pad_off_x(int n) {
41         return pad_spacing * (n - (num_pad - 1) / 2);
42 }
43
44 real corner(int dx, int dy) {
45         real    x = dx * package_width / 2;
46         real    y = dy * package_height / 2;
47         real    len = 0.4;
48
49         line(x, y, x - dx * len, y);
50         line(x, y, x, y - dy * len);
51 }
52
53 real pad_top(real x, real y, int n) {
54         real    w_pad = pad_width + pad_side * 2;
55         real    h_pad = pad_height + pad_outside + pad_inside;
56         real    x_pad = x;
57         real    y_pad = y + pad_outside - h_pad/2;
58
59         pad_mm(x_pad, y_pad, w_pad, h_pad, sprintf("%d", n), sprintf("%d", n));
60 }
61
62 real pad_bottom(real x, real y, int n) {
63         real    w_pad = pad_width + pad_side * 2;
64         real    h_pad = pad_height + pad_outside + pad_inside;
65         real    x_pad = x;
66         real    y_pad = y - pad_outside + h_pad/2;
67
68         pad_mm(x_pad, y_pad, w_pad, h_pad, sprintf("%d", n), sprintf("%d", n));
69 }
70
71 corner(-1, -1);
72 corner(1, -1);
73 corner(-1, 1);
74 corner(1, 1);
75
76 real dot_off = -.3;
77
78 line(-package_width/2 + dot_off, package_height/2 - dot_off,
79      -package_width/2 + dot_off, package_height/2 - dot_off);
80
81 for (int pad = 0; pad < num_pad; pad++) {
82         /* top (1-4) */
83
84         pad_top (pad_off_x(pad), package_height / 2, pad + 1);
85
86         /* bottom (8-5) */
87
88         pad_bottom (pad_off_x(pad), -package_height / 2, 8 - pad);
89 }
90
91
92 element_end();