Fix process-specific values in nickle-generated footprints
authorKeith Packard <keithp@keithp.com>
Thu, 17 Mar 2016 02:34:11 +0000 (19:34 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 17 Mar 2016 02:36:46 +0000 (19:36 -0700)
This centralizes the definition of the process values in the
footprint.5c file, instead of scattering the values across each
footprint program. This fixes several footprints with insufficient
clearance or mask width while shrinking excessive values in other
footprints.

This also adds some convenience functions to footprint.5c for
generating ground pads, both large square ones with vias embedded and
smaller ones that just want less paste on the pad than a normal pad of
similar size.

Signed-off-by: Keith Packard <keithp@keithp.com>
30 files changed:
packages/2013499-1.5c
packages/8ufson2x2.5c
packages/Makefile
packages/ap.10g.5c
packages/diodes/Makefile
packages/footprint.5c
packages/fotofab2x3.5c
packages/g6z1f.5c
packages/g6z1fe.5c
packages/hvqfn33.5c
packages/mlp8-4x3.5c
packages/phoenix/Makefile
packages/pinheader/2mmpitch.5c
packages/pinheader/Makefile
packages/qfn16-3x3.5c
packages/s-pwson-n6.5c
packages/s-pwson-n8.5c
packages/saw.5c
packages/servo.5c
packages/soic.5c
packages/sot666.5c
packages/switches/Makefile
packages/switches/cus-12.5c
packages/tfsoj-8.5c
packages/u-pdfn-8.5c
packages/ufqfpn28.5c
packages/ufqfpn48.5c
packages/uson-8.5c
packages/v-bite.5c
packages/wson6x5.5c

index 45f95d5da5d82487962187acd3ffc226d5e44e56..a6a86a4edd5eba8bd253ed0dfac4b29262d9e82e 100644 (file)
@@ -55,20 +55,20 @@ pad_mm(pad_spacing*-2, pad_y, pad_width, pad_height, "GND", "5");
 
 /* "Wings", which are next to the signal pads */
 
-pad_mm_clear(-wing_x, wing_y, wing_width, wing_height, 0, "GND", "5");
-pad_mm_clear( wing_x, wing_y, wing_width, wing_height, 0, "GND", "5");
+pad_mm_space(-wing_x, wing_y, wing_width, wing_height, 0, "GND", "5");
+pad_mm_space( wing_x, wing_y, wing_width, wing_height, 0, "GND", "5");
 
 /* Tabs under package */
 
-pad_mm_clear(-tab_x, tab_y, tab_width, tab_height, 0, "GND", "5");
-pad_mm_clear( tab_x, tab_y, tab_width, tab_height, 0, "GND", "5");
+pad_mm_space(-tab_x, tab_y, tab_width, tab_height, 0, "GND", "5");
+pad_mm_space( tab_x, tab_y, tab_width, tab_height, 0, "GND", "5");
 
 /* tangs at edges of package */
 
-pin_mm_clear(-tang_x, tang_y - tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
-pin_mm_clear(-tang_x, tang_y + tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
+pin_mm_space(-tang_x, tang_y - tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
+pin_mm_space(-tang_x, tang_y + tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
 
-pin_mm_clear( tang_x, tang_y - tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
-pin_mm_clear( tang_x, tang_y + tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
+pin_mm_space( tang_x, tang_y - tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
+pin_mm_space( tang_x, tang_y + tang_length / 2, tang_radius * 2, tang_copper, 0, "GND", "5");
 
 element_end();
index f25de6fe3a88a4d378fafc09d2e7f2958f11816c..58af9a8e3ae4abca124c9b8bb2ad139509165be6 100644 (file)
@@ -40,7 +40,7 @@ real pad_off(int n) {
 
 real dot_off = - .3;
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* bottom side (1-4) */
 
        pad_mm(pad_off(pad),
@@ -49,7 +49,7 @@ for (pad = 0; pad < num_pad; pad++) {
               pad_height,
               sprintf("%d", pad + 1),
               sprintf("%d", pad + 1));
-       
+
        /* top side (5-8) */
 
        pad_mm(-pad_off(pad),
@@ -58,7 +58,6 @@ for (pad = 0; pad < num_pad; pad++) {
               pad_height,
               sprintf("%d", pad + 5),
               sprintf("%d", pad + 5));
-       
 }
 
 pad_mm(0, 0, center_width, center_height, "GND", "GND");
index 486d9513875187401890efa4389b70e1aed2141c..9cf58d0fa86c444354c7406fa62bf95ea3e01956 100644 (file)
@@ -101,7 +101,7 @@ FOOTPRINTS= \
        servo-motor.fp
 
 .5c.fp:
-       nickle $*.5c > $@
+       nickle $*.5c -o $@
 
 .py.fp:
        python $*.py > $@
index e69588e47ac41fb7702148455e2ce0e128698dce..f7435e59017319192a95a99d167bc0714fd25377 100644 (file)
@@ -41,7 +41,7 @@ real  h_pad_y = 0 + h_pad_height / 2;
 
 real   feed_width = 2.1;
 real   feed_height = 1.25;
-real   feed_clear = 0.5;
+real   feed_space = 0.5;
 real   feed_x = 0;
 real   feed_y = feed_height / 2;
 
@@ -49,36 +49,36 @@ real        line_width = 1.29;
 real   line_height = 2;
 real   line_x = 0;
 real   line_y = feed_y + line_height/2;
-real   line_clear = feed_clear;
+real   line_space = feed_space;
 
 /* Center point is at the "top" of the feed pad */
 
 /* Draw a line at the edge of the board for alignment */
 
 real   mark_y = -edge_y + mils1002mm(line_thickness) / 2;
-                                                     
+
 line(-hole_x, mark_y, hole_x, mark_y);
 
 /* alignment holes */
-pin_mm_clear(-hole_x, -hole_y, hole_diameter, .35, 0.35, "2", "2");
-pin_mm_clear(hole_x, -hole_y, hole_diameter, .35, 0.35, "2", "2");
+pin_mm_options(-hole_x, -hole_y, hole_diameter, process_ring, "2", "2", "via");
+pin_mm_options( hole_x, -hole_y, hole_diameter, process_ring, "2", "2", "via");
 
 /* vertical pads */
 
-pad_mm_clear(-v_pad_x, -v_pad_y, v_pad_width, v_pad_height, 0, "2", "2");
-pad_mm_clear( v_pad_x, -v_pad_y, v_pad_width, v_pad_height, 0, "2", "2");
+pad_mm_space(-v_pad_x, -v_pad_y, v_pad_width, v_pad_height, 0, "2", "2");
+pad_mm_space( v_pad_x, -v_pad_y, v_pad_width, v_pad_height, 0, "2", "2");
 
 /* horizontal pads */
 
-pad_mm_clear(-h_pad_x,  h_pad_y, h_pad_width, h_pad_height, 0, "2", "2");
-pad_mm_clear( h_pad_x,  h_pad_y, h_pad_width, h_pad_height, 0, "2", "2");
+pad_mm_space(-h_pad_x,  h_pad_y, h_pad_width, h_pad_height, 0, "2", "2");
+pad_mm_space( h_pad_x,  h_pad_y, h_pad_width, h_pad_height, 0, "2", "2");
 
 /* feed pad */
 
-pad_mm_clear (feed_x,  feed_y, feed_width, feed_height, feed_clear, "1", "1");
+pad_mm_space (feed_x,  feed_y, feed_width, feed_height, feed_space, "1", "1");
 
 /* feed line */
 
-pad_mm_clear (line_x,  line_y, line_width, line_height, line_clear, "1", "1");
+pad_mm_space (line_x,  line_y, line_width, line_height, line_space, "1", "1");
 
 element_end();
index 130be0f1b5fbb898fbcbc48bb0cb496f5d4ce05e..e9ea782fe0d7c9f40673cc413d2ff9fc5e295067 100644 (file)
@@ -8,7 +8,7 @@ FOOTPRINTS = \
        0603-sideled.fp
 
 .5c.fp:
-       nickle $*.5c > $@
+       nickle $*.5c -o $@
 
 .py.fp:
        python $*.py > $@
index e6af81a9304f2332de4b7964cd762ffe08acff51..5414a4723b65b6d697100e8a89ce58fe4868ff07 100644 (file)
 
 namespace Footprint {
 
-       /* process clearance requirement */
-       public real process_clearance = 0.6;
+       import File;
 
        public int mm2mils100(real mm) = floor (mm / 25.4 * 1000 * 100 + 0.5);
 
        public real mils1002mm(real mils100) = mils100 * 25.4 / 100 / 1000;
 
-       public int line_thickness = 1000;
+       /* OSH park adprocess requirement */
+       public real process_soldermask = mils1002mm(300);
+       public real process_trace = mils1002mm(600);
+       public real process_space = mils1002mm(600);
+       public real process_drill = mils1002mm(1300);
+       public real process_ring = mils1002mm(700);
+
+       /* default pad options */
+       public string pad_options = "square";
+
+       /* default pin options */
+       public string pin_options = "pin";
+
+       /* default ink thickness */
+       public real line_thickness = mils1002mm(1000);
+
+       file out;
+       file reread;
+
+       string out_name;
+
+       string tmp_name;
 
        public void element_start(string name) {
-               printf ("# author: Keith Packard\n");
-               printf ("# email: keithp@keithp.com\n");
-               printf ("# dist-license: GPL 2\n");
-               printf ("# use-license: unlimited\n");
-               printf ("Element [\"\" \"%s\" \"\" \"\" 0 0 0 0 0 100 \"\"]\n",
+
+               if (!is_uninit(&out_name)) {
+                       tmp_name = sprintf("_tmp-%d.fp", PID::getpid());
+                       out = open(tmp_name, "w");
+                       reread = open(tmp_name, "r");
+                       unlink(tmp_name);
+               } else
+                       out = stdout;
+
+               fprintf(out, "# author: Keith Packard\n");
+               fprintf(out, "# email: keithp@keithp.com\n");
+               fprintf(out, "# dist-license: GPL 2\n");
+               fprintf(out, "# use-license: unlimited\n");
+               fprintf(out, "Element [\"\" \"%s\" \"\" \"\" 0 0 0 0 0 100 \"\"]\n",
                        name);
-               printf ("(\n");
-               
+               fprintf(out, "(\n");
        }
 
+       public void element_args() {
+
+               int other_args;
+
+               ParseArgs::argdesc argd = {
+                       .args = {
+                               {
+                                       .var = (ParseArgs::arg_var.arg_string) &out_name,
+                                       .name = "output",
+                                       .abbr = 'o',
+                                       .expr_name = "filename",
+                                       .desc = "Output file name"
+                               }
+                       },
+                       .unknown = &(int other_args)
+               };
+
+               ParseArgs::parseargs(&argd, &argv);
+
+               if (!is_uninit(&other_args))
+                       argv = (string[dim(argv)-other_args+1]) {
+                               [i] = (i == 0) ? argv[0] : argv[i + other_args-1]
+                       };
+       }
+
+       element_args();
+
        public void element_end() {
-               printf (")\n");
+               fprintf(out, ")\n");
+
+               if (!is_uninit(&out_name)) {
+                       try {
+                               close(out);
+                               twixt(file result = open(out_name, "w"); close(result)) {
+                                       while (!end(reread)) {
+                                               putb(getb(reread), result);
+                                       }
+                               }
+                       } catch open_error (string message, error_type error, string name) {
+                               fprintf(stderr, "%s: %s\n", name, message);
+                               exit(1);
+                       }
+               }
+       }
+
+       public typedef struct {
+               real    center_x;       /* center of pad */
+               real    center_y;
+
+               real    width;          /* size of pad */
+               real    height;
+
+               real    spacing;        /* space between pad and other traces */
+               real    soldermask;     /* space between pad and solder mask */
+               string  name;           /* pad name */
+               string  number;         /* pad number */
+               string  options;        /* pad options */
+
+               /* normally computed, but can be provided */
+               real    x1;             /* start of pad "line" */
+               real    y1;
+               real    x2;             /* end of pad "line" */
+               real    y2;
+               real    thickness;      /* thickness of pad "line" */
+               real    clearance;      /* twice the spacing between pad and other traces */
+               real    mask;           /* thickness of pad and solder mask */
+       } pad_t;
+
+       pad_t fill_pad(pad_t pad) {
+               if (is_uninit(&pad.x1))
+                       pad.x1 = pad.center_x - max(0, (pad.width - pad.height) / 2);
+               if (is_uninit(&pad.x2))
+                       pad.x2 = pad.center_x + max(0, (pad.width - pad.height) / 2);
+
+               if (is_uninit(&pad.y1))
+                       pad.y1 = pad.center_y - max(0, (pad.height - pad.width) / 2);
+               if (is_uninit(&pad.y2))
+                       pad.y2 = pad.center_y + max(0, (pad.height - pad.width) / 2);
+
+               if (is_uninit(&pad.spacing))
+                       pad.spacing = process_space;
+               if (is_uninit(&pad.soldermask))
+                       pad.soldermask = process_soldermask;
+               if (is_uninit(&pad.number))
+                       pad.number = pad.name;
+               if (is_uninit(&pad.options))
+                       pad.options = pad_options;
+
+               if (is_uninit(&pad.thickness))
+                       pad.thickness = min(pad.width, pad.height);
+
+               if (is_uninit(&pad.clearance))
+                       pad.clearance = pad.spacing * 2;
+
+               if (is_uninit(&pad.mask))
+                       pad.mask = pad.thickness + pad.soldermask * 2;
+
+#              fprintf(out, "pad %v\n", pad);
+
+               return pad;
+       }
+
+       public exception violation(string rule, real min, real val);
+
+       public check(string rule, real min, real val, bool zero_ok) {
+               if (zero_ok && val <= 0)
+                       return;
+               if (val < min) {
+                       Debug::trace(Thread::current());
+                       File::fprintf(stderr, "rule %s violated (%fmm %fmils < %fmm %fmils)\n",
+                                     rule,
+                                     val, mm2mils100(val)/100.0,
+                                     min, mm2mils100(min)/100.0);
+                       exit(1);
+               }
        }
-       
-       public void pad_mm_clear_mask_options(real center_x,
+
+       public void pad(pad_t pad)
+       {
+               pad = fill_pad(pad);
+
+               check("pad trace", process_trace, pad.thickness, false);
+               check("pad space", process_space, pad.clearance / 2, true);
+               check("pad mask", process_soldermask, (pad.mask - pad.thickness) / 2, true);
+
+               fprintf(out, "    Pad[");
+               fprintf(out, " %6d %6d %6d %6d",
+                       mm2mils100(pad.x1),
+                       mm2mils100(pad.y1),
+                       mm2mils100(pad.x2),
+                       mm2mils100(pad.y2));
+               fprintf(out, " %6d %6d %6d",
+                       mm2mils100(pad.thickness),
+                       mm2mils100(pad.clearance),
+                       mm2mils100(pad.mask));
+               fprintf(out, " \"%s\" \"%s\" \"%s\"]\n",
+                       pad.name, pad.number, pad.options);
+       }
+
+       public void pad_mm_space_mask_options(real center_x,
                                              real center_y,
                                              real width,
                                              real height,
-                                             real clearance,
-                                             real mask,
+                                             real spacing,
+                                             real soldermask,
                                              string name,
-                                             string num,
+                                             string number,
                                              string options)
        {
-               real    x1 = 0;
-               real    y1 = 0;
-               real    x2 = 0;
-               real    y2 = 0;
-               real    thickness = 0;
-
-               if (width > height) {
-                       thickness = height;
-                       y1 = center_y;
-                       x1 = center_x - (width - height) / 2;
-                       y2 = center_y;
-                       x2 = center_x + (width - height) / 2;
-               } else {
-                       thickness = width;
-                       x1 = center_x;
-                       y1 = center_y - (height - width) / 2;
-                       x2 = center_x;
-                       y2 = center_y + (height - width) / 2;
-               }
-
-
-               printf ("    Pad[");
-               printf (" %6d %6d %6d %6d",
-                       mm2mils100(x1),
-                       mm2mils100(y1),
-                       mm2mils100(x2),
-                       mm2mils100(y2));
-               printf (" %6d %6d %6d",
-                       mm2mils100(thickness),
-                       mm2mils100(clearance),
-                       mm2mils100(mask));
-               printf (" \"%s\" \"%s\" \"%s\"]\n",
-                       name, num, options);
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .spacing = spacing,
+                               .soldermask = soldermask,
+                               .name = name,
+                               .number = number,
+                               .options = options
+                               });
        }
 
-       public void pad_mm_clear_options(real center_x,
+       public void pad_mm_space_options(real center_x,
                                         real center_y,
                                         real width,
                                         real height,
-                                        real clearance,
+                                        real spacing,
                                         string name,
-                                        string num,
+                                        string number,
                                         string options)
        {
-               real    x1 = 0;
-               real    y1 = 0;
-               real    x2 = 0;
-               real    y2 = 0;
-               real    thickness = 0;
-
-               if (width > height) {
-                       thickness = height;
-                       y1 = center_y;
-                       x1 = center_x - (width - height) / 2;
-                       y2 = center_y;
-                       x2 = center_x + (width - height) / 2;
-               } else {
-                       thickness = width;
-                       x1 = center_x;
-                       y1 = center_y - (height - width) / 2;
-                       x2 = center_x;
-                       y2 = center_y + (height - width) / 2;
-               }
-
-               real mask = thickness + clearance / 2;
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .spacing = spacing,
+                               .name = name,
+                               .number = number,
+                               .options = options
+                               });
+       }
 
-               printf ("    Pad[");
-               printf (" %6d %6d %6d %6d",
-                       mm2mils100(x1),
-                       mm2mils100(y1),
-                       mm2mils100(x2),
-                       mm2mils100(y2));
-               printf (" %6d %6d %6d",
-                       mm2mils100(thickness),
-                       mm2mils100(clearance),
-                       mm2mils100(mask));
-               printf (" \"%s\" \"%s\" \"%s\"]\n",
-                       name, num, options);
+       public void pad_mm_mask_options(real center_x,
+                                        real center_y,
+                                        real width,
+                                        real height,
+                                        real soldermask,
+                                        string name,
+                                        string number,
+                                        string options)
+       {
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .soldermask = soldermask,
+                               .name = name,
+                               .number = number,
+                               .options = options
+                               });
        }
 
-       public void pad_mm_clear(real center_x,
+       public void pad_mm_space(real center_x,
                                 real center_y,
                                 real width,
                                 real height,
-                                real clearance,
+                                real spacing,
                                 string name,
-                                string num)
+                                string number)
        {
-               pad_mm_clear_options(center_x,
-                                    center_y,
-                                    width,
-                                    height,
-                                    clearance,
-                                    name,
-                                    num,
-                                    "square");
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .spacing = spacing,
+                               .name = name,
+                               .number = number,
+                               });
        }
 
        public void pad_mm(real center_x,
@@ -154,32 +293,66 @@ namespace Footprint {
                           real width,
                           real height,
                           string name,
-                          string num)
+                          string number)
        {
-               pad_mm_clear(center_x,
-                            center_y,
-                            width,
-                            height,
-                            process_clearance,
-                            name,
-                            num);
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .name = name,
+                               .number = number,
+                               });
        }
+
        public void pad_mm_options(real center_x,
                                   real center_y,
                                   real width,
                                   real height,
                                   string name,
-                                  string num,
+                                  string number,
                                   string options)
        {
-               pad_mm_clear_options(center_x,
-                                    center_y,
-                                    width,
-                                    height,
-                                    process_clearance,
-                                    name,
-                                    num,
-                                    options);
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .name = name,
+                               .number = number,
+                               .options = options
+                               });
+       }
+
+       /* Pad with partial solder coverage.
+        * Useful for pads under parts which aren't
+        * big enough to use the center function below
+        */
+       public void pad_mm_partial(real center_x,
+                                  real center_y,
+                                  real width,
+                                  real height,
+                                  real partial,
+                                  string name)
+       {
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width,
+                               .height = height,
+                               .name = name,
+                               .options = pad_options + ",nopaste"
+                               });
+
+               real    ratio = floor(sqrt(partial) * 100.0 + 0.5) / 100;
+
+               pad((pad_t) {
+                               .center_x = center_x,
+                               .center_y = center_y,
+                               .width = width * ratio,
+                               .height = height * ratio,
+                               .name = name,
+                               });
        }
 
        public void pad_mm_arbitrary(   real x1,
@@ -188,115 +361,163 @@ namespace Footprint {
                                        real y2,
                                        real thickness,
                                        string name,
-                                       string num,
+                                       string number,
                                        string options)
        {
-               real clearance = process_clearance;
+               pad((pad_t) {
+                               .x1 = x1,
+                               .y1 = y1,
+                               .x2 = x2,
+                               .y2 = y2,
+                               .thickness = thickness,
+                               .name = name,
+                               .number = number,
+                               .options = options
+                               });
+       }
 
-               real mask = thickness + clearance / 2;
+       public typedef struct {
+               real    x;              /* center of pin */
+               real    y;
+               real    drill;          /* diameter of drill hole */
 
-               printf ("    Pad[");
-               printf (" %6d %6d %6d %6d",
-                       mm2mils100(x1),
-                       mm2mils100(y1),
-                       mm2mils100(x2),
-                       mm2mils100(y2));
-               printf (" %6d %6d %6d",
-                       mm2mils100(thickness),
-                       mm2mils100(clearance),
-                       mm2mils100(mask));
-               printf (" \"%s\" \"%s\" \"%s\"]\n",
-                       name, num, options);
+               real    ring;           /* width of annular ring around hole */
+               real    spacing;        /* space between pin and other traces */
+               real    soldermask;     /* space between pin and solder mask */
+
+               string  name;           /* pin name */
+               string  number;         /* pin number */
+               string  options;        /* pin options */
+
+               /* normally computed, but can be provided */
+               real    thickness;      /* thickness of pin "line" */
+               real    clearance;      /* twice the spacing between pin and other traces */
+               real    mask;           /* thickness of pin and solder mask */
+       } pin_t;
+
+       pin_t fill_pin(pin_t pin) {
+
+               /* Fill in process rules if unset */
+               if (is_uninit(&pin.spacing))
+                       pin.spacing = process_space;
+               if (is_uninit(&pin.ring))
+                       pin.ring = process_ring;
+               if (is_uninit(&pin.soldermask))
+                       pin.soldermask = process_soldermask;
+
+               if (is_uninit(&pin.number))
+                       pin.number = pin.name;
+               if (is_uninit(&pin.options))
+                       pin.options = pin_options;
+
+               if (is_uninit(&pin.thickness))
+                       pin.thickness = pin.drill + pin.ring * 2;
+
+               if (is_uninit(&pin.mask))
+                       pin.mask = pin.thickness + pin.soldermask * 2;
+
+               if (is_uninit(&pin.clearance))
+                       pin.clearance = pin.spacing * 2;
+
+               return pin;
        }
 
-       public void pin_mm_clear(real x, real y, real drill, real copper, real clearance,
-                       string name,
-                       string number)
+       public void pin(pin_t pin)
+       {
+               pin = fill_pin(pin);
+
+               check("pin drill", process_drill, pin.drill, false);
+               check("pin ring", process_ring, (pin.thickness - pin.drill) / 2, true);
+               check("pin space", process_space, pin.clearance / 2, true);
+               if (String::index(pin.options, "via") < 0)
+                       check("pin mask", process_soldermask, (pin.mask - pin.thickness) / 2, true);
+
+               fprintf(out, "    Pin[");
+               fprintf(out, " %6d %6d",
+                       mm2mils100(pin.x),
+                       mm2mils100(pin.y));
+               fprintf(out, " %6d %6d %6d",
+                       mm2mils100(pin.thickness),
+                       mm2mils100(pin.clearance),
+                       mm2mils100(pin.mask));
+               fprintf(out," %6d",
+                      mm2mils100(pin.drill));
+               fprintf(out, " \"%s\" \"%s\" \"%s\"]\n",
+                       pin.name, pin.number, pin.options);
+       }
+
+       public void pin_mm_space_mask_options(real x, real y,
+                                             real drill, real copper, real spacing, real soldermask,
+                                             string name, string number, string options)
        {
-               real thickness = drill + copper * 2;
-               real mask = thickness + clearance / 2;
-               printf("    Pin[");
-               printf(" %6d %6d",
-                      mm2mils100(x),
-                      mm2mils100(y));
-               printf(" %6d %6d %6d %6d",
-                      mm2mils100(thickness),
-                      mm2mils100(clearance),
-                      mm2mils100(mask),
-                      mm2mils100(drill));
-               printf (" \"%s\" \"%s\"",
-                       name, number);
-               printf (" \"\"]\n");
-                      
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .spacing = spacing,
+                               .soldermask = soldermask,
+                               .name = name,
+                               .number = number,
+                               .options = options });
        }
 
