update metadata for TeleGPS, add the Taiwan Semi FETs since I bought a reel
[hw/altusmetrum] / packages / m50-35.5c
1 /*
2  * Copyright © 2018 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, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  */
14
15 load "footprint.5c"
16 import Footprint;
17
18 int pins = 8;
19
20 if (dim(argv) > 1)
21         pins = atoi(argv[1]);
22
23 string name = sprintf("m50-35-%d", pins);
24
25 real pad_width = 0.74;
26 real pad_height = 1.30;
27 real package_extra_width = 1.67;
28 real pad_spacing = 1.27;
29 real total_height = 3.60;
30
31 real package_height = 1.80;
32 real package_width = 1.27 * (pins - 1) + package_extra_width;
33
34 real pad_gap = total_height - (pad_height * 2);
35 real pad_y_center = pad_gap / 2 + pad_height / 2;
36
37 real pad_y(int n) {
38         if ((n & 1) != 0)
39                 return -pad_y_center;
40         else
41                 return pad_y_center;
42 }
43
44 real pad_x(int n) {
45         return (- (pins-1) / 2) * pad_spacing + (n-1) * pad_spacing;
46 }
47
48 void
49 m50_pad(int n) {
50         pad_mm(pad_x(n), pad_y(n), pad_width, pad_height,
51                sprintf("%d", n),
52                sprintf("%d", n));
53 }
54
55 element_start(name);
56
57 rect(-package_width / 2, -package_height / 2, package_width, package_height);
58
59 for (int i = 1; i <= pins; i++)
60         m50_pad(i);
61
62 element_end();