Skip to content

Commit

Permalink
Added a new pad type: trace pads, for antennas and other trace-like e…
Browse files Browse the repository at this point in the history
…lements.

- layer.h (enum pad_type): added pad type pt_trace
- layer.c (pad_type_to_layers, layers_to_pad_type), inst.c (inst_pad):
  "trace" pad instantition and conversion infrastructure
- fpd.y (pad_type), dump.c (print_obj): .fpd file I/O for "trace" pads
- postscript.c (prologue): added Postscript function "horpath" to produce
  horizontal stripes
- postscript.c (hatch): show "trace" pads with horizontal stripes
- gui_style.h (gc_pad_trace), gui_style.c (gc_pad_trace, gui_setup_style),
  gui_inst.c (pad_gc): added visualization of "trace" pads
- gui_status.c (show_pad_type): added "trace" pad type
- README: added description of "trace" pads
- README: added usage examples for the various pad types
  • Loading branch information
Werner Almesberger committed Jan 18, 2011
1 parent 3088228 commit 5387f41
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 24 deletions.
8 changes: 8 additions & 0 deletions eda/fped/README
Expand Up @@ -270,9 +270,17 @@ Type Layers
--------- -------------------------------------
(default) copper, solder mask, and solder paste
bare copper and solder mask
trace copper without solder mask opening
paste solder paste
mask solder mask

Typical uses:
- "bare": connectors printed directly on the PCB
- "trace": connections or antennas
- "paste": sparse solder paste, e.g., for QFN center pads
- "mask": non-standard mask openings, e.g., for solder mask defined
pads


