From 49a1bbdd0525c12d09a365cc36998d52c0ee46ba Mon Sep 17 00:00:00 2001 From: werner Date: Tue, 18 Jan 2011 00:30:57 +0000 Subject: [PATCH] Added a new pad type: trace pads, for antennas and other trace-like elements. - 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 git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5998 99fdad57-331a-0410-800a-d7fa5415bdb3 --- README | 8 ++++++++ dump.c | 7 +++++-- fpd.y | 6 ++++-- gui_inst.c | 6 ++++-- gui_status.c | 7 +++++-- gui_style.c | 9 ++++++--- gui_style.h | 5 +++-- inst.c | 7 ++++--- layer.c | 11 ++++++++--- layer.h | 5 +++-- postscript.c | 20 +++++++++++++++++--- 11 files changed, 67 insertions(+), 24 deletions(-) diff --git a/README b/README index c2ef8a1..e9604e8 100644 --- a/README +++ b/README @@ -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 - - - - - - diff --git a/dump.c b/dump.c index 4aa0eb0..f612b76 100644 --- a/dump.c +++ b/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 @@ -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; diff --git a/fpd.y b/fpd.y index 9f5b5ac..2706dbf 100644 --- a/fpd.y +++ b/fpd.y @@ -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 @@ -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")) diff --git a/gui_inst.c b/gui_inst.c index 591af55..158f54a 100644 --- a/gui_inst.c +++ b/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 @@ -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)]; diff --git a/gui_status.c b/gui_status.c index 6fc7ef6..d10a76c 100644 --- a/gui_status.c +++ b/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 @@ -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; diff --git a/gui_style.c b/gui_style.c index 33a45b9..2ebe96a 100644 --- a/gui_style.c +++ b/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 @@ -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]; @@ -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); diff --git a/gui_style.h b/gui_style.h index 604d734..04e2cc9 100644 --- a/gui_style.h +++ b/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 @@ -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]; diff --git a/inst.c b/inst.c index 2a57845..e3f1e63 100644 --- a/inst.c +++ b/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 @@ -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); diff --git a/layer.c b/layer.c index e2716de..c03f4fc 100644 --- a/layer.c +++ b/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 @@ -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; @@ -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; diff --git a/layer.h b/layer.h index 1a1b276..873e99c 100644 --- a/layer.h +++ b/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 @@ -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 diff --git a/postscript.c b/postscript.c index eff4c9e..d059339 100644 --- a/postscript.c +++ b/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 @@ -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) @@ -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(); } @@ -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" @@ -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 *