1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2025-04-21 12:27:27 +03:00

Holes can now also be output as KiCad modules.

- gui_style.c (gc_rim): slightly increased brightness when inactive
- kicad.c (kicad_pad): move coordinate transform to new function kicad_centric
- kicad.c: added pads with holes and mechanical holes
- inst.h (struct inst.u.hole), inst.c (inst_hole): added "layers" field, like 
  for pads
- layer.c (LAYER_COPPER, LAYER_PASTE, LAYER_MASK): renamed to LAYER_*_TOP and
  added macros for corresponding bottom layers
- layer.c (refine_layers): mirror top layers of through-hole pads
- layer.h, layer.c (mech_hole_layers): return the layer set for mechanical 
  layers



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5941 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner
2010-04-25 15:27:27 +00:00
parent 6db067a90f
commit e047cc074d
6 changed files with 133 additions and 31 deletions

63
layer.c
View File

@@ -1,8 +1,8 @@
/*
* layer.c - PCB layers on a pad
*
* Written 2009 by Werner Almesberger
* Copyright 2009 by Werner Almesberger
* Written 2009, 2010 by Werner Almesberger
* Copyright 2009, 2010 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
@@ -30,9 +30,12 @@
* Shorthands for the layers we use in a general sense.
*/
#define LAYER_COPPER (1 << layer_top)
#define LAYER_PASTE (1 << layer_paste_top)
#define LAYER_MASK (1 << layer_mask_top)
#define LAYER_COPPER_TOP (1 << layer_top)
#define LAYER_PASTE_TOP (1 << layer_paste_top)
#define LAYER_MASK_TOP (1 << layer_mask_top)
#define LAYER_COPPER_BOTTOM (1 << layer_bottom)
#define LAYER_PASTE_BOTTOM (1 << layer_paste_bottom)
#define LAYER_MASK_BOTTOM (1 << layer_mask_bottom)
/* ----- Conversion between pad types and layer sets ----------------------- */
@@ -44,16 +47,16 @@ layer_type pad_type_to_layers(enum pad_type type)
switch (type) {
case pt_normal:
layers = LAYER_PASTE;
layers = LAYER_PASTE_TOP;
/* fall through */
case pt_bare:
layers |= LAYER_COPPER | LAYER_MASK;
layers |= LAYER_COPPER_TOP | LAYER_MASK_TOP;
break;
case pt_paste:
layers = LAYER_PASTE;
layers = LAYER_PASTE_TOP;
break;
case pt_mask:
layers = LAYER_MASK;
layers = LAYER_MASK_TOP;
break;
default:
abort();
@@ -64,27 +67,37 @@ layer_type pad_type_to_layers(enum pad_type type)
enum pad_type layers_to_pad_type(layer_type layers)
{
if (layers & LAYER_COPPER) {
if (layers & LAYER_PASTE)
if (layers & LAYER_COPPER_TOP) {
if (layers & LAYER_PASTE_TOP)
return pt_normal;
return pt_bare;
} else {
if (layers & LAYER_PASTE)
if (layers & LAYER_PASTE_TOP)
return pt_paste;
if (layers & LAYER_MASK)
if (layers & LAYER_MASK_TOP)
return pt_mask;
abort();
}
}
/* ----- layers in mechanical holes ---------------------------------------- */
layer_type mech_hole_layers(void)
{
return LAYER_PASTE_TOP | LAYER_PASTE_BOTTOM |
LAYER_MASK_TOP | LAYER_MASK_BOTTOM;
}
/* ----- Refine layers after instantiation --------------------------------- */
static int refine_overlapping(struct inst *copper, struct inst *other)
{
if (other->u.pad.layers & LAYER_PASTE) {
copper->u.pad.layers &= ~LAYER_PASTE;
if (other->u.pad.layers & LAYER_PASTE_TOP) {
copper->u.pad.layers &= ~LAYER_PASTE_TOP;
if (!inside(other, copper)) {
fail("solder paste without copper underneath "
"(\"%s\" line %d, \"%s\" line %d)",
@@ -94,8 +107,8 @@ static int refine_overlapping(struct inst *copper, struct inst *other)
return 0;
}
}
if (other->u.pad.layers & LAYER_MASK)
copper->u.pad.layers &= ~LAYER_MASK;
if (other->u.pad.layers & LAYER_MASK_TOP)
copper->u.pad.layers &= ~LAYER_MASK_TOP;
return 1;
}
@@ -131,6 +144,17 @@ static int refine_copper(const struct pkg *pkg_copper, struct inst *copper)
}
static void mirror_layers(layer_type *layers)
{
if (*layers & LAYER_COPPER_TOP)
*layers |= LAYER_COPPER_BOTTOM;
if (*layers & LAYER_PASTE_TOP)
*layers |= LAYER_PASTE_BOTTOM;
if (*layers & LAYER_MASK_TOP)
*layers |= LAYER_MASK_BOTTOM;
}
int refine_layers(void)
{
const struct pkg *pkg;
@@ -138,8 +162,11 @@ int refine_layers(void)
for (pkg = pkgs; pkg; pkg = pkg->next)
for (copper = pkg->insts[ip_pad_copper]; copper;
copper = copper->next)
copper = copper->next) {
if (!refine_copper(pkg, copper))
return 0;
if (copper->u.pad.hole)
mirror_layers(&copper->u.pad.layers);
}
return 1;
}