Rounded pads
- - - - - -
Expand Down
7 changes: 5 additions & 2 deletions eda/fped/dump.c
@@ -1,8 +1,8 @@
/*
* dump.c - Dump objects in the native FPD format
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -345,6 +345,9 @@ char *print_obj(const struct obj *obj, const struct vec *prev)
case pt_bare:
s2 = " bare";
break;
case pt_trace:
s2 = " trace";
break;
case pt_paste:
s2 = " paste";
break;
Expand Down
6 changes: 4 additions & 2 deletions eda/fped/fpd.y
Expand Up @@ -2,8 +2,8 @@
/*
* fpd.y - FootPrint Definition language
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -986,6 +986,8 @@ pad_type:
{
if (!strcmp($1, "bare"))
$$ = pt_bare;
else if (!strcmp($1, "trace"))
$$ = pt_trace;
else if (!strcmp($1, "paste"))
$$ = pt_paste;
else if (!strcmp($1, "mask"))
Expand Down
6 changes: 4 additions & 2 deletions eda/fped/gui_inst.c
@@ -1,8 +1,8 @@
/*
* gui_inst.c - GUI, instance functions
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -319,6 +319,8 @@ static GdkGC *pad_gc(const struct inst *inst, int *fill)
switch (layers_to_pad_type(inst->u.pad.layers)) {
case pt_bare:
return gc_pad_bare[get_mode(inst)];
case pt_trace:
return gc_pad_trace[get_mode(inst)];
case pt_mask:
*fill = FALSE;
return gc_pad_mask[get_mode(inst)];
Expand Down
7 changes: 5 additions & 2 deletions eda/fped/gui_status.c
@@ -1,8 +1,8 @@
/*
* gui_status.c - GUI, status area
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -204,6 +204,9 @@ static void show_pad_type(void)
case pt_bare:
s = "bare";
break;
case pt_trace:
s = "trace";
break;
case pt_paste:
s = "paste";
break;
Expand Down
9 changes: 6 additions & 3 deletions eda/fped/gui_style.c
@@ -1,7 +1,8 @@
/* * gui_style.c - GUI, style definitions
/*
* gui_style.c - GUI, style definitions
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -26,6 +27,7 @@ GdkGC *gc_vec[mode_n];
GdkGC *gc_obj[mode_n];
GdkGC *gc_pad[mode_n];
GdkGC *gc_pad_bare[mode_n];
GdkGC *gc_pad_trace[mode_n];
GdkGC *gc_pad_mask[mode_n];
GdkGC *gc_ptext[mode_n];
GdkGC *gc_rim[mode_n];
Expand Down Expand Up @@ -68,6 +70,7 @@ void gui_setup_style(GdkDrawable *drawable)
style(gc_obj, "#006060", "#00ffff", "#ffff80", 1);
style(gc_pad, "#400000", "#ff0000", "#ffff80", 1);
style(gc_pad_bare, "#402000", "#ff6000", "#ffff80", 1);
style(gc_pad_trace, "#304000", "#80c000", "#ffff80", 1);
style(gc_pad_mask, "#000040", "#0000ff", "#ffff80", 2);
style(gc_ptext, "#404040", "#ffffff", "#ffffff", 1);
style(gc_hole, "#000000", "#000000", "#000000", 0);
Expand Down
5 changes: 3 additions & 2 deletions eda/fped/gui_style.h
@@ -1,8 +1,8 @@
/*
* gui_style.h - GUI, style definitions
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -114,6 +114,7 @@ extern GdkGC *gc_vec[mode_n];
extern GdkGC *gc_obj[mode_n];
extern GdkGC *gc_pad[mode_n];
extern GdkGC *gc_pad_bare[mode_n];
extern GdkGC *gc_pad_trace[mode_n];
extern GdkGC *gc_pad_mask[mode_n];
extern GdkGC *gc_ptext[mode_n];
extern GdkGC *gc_rim[mode_n];
Expand Down
7 changes: 4 additions & 3 deletions eda/fped/inst.c
@@ -1,8 +1,8 @@
/*
* inst.c - Instance structures
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -896,7 +896,8 @@ int inst_pad(struct obj *obj, const char *name, struct coord a, struct coord b)
struct inst *inst;

inst = add_inst(obj->u.pad.rounded ? &rpad_ops : &pad_ops,
obj->u.pad.type == pt_normal || obj->u.pad.type == pt_bare ?
obj->u.pad.type == pt_normal || obj->u.pad.type == pt_bare ||
obj->u.pad.type == pt_trace ?
ip_pad_copper : ip_pad_special, a);
inst->obj = obj;
inst->u.pad.name = stralloc(name);
Expand Down
11 changes: 8 additions & 3 deletions eda/fped/layer.c
@@ -1,8 +1,8 @@
/*
* layer.c - PCB layers on a pad
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -52,6 +52,9 @@ layer_type pad_type_to_layers(enum pad_type type)
case pt_bare:
layers |= LAYER_COPPER_TOP | LAYER_MASK_TOP;
break;
case pt_trace:
layers |= LAYER_COPPER_TOP;
break;
case pt_paste:
layers = LAYER_PASTE_TOP;
break;
Expand All @@ -70,7 +73,9 @@ enum pad_type layers_to_pad_type(layer_type layers)
if (layers & LAYER_COPPER_TOP) {
if (layers & LAYER_PASTE_TOP)
return pt_normal;
return pt_bare;
if (layers & LAYER_MASK_TOP)
return pt_bare;
return pt_trace;
} else {
if (layers & LAYER_PASTE_TOP)
return pt_paste;
Expand Down
5 changes: 3 additions & 2 deletions eda/fped/layer.h
@@ -1,8 +1,8 @@
/*
* layer.h - PCB layers on a pad
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -57,6 +57,7 @@ enum kicad_layer {
enum pad_type {
pt_normal, /* copper and solder mask */
pt_bare, /* only copper (and finish) */
pt_trace, /* only copper, without solder mask opening */
pt_paste, /* only solder paste */
pt_mask, /* only solder mask */
pt_n
Expand Down
20 changes: 17 additions & 3 deletions eda/fped/postscript.c
@@ -1,8 +1,8 @@
/*
* postscript.c - Dump objects in Postscript
*
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 by Werner Almesberger
* Written 2009-2011 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -64,6 +64,8 @@
#define PS_HATCH mm_to_units(0.1)
#define PS_HATCH_LINE mm_to_units(0.015)

#define PS_STRIPE mm_to_units(0.08)

#define PS_RIM_LINE mm_to_units(0.02)

#define PS_FONT_OUTLINE mm_to_units(0.025)
Expand Down Expand Up @@ -223,6 +225,8 @@ static const char *hatch(layer_type layers)
return "backhatchpath";
case pt_mask:
return "dotpath";
case pt_trace:
return "horpath";
default:
abort();
}
Expand Down Expand Up @@ -940,7 +944,7 @@ static void prologue(FILE *file, int pages)
"/backhatchpath {\n"
" gsave flattenpath pathbbox clip newpath\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" 0 %d ury lly sub urx llx sub add {\n" /* for 0 to urx-llx_ury-lly */
" 0 %d ury lly sub urx llx sub add {\n" /* for 0 to urx-llx+ury-lly */
" llx add dup lly moveto\n"
" ury lly sub sub ury lineto stroke\n"
" } for\n"
Expand All @@ -950,6 +954,16 @@ fprintf(file,
"/crosspath {\n"
" gsave hatchpath grestore backhatchpath } def\n");

fprintf(file,
"/horpath {\n"
" gsave flattenpath pathbbox clip newpath\n"
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
" lly %d ury {\n" /* for lly to ury */
" dup llx exch moveto\n"
" urx exch lineto stroke\n"
" } for\n"
" grestore newpath } def\n", PS_STRIPE);

/*
* Stack: font string width height factor -> factor
*
Expand Down

0 comments on commit 5387f41

Please sign in to comment.