-       public void pin_mm_clear_options(real x, real y, real drill, real copper, real clearance,
+       public void pin_mm_space_options(real x, real y, real drill, real copper, real spacing,
                                         string name,
                                         string number,
                                         string options)
        {
-               real thickness = drill + copper * 2;
-               real mask = thickness + clearance / 2;
-               printf("    Pin[");
-               printf(" %6d %6d",
-                      mm2mils100(x),
-                      mm2mils100(y));
-               printf(" %6d %6d %6d %6d",
-                      mm2mils100(thickness),
-                      mm2mils100(clearance),
-                      mm2mils100(mask),
-                      mm2mils100(drill));
-               printf (" \"%s\" \"%s\"",
-                       name, number);
-               printf (" \"%s\"]\n", options);
-                      
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .spacing = spacing,
+                               .name = name,
+                               .number = number,
+                               .options = options });
        }
 
-       public void pin_mm_clear_mask_options(real x, real y,
-                                             real drill, real copper, real clearance, real mask,
-                                             string name, string number, string options)
+       public void pin_mm_space_mask(real x, real y,
+                                     real drill, real copper, real spacing, real soldermask,
+                                     string name, string number)
        {
-               real thickness = drill + copper * 2;
-               printf("    Pin[");
-               printf(" %6d %6d",
-                      mm2mils100(x),
-                      mm2mils100(y));
-               printf(" %6d %6d %6d %6d",
-                      mm2mils100(thickness),
-                      mm2mils100(clearance),
-                      mm2mils100(mask),
-                      mm2mils100(drill));
-               printf (" \"%s\" \"%s\"",
-                       name, number);
-               printf (" \"%s\"]\n", options);
-                      
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .spacing = spacing,
+                               .soldermask = soldermask,
+                               .name = name,
+                               .number = number });
        }
