1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 13:51:53 +02:00

- added pad type (for non-solder and solder-paste-only pads) to FPD language

(GUI is still missing)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5554 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-27 09:45:57 +00:00
parent c37648e2a5
commit 8d94993c45
6 changed files with 88 additions and 12 deletions

14
README
View File

@ -208,7 +208,7 @@ Pads
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,6 +218,16 @@ Example:
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 @@ Rounded pads are like rectangular pads except that they end with a
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

18
dump.c
View File

@ -318,8 +318,22 @@ char *print_obj(const struct obj *obj, const struct vec *prev)
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:

21
fpd.y
View File

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "error.h"
@ -146,6 +147,7 @@ static struct obj *new_obj(enum obj_type type)
struct value *value;
struct vec *vec;
struct obj *obj;
enum pad_type pt;
enum meas_type mt;
struct {
int inverted;
@ -172,6 +174,7 @@ static struct obj *new_obj(enum obj_type type)
%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 @@ base:
;
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 @@ obj:
}
;
pad_type:
ID
{
if (!strcmp($1, "bare"))
$$ = pt_bare;
else if (!strcmp($1, "paste"))
$$ = pt_paste;
else
$$ = pt_normal;
}
;
measurements:
| measurements meas
{

20
kicad.c
View File

@ -56,6 +56,7 @@ static void kicad_pad(FILE *file, const struct inst *inst)
{
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 @@ static void kicad_pad(FILE *file, const struct inst *inst)
/*
* 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

7
obj.h
View File

@ -139,6 +139,12 @@ enum obj_type {
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 @@ struct pad {
char *name;
struct vec *other; /* NULL if frame origin */
int rounded;
enum pad_type type;
};
struct arc {

View File

@ -172,6 +172,20 @@ static void ps_pad_name(FILE *file, const struct inst *inst)
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)
{
@ -183,7 +197,8 @@ static void ps_pad(FILE *file, const struct inst *inst, int show_name)
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 @@ static void ps_rpad(FILE *file, const struct inst *inst, int show_name)
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);