data sheet for flash part on TeleGPS v3.0
[hw/altusmetrum] / packages / phoenix / mkds5n.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 void
23 mkds5n(int pins) {
24         real pin_odd_off = 0;
25         real pin_even_off = 9;
26
27         real package_left = 3.18;
28         real package_right = 3.18;
29         real package_top = 2.1;
30         real package_bottom = 15.85 - package_top;
31
32         real pin_diameter = 1.3;
33         real pin_spacing = 6.35;
34         real pin_copper = 1.5;
35
36         real package_width = package_left + (pins - 1) * pin_spacing + package_right;
37         real package_height = package_top + package_bottom;
38
39         real pin_x(int pin) {
40                 return (pin - 1) * pin_spacing;
41         }
42
43         real pin_y(int pin) {
44                 return ((pin & 1) == 0) ? pin_even_off : pin_odd_off;
45         }
46
47         element_start(sprintf("MKDS-5N-HV-%d", pins));
48
49         for (int pin = 1; pin <= pins; pin++) {
50                 string options = "";
51                 if (pin == 1)
52                         options = "square";
53                 pin_mm_options(pin_x(pin), pin_y(pin), pin_diameter, pin_copper,
54                                sprintf("%d", pin), sprintf("%d", pin), options);
55         }
56
57         rect(-package_left, -package_top, package_width, package_height);
58
59         element_end();
60 }
61
62 void main () {
63         int pins;
64         if (dim(argv) < 2) {
65                 printf("usage: %s <pins>\n", argv[0]);
66                 exit(1);
67         }
68         pins = atoi(argv[1]);
69         if (pins <= 0 || pins > 32) {
70                 printf("Invalid pins: %d\n", pins);
71                 exit(1);
72         }
73         mkds5n(pins);
74 }
75
76 main();