-       public void pin_mm_clear_mask(real x, real y,
-                                     real drill, real copper, real clearance, real mask,
-                                     string name, string number)
+
+       public void pin_mm_space(real x, real y, real drill, real copper, real spacing,
+                       string name,
+                       string number)
        {
-               real thickness = copper;
-               printf("    Pin[");
-               printf(" %6d %6d",
-                      mm2mils100(x),
-                      mm2mils100(y));
-               printf(" %6d %6d %6d %6d",
-                      mm2mils100(thickness),
-                      mm2mils100(clearance),
-                      mm2mils100(mask),
-                      mm2mils100(drill));
-               printf (" \"%s\" \"%s\"",
-                       name, number);
-               printf (" \"\"]\n");
-                      
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .spacing = spacing,
+                               .name = name,
+                               .number = number });
        }
 
        public void pin_mm(real x, real y, real drill, real copper,
                        string name,
                        string number)
        {
-               pin_mm_clear(x, y, drill, copper, process_clearance,
-                            name, number);
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .name = name,
+                               .number = number,});
        }
 
        public void pin_mm_options(real x, real y, real drill, real copper,
@@ -304,19 +525,57 @@ namespace Footprint {
                                   string number,
                                   string options)
        {
-               pin_mm_clear_options(x, y, drill, copper, process_clearance,
-                                    name, number, options);
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .name = name,
+                               .number = number,
+                               .options = options });
+       }
+
+       public void pin_mm_mask_options(real x, real y, real drill, real copper,
+                                       real soldermask,
+                                       string name,
+                                       string number,
+                                       string options)
+       {
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .soldermask = soldermask,
+                               .name = name,
+                               .number = number,
+                               .options = options });
+       }
+
+       public void via_mm(real x, real y,
+                          real drill, real copper,
+                          string name)
+       {
+               pin ((pin_t) {
+                               .x = x,
+                               .y = y,
+                               .drill = drill,
+                               .ring = copper,
+                               .mask = 0,
+                               .name = name,
+                               .options = "via"
+                       });
        }
 
        public void line (real x1, real y1, real x2, real y2)
        {
-               printf ("    ElementLine[");
-               printf (" %6d %6d %6d %6d",
+               fprintf(out, "    ElementLine[");
+               fprintf(out, " %6d %6d %6d %6d",
                        mm2mils100(x1),
                        mm2mils100(y1),
                        mm2mils100(x2),
                        mm2mils100(y2));
-               printf (" %d]\n", line_thickness);
+               fprintf(out, " %d]\n", mm2mils100(line_thickness));
        }
 
        public void rect (real x, real y, real w, real h)
@@ -331,9 +590,109 @@ namespace Footprint {
                         real radius_x, real radius_y,
                         real start_angle, real delta_angle)
        {
-               printf ("    ElementArc[ %6d %6d %6d %6d %3d %3d %d]\n",
+               fprintf(out, "    ElementArc[ %6d %6d %6d %6d %3d %3d %d]\n",
                        mm2mils100(center_x), mm2mils100(center_y),
                        mm2mils100(radius_x), mm2mils100(radius_y),
-                       start_angle, delta_angle, line_thickness);
+                       start_angle, delta_angle, mm2mils100(line_thickness));
+       }
+
+       public typedef struct {
+               real    x, y;           /* center */
+               real    width, height;  /* size */
+
+               real    via_space_x;
+               real    via_space_y;
+               int     via_cols, via_rows;
+               string  name;
+
+               real    via_drill;
+               real    via_copper;
+
+       } center_t;
+
+       public void center_pad(center_t center) {
+
+               if (is_uninit(&center.via_drill))
+                       center.via_drill = process_drill;
+
+               if (is_uninit(&center.via_copper))
+                       center.via_copper = process_ring;
+
+               if (is_uninit(&center.via_space_x)) {
+                       real    side_x = center.via_drill / 2 + center.via_copper;
+                       real    space_x = center.width - 2 * side_x;
+
+                       center.via_space_x = space_x / (center.via_cols - 1);
+               }
+
+               if (is_uninit(&center.via_space_y)) {
+                       real    side_y = center.via_drill / 2 + center.via_copper;
+                       real    space_y = center.width - 2 * side_y;
+
+                       center.via_space_y = space_y / (center.via_rows - 1);
+               }
+
+               /* whole pad */
+               pad((pad_t) {
+                               .center_x = center.x,
+                               .center_y = center.y,
+                               .width = center.width,
+                               .height = center.height,
+                               .name = center.name,
+                               .options = "square,nopaste",
+                               .spacing = process_space,
+                               .mask = 0});
+
+               /* vias */
+               for (int r = 0; r < center.via_rows; r++)
+                       for (int c = 0; c < center.via_cols; c++) {
+                               real    x = (c - (center.via_cols - 1) / 2) * center.via_space_x;
+                               real    y = (r - (center.via_rows - 1) / 2) * center.via_space_y;
+
+                               via_mm(x, y, process_drill, process_ring, center.name);
+
+                               pad((pad_t) {
+                                               .center_x = center.x + x,
+                                               .center_y = center.y + y,
+                                               .width = center.via_space_x / 2,
+                                               .height = center.via_space_y / 2,
+                                               .name = center.name,
+                                               .options = "square,nopaste",
+                                               .clearance = 0,
+                                               .mask = 0,
+                                       });
+                       }
+
+               for (real r = 0; r < center.via_rows - 0.5; r += 0.5) {
+                       for (real c = 0; c < center.via_cols - 0.5; c += 0.5) {
+
+                               if (is_int(r) && is_int(c))
+                                       continue;
+
+                               real    x = (c - (center.via_cols - 1) / 2) * center.via_space_x;
+                               real    y = (r - (center.via_rows - 1) / 2) * center.via_space_y;
+
+                               /* exposed copper */
+                               pad((pad_t) {
+                                               .center_x = center.x + x,
+                                               .center_y = center.y + y,
+                                               .width = center.via_space_x / 2,
+                                               .height = center.via_space_x / 2,
+                                               .soldermask = 0,
+                                               .name = center.name,
+                                               .options = "square,nopaste",
+                                                       });
+
+                               /* paste spot */
+                               pad((pad_t) {
+                                               .center_x = center.x + x,
+                                               .center_y = center.y + y,
+                                               .width = center.via_space_x / 3.5,
+                                               .height = center.via_space_y / 3.5,
+                                               .name = center.name,
+                                               .options = "square",
+                                       });
+                       }
+               }
        }
 }
