/* "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();
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),
pad_height,
sprintf("%d", pad + 1),
sprintf("%d", pad + 1));
-
+
/* top side (5-8) */
pad_mm(-pad_off(pad),
pad_height,
sprintf("%d", pad + 5),
sprintf("%d", pad + 5));
-
}
pad_mm(0, 0, center_width, center_height, "GND", "GND");
servo-motor.fp
.5c.fp:
- nickle $*.5c > $@
+ nickle $*.5c -o $@
.py.fp:
python $*.py > $@
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;
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();
0603-sideled.fp
.5c.fp:
- nickle $*.5c > $@
+ nickle $*.5c -o $@
.py.fp:
python $*.py > $@
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,
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,
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,
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)
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(¢er.via_drill))
+ center.via_drill = process_drill;
+
+ if (is_uninit(¢er.via_copper))
+ center.via_copper = process_ring;
+
+ if (is_uninit(¢er.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(¢er.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",
+ });
+ }
+ }
}
}
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");
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) {
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;
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;
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,
/* 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 */
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);
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)
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++)
./50milpitch.py 5 > $@
2mm2pin.fp: 2mmpitch.5c
- nickle 2mmpitch.5c 2 > $@
+ nickle 2mmpitch.5c -o $@ 2
clean:
rm -f $(FOOTPRINTS)
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();
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;
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;
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);
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;
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;
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);
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();
}
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() {
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),
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;
lph.fp
.5c.fp:
- nickle $*.5c > $@
+ nickle $*.5c -o $@
.py.fp:
python $*.py > $@
"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);
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),
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,
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;
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;
}
/* 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));
}
}
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;
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;
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");
}
}
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,
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;
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");
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,
pad_height,
sprintf("%d", pad + 1),
sprintf("%d", pad + 1));
-
+
/* right side (5-8) */
pad_mm(pad_x_off + pad_width,
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();