1 /*
2  * Copyright 2018 Martin Åberg
3  *
4  * This file is part of Footag.
5  *
6  * Footag is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * Footag is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include <footag/ipc7251draft1.h>
21 
22 struct ipctable {
23         const char *ref;
24         const char *desc;
25         /* "Hole Diameter Factor" */
26         double hole[IPC7251_DENSITY_NUM];
27         /* "Int. & Ext. Annular ring Excess (added to hole dia.)" */
28         double annul[IPC7251_DENSITY_NUM];
29         /* "Anti Pad Excess (added to hole dia.) */
30         double anti[IPC7251_DENSITY_NUM];
31         /* "Courtyard Excess from Component body and/or lands" */
32         double cyexc[IPC7251_DENSITY_NUM];
33         /* Courtyard Round-off factor */
34         double round;
35 };
36 
37 #define DENS_M IPC7251_DENSITY_M
38 #define DENS_N IPC7251_DENSITY_N
39 #define DENS_L IPC7251_DENSITY_L
40 
41 static const struct ipctable table3_9 = {
42         .ref    = "Table 3-9",
43         .desc   = "Multiple Leaded Semiconductors",
44         .hole   = { [DENS_M] =  0.25, [DENS_N] =  0.20, [DENS_L] =  0.15 },
45         .annul  = { [DENS_M] =  0.50, [DENS_N] =  0.35, [DENS_L] =  0.30 },
46         .anti   = { [DENS_M] =  1.00, [DENS_N] =  0.70, [DENS_L] =  0.50 },
47         .cyexc  = { [DENS_M] =  0.50, [DENS_N] =  0.25, [DENS_L] =  0.10 },
48         .round  = 0.10,
49 };
50 
51 #undef DENS_M
52 #undef DENS_N
53 #undef DENS_L
54 
ipc7251_get_spec(struct ipc7251_spec * spec,double leaddiam_max,enum ipc7251_density density)55 int ipc7251_get_spec(
56         struct ipc7251_spec *spec,
57         double leaddiam_max,
58         enum ipc7251_density density
59 )
60 {
61         const struct ipctable *table = &table3_9;
62 
63         spec->ref.where = table->ref;
64         spec->ref.what = table->desc;
65         spec->holediam = leaddiam_max + table->hole[density];
66         /* yes it shall be * 1: see IPC-2221A */
67         spec->paddiam = spec->holediam + 1 * table->annul[density];
68         spec->antipaddiam = spec->holediam + table->anti[density];
69         spec->round = table->round;
70         spec->cyexc = table->cyexc[density];
71 
72         return 0;
73 }
74 
75