index 7e86582b353f17921076168b24cf02d749ec373c..00c9da944e8ca30a762b4231cb6b371e40458d38 100644 (file)
@@ -27,31 +27,25 @@ real shield_width = 76.20;
 real shield_height = 50.80;
 real via_diam = 0.015 * 25.4;
 real via_ring = 0.008 * 25.4;
-real clearance = 0.6;
-real mask = pad_width + clearance / 2;
 
 element_start("fotofab2x3");
 
-pad_mm_clear_mask_options(shield_width/2, 0, 
-                         pad_width, shield_height+pad_width, 
-                         clearance, mask,
-                         "1", "1", 
-                         "square,nopaste");
-pad_mm_clear_mask_options(-shield_width/2, 0, 
-                         pad_width, shield_height+pad_width,
-                         clearance, mask,
-                         "1", "1", 
-                         "square,nopaste");
-pad_mm_clear_mask_options(0, shield_height/2, 
-                         shield_width+pad_width, pad_width,
-                         clearance, mask,
-                         "1", "1", 
-                         "square,nopaste");
-pad_mm_clear_mask_options(0, -shield_height/2, 
-                         shield_width+pad_width, pad_width,
-                         clearance, mask,
-                         "1", "1", 
-                         "square,nopaste");
+pad_mm_options(shield_width/2, 0,
+              pad_width, shield_height+pad_width,
+              "1", "1",
+              "square,nopaste");
+pad_mm_options(-shield_width/2, 0,
+              pad_width, shield_height+pad_width,
+              "1", "1",
+              "square,nopaste");
+pad_mm_options(0, shield_height/2,
+              shield_width+pad_width, pad_width,
+              "1", "1",
+              "square,nopaste");
+pad_mm_options(0, -shield_height/2,
+              shield_width+pad_width, pad_width,
+              "1", "1",
+              "square,nopaste");
 
 pin_mm(shield_width/2, shield_height/2, via_diam, via_ring, "1", "1");
 pin_mm(-shield_width/2, shield_height/2, via_diam, via_ring, "1", "1");
