r5554 - trunk/eda/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Thu Aug 27 11:45:57 CEST 2009
Author: werner
Date: 2009-08-27 11:45:57 +0200 (Thu, 27 Aug 2009)
New Revision: 5554
Modified:
trunk/eda/fped/README
trunk/eda/fped/dump.c
trunk/eda/fped/fpd.y
trunk/eda/fped/kicad.c
trunk/eda/fped/obj.h
trunk/eda/fped/postscript.c
Log:
- added pad type (for non-solder and solder-paste-only pads) to FPD language
(GUI is still missing)
Modified: trunk/eda/fped/README
===================================================================
--- trunk/eda/fped/README 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/README 2009-08-27 09:45:57 UTC (rev 5554)
@@ -208,7 +208,7 @@
Pads are similar to rectangles, but they also have a name.
-pad "<name>" <point-a> <point-b>
+pad "<name>" <point-a> <point-b> [<type>]
Variables can be expanded in a pad's name by prefixing their name with
a dollar sign. The ${name} syntax is also available.
@@ -218,7 +218,17 @@
vec @(1mm, 1mm)
pad "1" @ .
+Pads normally affect the surface copper layer, the solder mask layer,
+and the solder paste layer. This can be modified with the optional
+type argument:
+Type Layers
+--------- -------------------------------------
+(default) copper, solder mask, and solder paste
+bare copper and solder mask
+paste solder paste
+
+
Rounded pads
- - - - - -
@@ -226,7 +236,7 @@
semi-circle at each of the smaller sides of the enclosing rectangle.
If enclosed in a square, rounded pads form a circle.
-rpad "<name>" <point-a> <point-b>
+rpad "<name>" <point-a> <point-b> [<type>]
Measurements
Modified: trunk/eda/fped/dump.c
===================================================================
--- trunk/eda/fped/dump.c 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/dump.c 2009-08-27 09:45:57 UTC (rev 5554)
@@ -318,8 +318,22 @@
break;
case ot_pad:
s1 = obj_base_name(obj->u.pad.other, prev);
- s = stralloc_printf("%spad \"%s\" %s %s",
- obj->u.pad.rounded ? "r" : "", obj->u.pad.name, base, s1);
+ switch (obj->u.pad.type) {
+ case pt_normal:
+ s2 = "";
+ break;
+ case pt_bare:
+ s2 = " bare";
+ break;
+ case pt_paste:
+ s2 = " paste";
+ break;
+ default:
+ abort();
+ }
+ s = stralloc_printf("%spad \"%s\" %s %s%s",
+ obj->u.pad.rounded ? "r" : "",
+ obj->u.pad.name, base, s1, s2);
free(s1);
break;
case ot_arc:
Modified: trunk/eda/fped/fpd.y
===================================================================
--- trunk/eda/fped/fpd.y 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/fpd.y 2009-08-27 09:45:57 UTC (rev 5554)
@@ -13,6 +13,7 @@
#include <stdlib.h>
+#include <string.h>
#include "util.h"
#include "error.h"
@@ -146,6 +147,7 @@
struct value *value;
struct vec *vec;
struct obj *obj;
+ enum pad_type pt;
enum meas_type mt;
struct {
int inverted;
@@ -172,6 +174,7 @@
%type <obj> obj meas
%type <expr> expr opt_expr add_expr mult_expr unary_expr primary_expr
%type <str> opt_string
+%type <pt> pad_type
%type <mt> meas_type
%type <mo> meas_op
@@ -441,21 +444,23 @@
;
obj:
- TOK_PAD STRING base base
+ TOK_PAD STRING base base pad_type
{
$$ = new_obj(ot_pad);
$$->base = $3;
$$->u.pad.name = $2;
$$->u.pad.other = $4;
$$->u.pad.rounded = 0;
+ $$->u.pad.type = $5;
}
- | TOK_RPAD STRING base base
+ | TOK_RPAD STRING base base pad_type
{
$$ = new_obj(ot_pad);
$$->base = $3;
$$->u.pad.name = $2;
$$->u.pad.other = $4;
$$->u.pad.rounded = 1;
+ $$->u.pad.type = $5;
}
| TOK_RECT base base opt_expr
{
@@ -506,6 +511,18 @@
}
;
+pad_type:
+ ID
+ {
+ if (!strcmp($1, "bare"))
+ $$ = pt_bare;
+ else if (!strcmp($1, "paste"))
+ $$ = pt_paste;
+ else
+ $$ = pt_normal;
+ }
+ ;
+
measurements:
| measurements meas
{
Modified: trunk/eda/fped/kicad.c
===================================================================
--- trunk/eda/fped/kicad.c 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/kicad.c 2009-08-27 09:45:57 UTC (rev 5554)
@@ -56,6 +56,7 @@
{
struct coord min, max;
unit_type tmp;
+ int layers;
min.x = units_to_kicad(inst->base.x);
min.y = units_to_kicad(inst->base.y);
@@ -85,10 +86,21 @@
/*
* Attributes: pad type, N, layer mask
*/
- fprintf(file, "At SMD N %8.8X\n",
- (1 << layer_top) |
- (1 << layer_paste_top) |
- (1 << layer_mask_top));
+ layers = 0;
+ switch (inst->obj->u.pad.type) {
+ case pt_normal:
+ layers = 1 << layer_paste_top;
+ /* fall through */
+ case pt_bare:
+ layers |= (1 << layer_top) | (1 << layer_mask_top);
+ break;
+ case pt_paste:
+ layers = 1 << layer_paste_top;
+ break;
+ default:
+ abort();
+ }
+ fprintf(file, "At SMD N %8.8X\n", layers);
/*
* Position: Xpos, Ypos
Modified: trunk/eda/fped/obj.h
===================================================================
--- trunk/eda/fped/obj.h 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/obj.h 2009-08-27 09:45:57 UTC (rev 5554)
@@ -139,6 +139,12 @@
ot_meas,
};
+enum pad_type {
+ pt_normal, /* copper and solder mask */
+ pt_bare, /* only copper (and finish) */
+ pt_paste, /* only solder paste */
+};
+
struct frame_ref {
struct frame *ref;
int lineno;
@@ -153,6 +159,7 @@
char *name;
struct vec *other; /* NULL if frame origin */
int rounded;
+ enum pad_type type;
};
struct arc {
Modified: trunk/eda/fped/postscript.c
===================================================================
--- trunk/eda/fped/postscript.c 2009-08-27 09:30:59 UTC (rev 5553)
+++ trunk/eda/fped/postscript.c 2009-08-27 09:45:57 UTC (rev 5554)
@@ -172,7 +172,21 @@
inst->u.pad.name, PS_FONT_OUTLINE);
}
+static const char *hatch(enum pad_type type)
+{
+ switch (type) {
+ case pt_normal:
+ return "crosspath";
+ case pt_bare:
+ return "hatchpath";
+ case pt_paste:
+ return "backhatchpath";
+ default:
+ abort();
+ }
+}
+
static void ps_pad(FILE *file, const struct inst *inst, int show_name)
{
struct coord a = inst->base;
@@ -183,7 +197,8 @@
fprintf(file, " %d %d lineto\n", b.x, a.y);
fprintf(file, " %d %d lineto\n", b.x, b.y);
fprintf(file, " %d %d lineto\n", a.x, b.y);
- fprintf(file, " closepath gsave crosspath grestore stroke\n");
+ fprintf(file, " closepath gsave %s grestore stroke\n",
+ hatch(inst->obj->u.pad.type));
if (show_name)
ps_pad_name(file, inst);
@@ -213,7 +228,8 @@
fprintf(file, " %d %d lineto\n", a.x+r, b.y);
fprintf(file, " %d %d %d 90 270 arc\n", a.x+r, a.y+r, r);
}
- fprintf(file, " closepath gsave hatchpath grestore stroke\n");
+ fprintf(file, " closepath gsave %s grestore stroke\n",
+ hatch(inst->obj->u.pad.type));
if (show_name)
ps_pad_name(file, inst);
More information about the commitlog
mailing list