index 522028e671ffe906b37fe2bab29280a5f8dc9883..24568e3c7fcbbbbf00b7659e87efc0934ca1f35f 100644 (file)
@@ -61,7 +61,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, package_height/2 - dot_off,
      -package_width/2 + dot_off, package_height/2 - dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* bottom (1-num_pad) */
 
     if (pad == 3) {
index 3e5338eb01d279ffaa54dcbbdf26ca762a5e691c..aed4cb90fbed27f110532febf1c9c7875180b229 100644 (file)
@@ -61,7 +61,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, package_height/2 - dot_off,
      -package_width/2 + dot_off, package_height/2 - dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* bottom (1-num_pad) */
 
     pad_width = misc_pad_width;
index bcdf62eec96e87c5f93840bd2b0fb63ea9ed5b0c..a7cf11a154148bc6b918f9e12861295c046050c0 100644 (file)
@@ -31,7 +31,8 @@ real pad_center_y = 5.25 / 2; /* Gy/2 */
 real center_width = 3.75;      /* SLx */
 real center_height = 3.75;     /* SLy */
 
-real center_drill = 0.015 * 25.4;
+real center_drill = process_drill;
+real center_copper = process_ring;
 real center_mask = 0.60 / 2;
 
 real center_space = 1.1;
@@ -44,7 +45,7 @@ real pad_off(int n) {
 
 element_start("hvqfn33");
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-8) */
 
        pad_mm(-pad_center_x,
@@ -84,52 +85,14 @@ for (pad = 0; pad < num_pad; pad++) {
 
 /* center */
 
-pad_mm_clear_mask_options(0, 0, center_width, center_height, process_clearance, 0,
-                         "33", "33", "square,nopaste");
-
-
-real clear_top = center_space * 0.5 + center_mask;
-real clear_bottom = center_height / 2;
-real clear_height = clear_bottom - clear_top;
-real clear_y = (clear_top + clear_bottom) / 2;
-
-for (y = -1; y <= 1; y+= 2) {
-       pad_mm_clear_mask_options(0, y * clear_y, center_width, clear_height,
-                                 0, clear_height, "33", "33", "square,nopaste");
-
-       pad_mm_clear_mask_options(y * clear_y, 0, clear_height, center_height,
-                                 0, clear_height, "33", "33", "square,nopaste");
-}
-
-real hole_pos = 0.5 * center_space;
-real strip_top = -hole_pos + center_mask;
-real strip_bot = hole_pos - center_mask;
-real strip_size = strip_bot - strip_top;
-
-pad_mm_clear_mask_options(0, 0, center_width, strip_size,
-                         0, strip_size, "33", "33", "square,nopaste");
-
-pad_mm_clear_mask_options(0, 0, strip_size, center_height,
-                         0, strip_size, "33", "33", "square,nopaste");
-
-/* center solder spots */
-
-for (y = -1; y <= 1; y += 1) {
-       for (x = -1; x <= 1; x += 1) {
-               pad_mm_clear_mask_options(x * center_space, y * center_space,
-                                         center_mask*2, center_mask*2, 0, center_mask * 2, "33", "33", "");
-       }
-}
-
-/* center holes */
-
-for (y = -0.5; y <= 0.5; y += 1) {
-       for (x = -0.5; x <= 0.5; x += 1) {
-               pin_mm_clear_mask_options(x * center_space, y * center_space,
-                                         center_drill, center_mask, 0.012 * 25.4, 0, "33", "33",
-                                         "square,via");
-       }
-}
+center_pad((center_t) {
+               .x = 0,
+                       .y = 0,
+                       .width = center_width,
+                       .height = center_height,
+                       .name = "33",
+                       .via_cols = 3,
+                       .via_rows = 3});
 
 /* outline */
 
index 153e66cb34cc9c8b0ed41fc7b6c19d34490f036a..2393d0e5b01a4e126be64901717564965eed07bd 100644 (file)
@@ -78,7 +78,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, package_height/2 - dot_off,
      -package_width/2 + dot_off, package_height/2 - dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* top (1-4) */
 
        pad_top (pad_off_x(pad), package_height / 2, pad + 1);
index 677a40008f3b5b3048bb28a869a04de71beade71..3ec88bbbeca96e3191a7e5f496f6a1e73dd9fae2 100644 (file)
@@ -12,31 +12,31 @@ FOOTPRINTS=\
 all: $(FOOTPRINTS)
 
 mkds5n-4.fp: mkds5n.5c
-       nickle mkds5n.5c 4 > $@
+       nickle mkds5n.5c -o $@ 4
 
 mkds5n-5.fp: mkds5n.5c
-       nickle mkds5n.5c 5 > $@
+       nickle mkds5n.5c -o $@ 5
 
 mkds5n-6.fp: mkds5n.5c
-       nickle mkds5n.5c 6 > $@
+       nickle mkds5n.5c -o $@ 6
 
 mkds5n-7.fp: mkds5n.5c
-       nickle mkds5n.5c 7 > $@
+       nickle mkds5n.5c -o $@ 7
 
 mkds5n-8.fp: mkds5n.5c
-       nickle mkds5n.5c 8 > $@
+       nickle mkds5n.5c -o $@ 8
 
 mkds5n-9.fp: mkds5n.5c
-       nickle mkds5n.5c 9 > $@
+       nickle mkds5n.5c -o $@ 9
 
 mkds5n-10.fp: mkds5n.5c
-       nickle mkds5n.5c 10 > $@
+       nickle mkds5n.5c -o $@ 10
 
 mkds5n-11.fp: mkds5n.5c
-       nickle mkds5n.5c 11 > $@
+       nickle mkds5n.5c -o $@ 11
 
 mkds5n-12.fp: mkds5n.5c
-       nickle mkds5n.5c 12 > $@
+       nickle mkds5n.5c -o $@ 12
 
 clean:
        rm -f $(FOOTPRINTS)
index 22afacf6efb62284fbcf69ee7dc31c541dd023f7..9ee4ca4b45f8c86e455dd391c1e6e71f53639de1 100644 (file)
@@ -28,11 +28,6 @@ if (pins < 2) {
        exit(1);
 }
 
-printf ("# author: Keith Packard\n");
-printf ("# email: keithp@keithp.com\n");
-printf ("# dist-license: GPL 2\n");
-printf ("# use-license: unlimited\n");
-
 element_start(sprintf ("2mm%dpin", pins));
 
 for (int pin = 0; pin < pins; pin++)
index 95a6d173b1e4aeef27de1fa5fadaddfd7e95d0f0..3a6cfc6f1d3789f54da94a345792861f1794e05f 100644 (file)
@@ -12,7 +12,7 @@ all: $(FOOTPRINTS) .gitignore
        ./50milpitch.py 5 > $@
 
 2mm2pin.fp: 2mmpitch.5c
-       nickle 2mmpitch.5c 2 > $@
+       nickle 2mmpitch.5c -o $@ 2
 
 clean:
        rm -f $(FOOTPRINTS)
index fedd52c24f43f119d3a34a9cdeeacc9e213952ef..4d860a0175ae1c503b3252496afe1adaaa1d1806 100644 (file)
@@ -61,86 +61,52 @@ real dot_off = .3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-4) */
 
-       pad_mm_clear(-pad_x_off - pad_width / 2,
-                    pad_off(pad),
-                    pad_width,
-                    pad_height,
-                    pad_clearance,
-                    sprintf("%d", pad + 1),
-                    sprintf("%d", pad + 1));
+       pad_mm(-pad_x_off - pad_width / 2,
+              pad_off(pad),
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 1),
+              sprintf("%d", pad + 1));
 
        /* bottom (5-8) */
 
-       pad_mm_clear(pad_off(pad),
-                    pad_y_off + pad_width / 2,
-                    pad_height,
-                    pad_width,
-                    pad_clearance,
-                    sprintf("%d", pad + 5),
-                    sprintf("%d", pad + 5));
+       pad_mm(pad_off(pad),
+              pad_y_off + pad_width / 2,
+              pad_height,
+              pad_width,
+              sprintf("%d", pad + 5),
+              sprintf("%d", pad + 5));
 
        /* right side (9-12) */
 
-       pad_mm_clear(pad_x_off + pad_width / 2,
-                    -pad_off(pad),
-                    pad_width,
-                    pad_height,
-                    pad_clearance,
-                    sprintf("%d", pad + 9),
-                    sprintf("%d", pad + 9));
+       pad_mm(pad_x_off + pad_width / 2,
+              -pad_off(pad),
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 9),
+              sprintf("%d", pad + 9));
 
        /* top (13-16) */
 
-       pad_mm_clear(-pad_off(pad),
-                    -pad_y_off - pad_width / 2,
-                    pad_height,
-                    pad_width,
-                    pad_clearance,
-                    sprintf("%d", pad + 13),
-                    sprintf("%d", pad + 13));
-
+       pad_mm(-pad_off(pad),
+              -pad_y_off - pad_width / 2,
+              pad_height,
+              pad_width,
+              sprintf("%d", pad + 13),
+              sprintf("%d", pad + 13));
 }
 
-int pad_blocks = 3;
-
-real block_width = center_width / pad_blocks;
-real block_height = center_height / pad_blocks;
-
-real block_x(int x) = (x - (pad_blocks - 1)/2) * block_width;
-real block_y(int y) = (y - (pad_blocks - 1)/2) * block_height;
-
-bool via_block(int x, int y) {
-       return (x & 1) == 0 && (y & 1) == 0;
-}
-
-real via_hole = 13/1000 * 25.4;                /* 13 mil drill */
-real via_copper = 7/1000 * 25.4;       /* 5.6 mil anulus */
-
-for (int pad_y = 0; pad_y < pad_blocks; pad_y++) {
-       for (int pad_x = 0; pad_x < pad_blocks; pad_x++)
-               if (via_block(pad_x, pad_y)) {
-                       pin_mm_clear_mask(block_x(pad_x), block_y(pad_y),
-                                         via_hole, via_hole + 2 * via_copper, pad_clearance, 0,
-                                         "GND", "GND");
-                       pad_mm_clear_mask_options(block_x(pad_x), block_y(pad_y),
-                                                 block_width, block_height,
-                                                 pad_clearance, 0,
-                                                 "GND", "GND","square,nopaste");
-               } else {
-                       /* full square of metal */
-                       pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
-                                            block_width, block_height,
-                                            0,
-                                            "GND", "GND","square,nopaste");
-                       /* 1/4 full of solder paste */
-                       pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
-                                            block_width/2, block_height/2,
-                                            0,
-                                            "GND", "GND","square");
-               }
-}
+center_pad((center_t) {
+               .x = 0,
+               .y = 0,
+               .width = center_width,
+               .height = center_height,
+               .via_cols = 2,
+               .via_rows = 2,
+               .name = "GND"
+               });
 
 element_end();
index 9d9300efc2c54abe27ae55156408bcbf4413bfd1..2456f0947da8713e90a6e0a6c9ce5b3459e3e60a 100644 (file)
@@ -18,8 +18,6 @@
 load "footprint.5c"
 import Footprint;
 
-Footprint::process_clearance = 0.07;
-
 real pad_expose = 0.1;
 real pad_width = 0.3;
 real pad_height = 0.7;
@@ -33,29 +31,16 @@ real package_height = 2;
 real center_width = 1.6;
 real center_height = 1.0;
 
-real clearance = 0.0061 * 25.4;
-real mask = 0.07;
-
 real pad_x_off = package_width / 2 - (pad_width - pad_expose) / 2 + pad_expose;
 
 real num_pad = 3;      /* per side */
 
 element_start("s-pwson-n6");
 
-/* full center pad */
-pad_mm_clear_mask_options(0, 0, center_width, center_height, 0, center_height + mask, "7", "7", "square,nopaste");
-
-/* 70% paste coverage */
-real paste_coverage = 0.70;
-real paste_coverage_scale = sqrt(paste_coverage);
-pad_mm_clear_mask_options(0, 0, center_width * paste_coverage_scale,
-                         center_height * paste_coverage_scale, 0, center_height + mask, "7", "7", "square");
+pad_mm_partial(0, 0, center_width, center_height, 0.63, "7");
 
-pin_mm_clear_mask_options(-0.9, 0,
-                         0.3811, clearance*2, 0.2, 0, "GND", "7", "via");
-
-pin_mm_clear_mask_options(0.9, 0,
-                         0.3811, clearance*2, 0.2, 0, "GND", "7", "via");
+via_mm(-0.9, 0, process_drill, process_ring, "GND");
+via_mm( 0.9, 0, process_drill, process_ring, "GND");
 
 real pad_y_off = pad_y_spacing / 2;
 
@@ -66,24 +51,21 @@ real pad_off(int n) {
 for (int pad = 0; pad < num_pad; pad++) {
        /* bottom side (1-3) */
 
-       pad_mm_clear_mask_options(pad_off(pad),
-                                 pad_y_off,
-                                 pad_width,
-                                 pad_height,
-                                 clearance * 2, pad_width + mask,
-                                 sprintf("%d", pad + 1),
-                                 sprintf("%d", pad + 1), "square");
+       pad_mm(pad_off(pad),
+              pad_y_off,
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 1),
+              sprintf("%d", pad + 1));
 
        /* top side (6-4) */
 
-       pad_mm_clear_mask_options(pad_off(pad),
-                                 -pad_y_off,
-                                 pad_width,
-                                 pad_height,
-                                 clearance * 2, pad_width + mask,
-                                 sprintf("%d", 6 - pad),
-                                 sprintf("%d", 6 - pad), "square");
-
+       pad_mm(pad_off(pad),
+              -pad_y_off,
+              pad_width,
+              pad_height,
+              sprintf("%d", 6 - pad),
+              sprintf("%d", 6 - pad));
 }
 
 rect(-package_width/2, -package_height/2, package_width, package_height);
index a0c8741c3267cb18bcf2d327ba55ffa147071fd0..c31cdb6d3b36aa16d19ae2cbb56a896e60c997cf 100644 (file)
@@ -18,8 +18,6 @@
 load "footprint.5c"
 import Footprint;
 
-Footprint::process_clearance = 0.07;
-
 real pad_expose = 0.1;
 real pad_width = 0.28;
 real pad_height = 0.50;
@@ -43,13 +41,10 @@ real num_pad = 4;   /* per side */
 element_start("s-pwson-n8");
 
 /* full center pad */
-pad_mm_clear_mask_options(0, 0, center_width, center_height, 0, center_height + mask, "9", "9", "square,nopaste");
+pad_mm_partial(0, 0, center_width, center_height, 0.63, "9");
 
-/* 63% paste coverage */
-real paste_coverage = 0.63;
-real paste_coverage_scale = sqrt(paste_coverage);
-pad_mm_clear_mask_options(0, 0, center_width * paste_coverage_scale,
-                         center_height * paste_coverage_scale, 0, center_height + mask, "9", "9", "square");
+via_mm(-0.9, 0, process_drill, process_ring, "GND");
+via_mm( 0.9, 0, process_drill, process_ring, "GND");
 
 real pad_y_off = pad_y_spacing / 2;
 
@@ -60,24 +55,21 @@ real pad_off(int n) {
 for (int pad = 0; pad < num_pad; pad++) {
        /* bottom side (1-4) */
 
-       pad_mm_clear_mask_options(pad_off(pad),
-                                 pad_y_off,
-                                 pad_width,
-                                 pad_height,
-                                 clearance * 2, pad_width + mask,
-                                 sprintf("%d", pad + 1),
-                                 sprintf("%d", pad + 1), "square");
+       pad_mm(pad_off(pad),
+              pad_y_off,
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 1),
+              sprintf("%d", pad + 1));
 
        /* top side (8-5) */
 
-       pad_mm_clear_mask_options(pad_off(pad),
-                                 -pad_y_off,
-                                 pad_width,
-                                 pad_height,
-                                 clearance * 2, pad_width + mask,
-                                 sprintf("%d", 8 - pad),
-                                 sprintf("%d", 8 - pad), "square");
-
+       pad_mm(pad_off(pad),
+              -pad_y_off,
+              pad_width,
+              pad_height,
+              sprintf("%d", 8 - pad),
+              sprintf("%d", 8 - pad));
 }
 
 rect(-package_width/2, -package_height/2, package_width, package_height);
index b56cfeab505a2ee3088c5438ebdc6fa459aab154..190221f0c88a855e669e342e72c5955c9b51e20d 100644 (file)
@@ -48,17 +48,6 @@ pad_mm(pad_x_space * 2, -pad_y_space,
        pad_width, pad_height,
        "4", "4");
 
-real pads_width = 3 * pad_width + 2 * pad_gap;
-real pads_height = 2 * pad_height + pad_gap;
-
-real extra_x = package_width - pads_width;
-real extra_y = package_height - pads_height;
-
-real package_x = 0 - pad_width / 2 - extra_x / 2;
-real package_y = 0 - pad_gap / 2 - pad_height - extra_y / 2;
-
-rect(package_x, package_y, package_width, package_height);
-
 element_end();
 
 
index a58daad9c91e9935bd1a114d5cf54faa38a07e57..25d4a83ad6ce9adeab45389b7431f8229da5b183 100644 (file)
@@ -73,11 +73,11 @@ void outline() {
 }
 
 void drill(pos_t a) {
-       pin_mm_clear(a.x, a.y, mounting_hole, 0.22, 0.32, "mount", "mount");
+       pin_mm(a.x, a.y, mounting_hole, 0.22, "mount", "mount");
 }
 
 void pin(pos_t a) {
-       pin_mm_clear_options(a.x, a.y, index_pin, 0, 0, "pin", "pin", "hole");
+       pin_mm_options(a.x, a.y, index_pin, 0, "pin", "pin", "hole");
 }
 
 void mount() {
index 90575659ab378d695901ce317d9456541be1220c..9b05b5fb1baddc4d1b23e76de86ce2f7dbe14536 100644 (file)
@@ -72,7 +72,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, package_height/2 - dot_off,
      -package_width/2 + dot_off, package_height/2 - dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* bottom (1-num_pad) */
 
        pad_mm(pad_off(pad),
index c1de55566c31541601755f8c356e770280e177c2..eb827c45b2fefb79994d36cbf6ac3c5681b2df42 100644 (file)
@@ -57,7 +57,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-3) */
 
        real    x, y, w, h;
index 48c12976a76ba14d115e011d8b85dbf3615aa9b2..9a6820d45afa4907791ff7be571cfe679b2fa9ba 100644 (file)
@@ -6,7 +6,7 @@ FOOTPRINTS = \
        lph.fp
 
 .5c.fp:
-       nickle $*.5c > $@
+       nickle $*.5c -o $@
 
 .py.fp:
        python $*.py > $@
index 45e4c55dfbf308057a0db3ecae960ce4fa38e525..810b8e444654155eb432c80fbcbe02400a37a9ff 100644 (file)
@@ -80,10 +80,10 @@ pad_mm (hold_x, hold_y,
        "GND", "GND");
 
 pin_mm (-hole_x, hole_y, hole_diameter,
-       0.17, "GND", "GND");
+       0.18, "GND", "GND");
 
 pin_mm (hole_x, hole_y, hole_diameter,
-       0.17, "GND", "GND");
+       0.18, "GND", "GND");
 
 rect (-outline_x, -outline_y, outline_x * 2, outline_y * 2);
 rect (switch_x, switch_y, switch_width, switch_height);
index 2ec0591ded005575a6a4dfafb8dad8c89ae16e82..c38106a170972cba9bf4d3e74e299dcef760f386 100644 (file)
@@ -54,7 +54,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, package_height/2 - dot_off,
      -package_width/2 + dot_off, package_height/2 - dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-4) */
 
        pad_mm(pad_off(pad),
index 5399ab04805464afea5c2a52378008d017cde1b2..60c5a0d06987897af68483e6f3f2d35b104ef3dd 100644 (file)
@@ -58,7 +58,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-4) */
 
        pad_mm(-pad_x_off,
index 0d595543b943919b58533367013e4a20f8d6fa55..c1b15acf5c2eab7fb1c21111cfc89ae43b2f098c 100644 (file)
@@ -23,7 +23,6 @@ real corner_pad_width = 0.50;
 real pad_height = 0.30;
 real corner_pad_notch = 0.12;
 real pad_spacing = 0.50;
-real pad_clearance = 12 / 1000 * 25.4;
 
 real pad_x_off = 3.20 / 2;
 real pad_y_off = 3.20 / 2;
@@ -58,7 +57,7 @@ real dot_off = .3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        real pw = pad_width;
        real ph = pad_height;
        real pwa = 0;
@@ -84,43 +83,39 @@ for (pad = 0; pad < num_pad; pad++) {
                }
 
                /* left (1-7) */
-               pad_mm_clear(-pad_x_off - pw / 2 - pwa,
-                            pad_off(pad) + pha,
-                            pw,
-                            ph,
-                            pad_clearance,
-                            sprintf("%d", pad + 1),
-                            sprintf("%d", pad + 1));
+               pad_mm(-pad_x_off - pw / 2 - pwa,
+                      pad_off(pad) + pha,
+                      pw,
+                      ph,
+                      sprintf("%d", pad + 1),
+                      sprintf("%d", pad + 1));
 
                /* bottom (8-14) */
 
-               pad_mm_clear(pad_off(pad) + pha,
-                            pad_y_off + pw / 2 + pwa,
-                            ph,
-                            pw,
-                            pad_clearance,
-                            sprintf("%d", pad + 8),
-                            sprintf("%d", pad + 8));
+               pad_mm(pad_off(pad) + pha,
+                      pad_y_off + pw / 2 + pwa,
+                      ph,
+                      pw,
+                      sprintf("%d", pad + 8),
+                      sprintf("%d", pad + 8));
 
                /* right side (15-21) */
 
-               pad_mm_clear(pad_x_off + pw / 2 + pwa,
-                            -pad_off(pad) - pha,
-                            pw,
-                            ph,
-                            pad_clearance,
-                            sprintf("%d", pad + 15),
-                            sprintf("%d", pad + 15));
+               pad_mm(pad_x_off + pw / 2 + pwa,
+                      -pad_off(pad) - pha,
+                      pw,
+                      ph,
+                      sprintf("%d", pad + 15),
+                      sprintf("%d", pad + 15));
 
                /* top (22-28) */
 
-               pad_mm_clear(-pad_off(pad) - pha,
-                            -pad_y_off - pw / 2 - pwa,
-                            ph,
-                            pw,
-                            pad_clearance,
-                            sprintf("%d", pad + 22),
-                            sprintf("%d", pad + 22));
+               pad_mm(-pad_off(pad) - pha,
+                      -pad_y_off - pw / 2 - pwa,
+                      ph,
+                      pw,
+                      sprintf("%d", pad + 22),
+                      sprintf("%d", pad + 22));
        }
 
 }
index 27eac42544df562290ac22071b624d9fe29e59c8..6d20ba08cc7850acca46491e5dfe6c9741820621 100644 (file)
@@ -21,7 +21,6 @@ import Footprint;
 real pad_width = 0.55;
 real pad_height = 0.30;
 real pad_spacing = 0.50;
-real pad_clearance = 12 / 1000 * 25.4; 
 
 real pad_x_off = 6.20 / 2;
 real pad_y_off = 6.20 / 2;
@@ -59,47 +58,42 @@ real dot_off = .3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-12) */
 
-       pad_mm_clear(-pad_x_off - pad_width / 2,
-                    pad_off(pad),
-                    pad_width,
-                    pad_height,
-                    pad_clearance,
-                    sprintf("%d", pad + 1),
-                    sprintf("%d", pad + 1));
-       
+       pad_mm(-pad_x_off - pad_width / 2,
+              pad_off(pad),
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 1),
+              sprintf("%d", pad + 1));
+
        /* bottom (13-24) */
 
-       pad_mm_clear(pad_off(pad),
-                    pad_y_off + pad_width / 2,
-                    pad_height,
-                    pad_width,
-                    pad_clearance,
-                    sprintf("%d", pad + 13),
-                    sprintf("%d", pad + 13));
-       
+       pad_mm(pad_off(pad),
+              pad_y_off + pad_width / 2,
+              pad_height,
+              pad_width,
+              sprintf("%d", pad + 13),
+              sprintf("%d", pad + 13));
+
        /* right side (25-36) */
 
-       pad_mm_clear(pad_x_off + pad_width / 2,
-                    -pad_off(pad),
-                    pad_width,
-                    pad_height,
-                    pad_clearance,
-                    sprintf("%d", pad + 25),
-                    sprintf("%d", pad + 25));
-       
+       pad_mm(pad_x_off + pad_width / 2,
+              -pad_off(pad),
+              pad_width,
+              pad_height,
+              sprintf("%d", pad + 25),
+              sprintf("%d", pad + 25));
+
        /* top (37-48) */
 
-       pad_mm_clear(-pad_off(pad),
-                    -pad_y_off - pad_width / 2,
-                    pad_height,
-                    pad_width,
-                    pad_clearance,
-                    sprintf("%d", pad + 37),
-                    sprintf("%d", pad + 37));
-       
+       pad_mm(-pad_off(pad),
+              -pad_y_off - pad_width / 2,
+              pad_height,
+              pad_width,
+              sprintf("%d", pad + 37),
+              sprintf("%d", pad + 37));
 }
 
 int pad_blocks = 3;
@@ -114,30 +108,27 @@ bool via_block(int x, int y) {
        return (x & 1) == 0 && (y & 1) == 0;
 }
 
-real via_hole = 15/1000 * 25.4;                /* 15 mil drill */
-real via_copper = 7/1000 * 25.4;       /* 7 mil anulus */
+real via_hole = mils1002mm(1300);
+real via_copper = mils1002mm(700);
 
 for (int pad_y = 0; pad_y < pad_blocks; pad_y++) {
        for (int pad_x = 0; pad_x < pad_blocks; pad_x++)
                if (via_block(pad_x, pad_y)) {
-                       pin_mm_clear_mask(block_x(pad_x), block_y(pad_y),
-                                         via_hole, via_hole + 2 * via_copper, pad_clearance, 0,
-                                         "GND", "GND");
-                       pad_mm_clear_mask_options(block_x(pad_x), block_y(pad_y),
-                                                 block_width, block_height,
-                                                 pad_clearance, 0,
-                                                 "GND", "GND","square,nopaste");
+                       pin_mm_space_options(block_x(pad_x), block_y(pad_y),
+                                            via_hole, via_copper, 0,
+                                            "GND", "GND", "via");
+                       pad_mm_options(block_x(pad_x), block_y(pad_y),
+                                      block_width, block_height,
+                                      "GND", "GND","square,nopaste");
                } else {
                        /* full square of metal */
-                       pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
-                                            block_width, block_height,
-                                            0,
-                                            "GND", "GND","square,nopaste");
+                       pad_mm_options(block_x(pad_x), block_y(pad_y),
+                                      block_width, block_height,
+                                      "GND", "GND","square,nopaste");
                        /* 1/4 full of solder paste */
-                       pad_mm_clear_options(block_x(pad_x), block_y(pad_y),
-                                            block_width/2, block_height/2,
-                                            0,
-                                            "GND", "GND","square");
+                       pad_mm_options(block_x(pad_x), block_y(pad_y),
+                                      block_width/2, block_height/2,
+                                      "GND", "GND","square");
                }
 }
 
index ddd163e0152ca2324b7d06c0e751011eeb585347..27ed38e70b61ee7070dd718d8169da1d5a007f75 100644 (file)
@@ -55,7 +55,7 @@ real dot_off = -.3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-4) */
 
        pad_mm(-pad_x_off,
index 00547d73a99886bc1e2cee4ab6b134aab75b7502..84b906eb1ba8953659fe065ab245b26f751ca6ff 100644 (file)
@@ -27,7 +27,6 @@ real pin_drill = 2.2;
 real pin_y = 5.1;
 real pin_x = 5.9;
 real pin_copper = 0.2;
-real pin_clear = 0.01 * 2.0 * 25.4;
 
 real gnd_width = 8.0;
 real gnd_height = 3.5;
@@ -39,11 +38,11 @@ element_start("v-bite");
 
 pad_mm_options(gnd_width / 2, -pin_y, gnd_width, gnd_height, "GND", "2", "square,nopaste");
 pad_mm_options(gnd_width / 2, -pin_y, gnd_width, gnd_height, "GND", "2", "onsolder,square,nopaste");
-pin_mm_clear(gnd_width - pin_x, -pin_y, pin_drill, pin_copper, pin_clear, "GND", "2");
+pin_mm_space_options(gnd_width - pin_x, -pin_y, pin_drill, pin_copper, 0, "GND", "2", "via");
 
 pad_mm_options(gnd_width / 2, pin_y, gnd_width, gnd_height, "GND", "2", "square,nopaste");
 pad_mm_options(gnd_width / 2, pin_y, gnd_width, gnd_height, "GND", "2", "onsolder,square,nopaste");
-pin_mm_clear(gnd_width -pin_x, pin_y, pin_drill, pin_copper, pin_clear, "GND", "2");
+pin_mm_space_options(gnd_width -pin_x, pin_y, pin_drill, pin_copper, 0, "GND", "2", "via");
 
 pad_mm_options(center_width / 2, 0, center_width, center_height,"1", "1", "square,nopaste");
 
index 26674698948968af841506449dd9cc815d80c75e..15ed8da47ce859a22f5746310cf523f4ec8e6494 100644 (file)
@@ -57,7 +57,7 @@ real dot_off = .3;
 line(-package_width/2 + dot_off, -package_height/2 + dot_off,
      -package_width/2 + dot_off, -package_height/2 + dot_off);
 
-for (pad = 0; pad < num_pad; pad++) {
+for (int pad = 0; pad < num_pad; pad++) {
        /* left side (1-4) */
 
        pad_mm(-pad_x_off - pad_width,
@@ -66,7 +66,7 @@ for (pad = 0; pad < num_pad; pad++) {
               pad_height,
               sprintf("%d", pad + 1),
               sprintf("%d", pad + 1));
-       
+
        /* right side (5-8) */
 
        pad_mm(pad_x_off + pad_width,
@@ -75,9 +75,9 @@ for (pad = 0; pad < num_pad; pad++) {
               pad_height,
               sprintf("%d", pad + 5),
               sprintf("%d", pad + 5));
-       
+
 }
 
-pad_mm(0, 0, center_width, center_height, "GND", "GND");
+pad_mm_partial(0, 0, center_width, center_height, 0.63, "GND");
 
 element_end();