00001
00025 #include "register_functions.c"
00026 #include "indc.h"
00027
00028
00035 int
00036 indc_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gdouble dx;
00045 gint pin_number;
00046 gchar *pin_pad_name = g_strdup ("");
00047 FlagType pad_flag;
00048 ElementTypePtr element;
00049
00050 if (!element)
00051 {
00052 if (verbose)
00053 g_log ("", G_LOG_LEVEL_WARNING,
00054 _("could not create a valid element pointer for a %s package."),
00055 footprint_type);
00056 return (EXIT_FAILURE);
00057 }
00058
00059
00060 element->MarkX = 0;
00061 element->MarkY = 0;
00062
00063
00064 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00065 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00066 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00067 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00068
00069
00070 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00071 {
00072 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00073 }
00074 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00075 {
00076 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00077 }
00078 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00079 {
00080 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00081 }
00082 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00083 {
00084 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00085 }
00086
00087 if (multiplier * (-courtyard_length / 2.0) < xmin)
00088 {
00089 xmin = multiplier * (-courtyard_length / 2.0);
00090 }
00091 if (multiplier * (courtyard_length / 2.0) > xmax)
00092 {
00093 xmax = multiplier * (courtyard_length / 2.0);
00094 }
00095 if (multiplier * (-courtyard_width / 2.0) < ymin)
00096 {
00097 ymin = multiplier * (-courtyard_width / 2.0);
00098 }
00099 if (multiplier * (courtyard_width / 2.0) > ymax)
00100 {
00101 ymax = multiplier * (courtyard_width / 2.0);
00102 }
00103
00104 element->Name[1].Scale = 100;
00105 element->Name[1].X = 0.0 ;
00106 element->Name[1].Y = (ymin - 10000.0);
00107 element->Name[1].TextString = footprint_name;
00108 element->Name[1].Element = element;
00109 element->Name[1].Direction = EAST;
00110 element->Name[1].ID = ID++;
00111
00112 element->Name[2].Scale = 100;
00113 element->Name[2].X = 0.0 ;
00114 element->Name[2].Y = (ymin - 10000.0);
00115 element->Name[2].TextString = footprint_refdes;
00116 element->Name[2].Element = element;
00117 element->Name[2].Direction = EAST;
00118 element->Name[2].ID = ID++;
00119
00120 element->Name[3].Scale = 100;
00121 element->Name[3].X = 0.0 ;
00122 element->Name[3].Y = (ymin - 10000.0);
00123 element->Name[3].TextString = footprint_value;
00124 element->Name[3].Element = element;
00125 element->Name[3].Direction = EAST;
00126 element->Name[3].ID = ID++;
00127
00128 if (pad_shapes_type == SQUARE)
00129 {
00130 pad_flag.f = SQUARE;
00131 }
00132 else
00133 {
00134 pad_flag.f = CLEAR;
00135 }
00136 if (pad_length > pad_width)
00137 {
00138
00139 create_new_pad
00140 (
00141 element,
00142 (int) (multiplier * ((pitch_x - pad_length + pad_width) / 2.0)),
00143 0,
00144 (int) (multiplier * ((pitch_x + pad_length - pad_width) / 2.0)),
00145 0,
00146 (int) (multiplier * pad_width),
00147 (int) (multiplier * pad_clearance),
00148 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00149 "",
00150 "2",
00151 pad_flag
00152 );
00153
00154 if (pin1_square)
00155 {
00156 pad_flag.f = SQUARE;
00157 }
00158
00159 create_new_pad
00160 (
00161 element,
00162 (int) (multiplier * ((-pitch_x - pad_length + pad_width) / 2.0)),
00163 0,
00164 (int) (multiplier * ((-pitch_x + pad_length - pad_width) / 2.0)),
00165 0,
00166 (int) (multiplier * pad_width),
00167 (int) (multiplier * pad_clearance),
00168 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00169 "",
00170 "1",
00171 pad_flag
00172 );
00173 }
00174 else
00175 {
00176
00177 create_new_pad
00178 (
00179 element,
00180 (int) (multiplier * (pitch_x / 2.0)),
00181 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00182 (int) (multiplier * (pitch_x / 2.0)),
00183 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00184 (int) (multiplier * pad_length),
00185 (int) (multiplier * pad_clearance),
00186 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00187 "",
00188 "2",
00189 pad_flag
00190 );
00191
00192 if (pin1_square)
00193 {
00194 pad_flag.f = SQUARE;
00195 }
00196
00197 create_new_pad
00198 (
00199 element,
00200 (int) (multiplier * (-pitch_x / 2.0)),
00201 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00202 (int) (multiplier * (-pitch_x / 2)),
00203 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00204 (int) (multiplier * pad_length),
00205 (int) (multiplier * pad_clearance),
00206 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00207 "",
00208 "1",
00209 pad_flag
00210 );
00211 }
00212
00213 if (silkscreen_package_outline && (package_body_width))
00214 {
00215 create_new_line
00216 (
00217 element,
00218 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00219 (int) (multiplier * (package_body_width / 2.0)),
00220 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00221 (int) (multiplier * (package_body_width / 2.0)),
00222 (int) (multiplier * silkscreen_line_width)
00223 );
00224 create_new_line
00225 (
00226 element,
00227 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00228 (int) (multiplier * (-package_body_width / 2.0)),
00229 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00230 (int) (multiplier * (-package_body_width / 2.0)),
00231 (int) (multiplier * silkscreen_line_width)
00232 );
00233 }
00234
00235 if (silkscreen_indicate_1)
00236 {
00237
00238 }
00239
00240 if (courtyard)
00241 {
00242 create_new_line
00243 (
00244 element,
00245 (int) (xmin),
00246 (int) (ymin),
00247 (int) (xmin),
00248 (int) (ymax),
00249 (int) (multiplier * courtyard_line_width)
00250 );
00251 create_new_line
00252 (
00253 element,
00254 (int) (xmax),
00255 (int) (ymin),
00256 (int) (xmax),
00257 (int) (ymax),
00258 (int) (multiplier * courtyard_line_width)
00259 );
00260 create_new_line
00261 (
00262 element,
00263 (int) (xmin),
00264 (int) (ymin),
00265 (int) (xmax),
00266 (int) (ymin),
00267 (int) (multiplier * courtyard_line_width)
00268 );
00269 create_new_line
00270 (
00271 element,
00272 (int) (xmax),
00273 (int) (ymax),
00274 (int) (xmin),
00275 (int) (ymax),
00276 (int) (multiplier * courtyard_line_width)
00277 );
00278 }
00279
00280 if (attributes_in_footprint)
00281 {
00282 element = create_attributes_in_element (element);
00283 }
00284
00285 if (verbose)
00286 {
00287 g_log ("", G_LOG_LEVEL_INFO,
00288 _("created an element for a %s package: %s."),
00289 footprint_type,
00290 footprint_filename);
00291 }
00292 current_element = (ElementTypePtr) &element;
00293 return (EXIT_SUCCESS);
00294 }
00295
00296
00306 int
00307 indc_create_packages_list ()
00308 {
00309 g_list_free (packages_list);
00310 packages_list = g_list_append (packages_list, "INDC1005X60N");
00311 packages_list = g_list_append (packages_list, "INDC1608X95N");
00312 packages_list = g_list_append (packages_list, "INDC2520X220N");
00313 packages_list = g_list_append (packages_list, "INDC3225X135N");
00314 packages_list = g_list_append (packages_list, "INDC4509X190N");
00315 packages_list = g_list_append (packages_list, "INDC4532X175N");
00316 packages_list = g_list_append (packages_list, "INDC4648X310N");
00317 packages_list = g_list_append (packages_list, "INDC5750X180N");
00318 packages_list = g_list_append (packages_list, "INDC6350X200N");
00319 return (EXIT_SUCCESS);
00320 }
00321
00322
00352 int
00353 indc_drc ()
00354 {
00355 int result = EXIT_SUCCESS;
00356 if (verbose)
00357 {
00358 g_log ("", G_LOG_LEVEL_INFO,
00359 (_("[%s] DRC Check: checking package %s.")),
00360 footprint_type, footprint_name);
00361 }
00362
00363 if (number_of_pins != 2)
00364 {
00365 if (verbose)
00366 {
00367 g_log ("", G_LOG_LEVEL_WARNING,
00368 (_("[%s] DRC Error: check for number of pins/pads <> 2.")),
00369 footprint_type);
00370 }
00371 result = EXIT_FAILURE;
00372 }
00373
00374 switch (pad_shapes_type)
00375 {
00376 case NO_SHAPE:
00377 {
00378 if (verbose)
00379 {
00380 g_log ("", G_LOG_LEVEL_WARNING,
00381 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00382 footprint_type);
00383 }
00384 result = EXIT_FAILURE;
00385 break;
00386 }
00387 case ROUND:
00388 {
00389 if (verbose)
00390 {
00391 g_log ("", G_LOG_LEVEL_WARNING,
00392 (_("[%s] DRC Error: circular pad shape specified for check for allowed pad shapes.")),
00393 footprint_type);
00394 }
00395 result = EXIT_FAILURE;
00396 break;
00397 }
00398 case SQUARE:
00399 {
00400 break;
00401 }
00402 case OCTAGONAL:
00403 {
00404 if (verbose)
00405 {
00406 g_log ("", G_LOG_LEVEL_WARNING,
00407 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00408 footprint_type);
00409 }
00410 result = EXIT_FAILURE;
00411 break;
00412 }
00413 case ROUND_ELONGATED:
00414 {
00415 break;
00416 }
00417 default:
00418 {
00419 if (verbose)
00420 {
00421 g_log ("", G_LOG_LEVEL_WARNING,
00422 (_("[%s] DRC Error: no valid pad shape type specified.")),
00423 footprint_type);
00424 }
00425 result = EXIT_FAILURE;
00426 break;
00427 }
00428 }
00429
00430 if (package_body_length <= 0.0)
00431 {
00432 if (verbose)
00433 {
00434 g_log ("", G_LOG_LEVEL_WARNING,
00435 (_("[%s] DRC Error: check for package body length is <= 0.0.")),
00436 footprint_type);
00437 }
00438 result = EXIT_FAILURE;
00439 }
00440 if (package_body_width <= 0.0)
00441 {
00442 if (verbose)
00443 {
00444 g_log ("", G_LOG_LEVEL_WARNING,
00445 (_("[%s] DRC Error: check for package body width is <= 0.0.")),
00446 footprint_type);
00447 }
00448 result = EXIT_FAILURE;
00449 }
00450 if (package_body_height <= 0.0)
00451 {
00452 if (verbose)
00453 {
00454 g_log ("", G_LOG_LEVEL_WARNING,
00455 (_("[%s] DRC Error: check for package body height is <= 0.0.")),
00456 footprint_type);
00457 }
00458 result = EXIT_FAILURE;
00459 }
00460
00461 if (courtyard_length <= 0.0)
00462 {
00463 if (verbose)
00464 {
00465 g_log ("", G_LOG_LEVEL_WARNING,
00466 (_("[%s] DRC Error: check for courtyard length is <= 0.0.")),
00467 footprint_type);
00468 }
00469 result = EXIT_FAILURE;
00470 }
00471 if (courtyard_width <= 0.0)
00472 {
00473 if (verbose)
00474 {
00475 g_log ("", G_LOG_LEVEL_WARNING,
00476 (_("[%s] DRC Error: check for courtyard width is <= 0.0.")),
00477 footprint_type);
00478 }
00479 return (EXIT_FAILURE);
00480 }
00481
00482 if (pitch_x - pad_length < pad_clearance)
00483 {
00484 if (verbose)
00485 {
00486 g_log ("", G_LOG_LEVEL_WARNING,
00487 (_("[%s] DRC Error: check for minimum clearance between copper (X-direction).")),
00488 footprint_type);
00489 }
00490 result = EXIT_FAILURE;
00491 }
00492
00493 if (pitch_y - pad_width < pad_clearance)
00494 {
00495 if (verbose)
00496 {
00497 g_log ("", G_LOG_LEVEL_WARNING,
00498 (_("[%s] DRC Error: check for minimum clearance between copper (Y-direction).")),
00499 footprint_type);
00500 }
00501 result = EXIT_FAILURE;
00502 }
00503
00504 if (fiducial)
00505 {
00506 if (verbose)
00507 {
00508 g_log ("", G_LOG_LEVEL_WARNING,
00509 (_("[%s] DRC Error: package should not have a fiducial pad.")),
00510 footprint_type);
00511 }
00512 result = EXIT_FAILURE;
00513 }
00514
00515
00516 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00517 {
00518 if (verbose)
00519 {
00520 g_log ("", G_LOG_LEVEL_WARNING,
00521 (_("[%s] DRC Error: check for clearance of the package length with regard to the courtyard dimensions.")),
00522 footprint_type);
00523 }
00524 result = EXIT_FAILURE;
00525 }
00526
00527
00528 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00529 {
00530 if (verbose)
00531 {
00532 g_log ("", G_LOG_LEVEL_WARNING,
00533 (_("[%s] DRC Error: check for clearance of the package width with regard to the courtyard dimensions.")),
00534 footprint_type);
00535 }
00536 result = EXIT_FAILURE;
00537 }
00543
00544 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00545 {
00546 if (verbose)
00547 {
00548 g_log ("", G_LOG_LEVEL_WARNING,
00549 (_("[%s] DRC Error: line width 0.0 specified for check for a reasonable silk line width.")),
00550 footprint_type);
00551 }
00552 result = EXIT_FAILURE;
00553 }
00554 switch (units_type)
00555 {
00556 case NO_UNITS:
00557 {
00558 if (verbose)
00559 {
00560 g_log ("", G_LOG_LEVEL_WARNING,
00561 (_("[%s] DRC Error: no units specified for check for a reasonable silk line width.")),
00562 footprint_type);
00563 }
00564 result = EXIT_FAILURE;
00565 break;
00566 }
00567 case MIL:
00568 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00569 {
00570 if (verbose)
00571 {
00572 g_log ("", G_LOG_LEVEL_WARNING,
00573 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00574 footprint_type);
00575 }
00576 result = EXIT_FAILURE;
00577 break;
00578 }
00579 case MIL_100:
00580 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00581 {
00582 if (verbose)
00583 {
00584 g_log ("", G_LOG_LEVEL_WARNING,
00585 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00586 footprint_type);
00587 }
00588 result = EXIT_FAILURE;
00589 break;
00590 }
00591 case MM:
00592 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00593 {
00594 if (verbose)
00595 {
00596 g_log ("", G_LOG_LEVEL_WARNING,
00597 (_("[%s] DRC Error: line width > 1.0 mm specified check for a reasonable silk line width.")),
00598 footprint_type);
00599 }
00600 result = EXIT_FAILURE;
00601 break;
00602 }
00603 default:
00604 {
00605 if (verbose)
00606 {
00607 g_log ("", G_LOG_LEVEL_WARNING,
00608 (_("[%s] DRC Error: no valid units type specified for check for a reasonable silk line width.")),
00609 footprint_type);
00610 }
00611 result = EXIT_FAILURE;
00612 break;
00613 }
00614 }
00615
00616 if (verbose && (result == EXIT_SUCCESS))
00617 {
00618 g_log ("", G_LOG_LEVEL_INFO,
00619 (_("[%s] DRC Check: no errors while checking package %s.")),
00620 footprint_type, footprint_name);
00621 }
00622 return result;
00623 }
00624
00625
00647 int
00648 indc_get_default_footprint_values ()
00649 {
00650 if (!strcmp (footprint_name, "?INDC1005X60N"))
00651 {
00652 footprint_units = g_strdup ("mm");
00653 package_body_length = 1.10;
00654 package_body_width = 0.70;
00655 package_body_height = 0.60;
00656 package_is_radial = FALSE;
00657 number_of_pins = 2;
00658 number_of_columns = 0;
00659 number_of_rows = 0;
00660 count_x = 0;
00661 count_y = 0;
00662 pitch_x = 0.95;
00663 pitch_y = 0.0;
00664 pad_length = 0.59;
00665 pad_width = 0.72;
00666 pad_shape = g_strdup ("rectangular pad");
00667 pad_shapes_type = SQUARE;
00668 thermal = FALSE;
00669 thermal_length = 0.0;
00670 thermal_width = 0.0;
00671 silkscreen_package_outline = FALSE;
00672 silkscreen_length = 0.0;
00673 silkscreen_width = 0.0;
00674 silkscreen_line_width = 0.20;
00675 courtyard_length = 1.85;
00676 courtyard_width = 1.05;
00677 courtyard_line_width = 0.05;
00678 g_free (footprint_name);
00679 footprint_name = g_strdup ("INDC1005X60N");
00680 if (verbose)
00681 {
00682 g_log ("", G_LOG_LEVEL_INFO,
00683 (_("%s is also known as")), footprint_name,
00684 " EIA 0402, metric 1005.");
00685 g_log ("", G_LOG_LEVEL_WARNING,
00686 (_("%s: footprint is too small for a package outline on the silkscreen.")),
00687 footprint_name);
00688 }
00689 return (EXIT_SUCCESS);
00690 }
00691 else if (!strcmp (footprint_name, "?INDC1608X95N"))
00692 {
00693 footprint_units = g_strdup ("mm");
00694 package_body_length = 1.75;
00695 package_body_width = 0.95;
00696 package_body_height = 0.95;
00697 package_is_radial = FALSE;
00698 number_of_pins = 2;
00699 number_of_columns = 0;
00700 number_of_rows = 0;
00701 count_x = 0;
00702 count_y = 0;
00703 pitch_x = 1.60;
00704 pitch_y = 0.0;
00705 pad_length = 0.95;
00706 pad_width = 1.00;
00707 pad_shape = g_strdup ("rectangular pad");
00708 pad_shapes_type = SQUARE;
00709 thermal = FALSE;
00710 thermal_length = 0.0;
00711 thermal_width = 0.0;
00712 silkscreen_package_outline = FALSE;
00713 silkscreen_length = 0.0;
00714 silkscreen_width = 0.0;
00715 silkscreen_line_width = 0.20;
00716 courtyard_length = 3.10;
00717 courtyard_width = 1.50;
00718 courtyard_line_width = 0.05;
00719 g_free (footprint_name);
00720 footprint_name = g_strdup ("INDC1608X95N");
00721 if (verbose)
00722 {
00723 g_log ("", G_LOG_LEVEL_INFO,
00724 (_("%s is also known as")), footprint_name,
00725 " EIA 0603, metric 1608.");
00726 g_log ("", G_LOG_LEVEL_WARNING,
00727 (_("%s: footprint is too small for a package outline on the silkscreen.")),
00728 footprint_name);
00729 }
00730 return (EXIT_SUCCESS);
00731 }
00732 else if (!strcmp (footprint_name, "?INDC2520X220N"))
00733 {
00734 footprint_units = g_strdup ("mm");
00735 package_body_length = 2.70;
00736 package_body_width = 2.30;
00737 package_body_height = 2.20;
00738 package_is_radial = FALSE;
00739 number_of_pins = 2;
00740 number_of_columns = 0;
00741 number_of_rows = 0;
00742 count_x = 0;
00743 count_y = 0;
00744 pitch_x = 2.50;
00745 pitch_y = 0.0;
00746 pad_length = 0.95;
00747 pad_width = 2.30;
00748 pad_shape = g_strdup ("rectangular pad");
00749 pad_shapes_type = SQUARE;
00750 thermal = FALSE;
00751 thermal_length = 0.0;
00752 thermal_width = 0.0;
00753 silkscreen_package_outline = TRUE;
00754 silkscreen_length = 0.80;
00755 silkscreen_width = 2.00;
00756 silkscreen_line_width = 0.20;
00757 courtyard_length = 4.00;
00758 courtyard_width = 2.80;
00759 courtyard_line_width = 0.05;
00760 g_free (footprint_name);
00761 footprint_name = g_strdup ("INDC2520X220N");
00762 if (verbose)
00763 {
00764 g_log ("", G_LOG_LEVEL_INFO,
00765 (_("%s is also known as")), footprint_name,
00766 " EIA 1008, metric 2520.");
00767 }
00768 return (EXIT_SUCCESS);
00769 }
00770 else if (!strcmp (footprint_name, "?INDC3225X135N"))
00771 {
00772 footprint_units = g_strdup ("mm");
00773 package_body_length = 3.40;
00774 package_body_width = 2.70;
00775 package_body_height = 1.35;
00776 package_is_radial = FALSE;
00777 number_of_pins = 2;
00778 number_of_columns = 0;
00779 number_of_rows = 0;
00780 count_x = 0;
00781 count_y = 0;
00782 pitch_x = 3.00;
00783 pitch_y = 0.0;
00784 pad_length = 1.15;
00785 pad_width = 2.70;
00786 pad_shape = g_strdup ("rectangular pad");
00787 pad_shapes_type = SQUARE;
00788 thermal = FALSE;
00789 thermal_length = 0.0;
00790 thermal_width = 0.0;
00791 silkscreen_package_outline = TRUE;
00792 silkscreen_length = 1.10;
00793 silkscreen_width = 2.50;
00794 silkscreen_line_width = 0.20;
00795 courtyard_length = 4.70;
00796 courtyard_width = 3.20;
00797 courtyard_line_width = 0.05;
00798 g_free (footprint_name);
00799 footprint_name = g_strdup ("INDC3225X135N");
00800 if (verbose)
00801 {
00802 g_log ("", G_LOG_LEVEL_INFO,
00803 (_("%s is also known as")), footprint_name,
00804 " EIA 1210, metric 3225.");
00805 }
00806 return (EXIT_SUCCESS);
00807 }
00808 else if (!strcmp (footprint_name, "?INDC4509X190N"))
00809 {
00810 footprint_units = g_strdup ("mm");
00811 package_body_length = 4.80;
00812 package_body_width = 1.20;
00813 package_body_height = 1.90;
00814 package_is_radial = FALSE;
00815 number_of_pins = 2;
00816 number_of_columns = 0;
00817 number_of_rows = 0;
00818 count_x = 0;
00819 count_y = 0;
00820 pitch_x = 4.20;
00821 pitch_y = 0.0;
00822 pad_length = 1.30;
00823 pad_width = 1.20;
00824 pad_shape = g_strdup ("rectangular pad");
00825 pad_shapes_type = SQUARE;
00826 thermal = FALSE;
00827 thermal_length = 0.0;
00828 thermal_width = 0.0;
00829 silkscreen_package_outline = TRUE;
00830 silkscreen_length = 2.20;
00831 silkscreen_width = 0.90;
00832 silkscreen_line_width = 0.20;
00833 courtyard_length = 6.00;
00834 courtyard_width = 1.70;
00835 courtyard_line_width = 0.05;
00836 g_free (footprint_name);
00837 footprint_name = g_strdup ("INDC4509X190N");
00838 if (verbose)
00839 {
00840 g_log ("", G_LOG_LEVEL_INFO,
00841 (_("%s is also known as")), footprint_name,
00842 " EIA 1806, metric 4509.");
00843 }
00844 return (EXIT_SUCCESS);
00845 }
00846 else if (!strcmp (footprint_name, "?INDC4532X175N"))
00847 {
00848 footprint_units = g_strdup ("mm");
00849 package_body_length = 4.80;
00850 package_body_width = 3.40;
00851 package_body_height = 1.75;
00852 package_is_radial = FALSE;
00853 number_of_pins = 2;
00854 number_of_columns = 0;
00855 number_of_rows = 0;
00856 count_x = 0;
00857 count_y = 0;
00858 pitch_x = 4.10;
00859 pitch_y = 0.0;
00860 pad_length = 1.40;
00861 pad_width = 3.40;
00862 pad_shape = g_strdup ("rectangular pad");
00863 pad_shapes_type = SQUARE;
00864 thermal = FALSE;
00865 thermal_length = 0.0;
00866 thermal_width = 0.0;
00867 silkscreen_package_outline = TRUE;
00868 silkscreen_length = 2.00;
00869 silkscreen_width = 3.20;
00870 silkscreen_line_width = 0.20;
00871 courtyard_length = 6.00;
00872 courtyard_width = 3.90;
00873 courtyard_line_width = 0.05;
00874 g_free (footprint_name);
00875 footprint_name = g_strdup ("INDC4532X175N");
00876 if (verbose)
00877 {
00878 g_log ("", G_LOG_LEVEL_INFO,
00879 (_("%s is also known as")), footprint_name,
00880 " EIA 1812, metric 4532.");
00881 }
00882 return (EXIT_SUCCESS);
00883 }
00884 else if (!strcmp (footprint_name, "?INDC4648X310N"))
00885 {
00886 footprint_units = g_strdup ("mm");
00887 package_body_length = 4.60;
00888 package_body_width = 5.00;
00889 package_body_height = 3.10;
00890 package_is_radial = FALSE;
00891 number_of_pins = 2;
00892 number_of_columns = 0;
00893 number_of_rows = 0;
00894 count_x = 0;
00895 count_y = 0;
00896 pitch_x = 3.50;
00897 pitch_y = 0.0;
00898 pad_length = 2.00;
00899 pad_width = 5.00;
00900 pad_shape = g_strdup ("rectangular pad");
00901 pad_shapes_type = SQUARE;
00902 thermal = FALSE;
00903 thermal_length = 0.0;
00904 thermal_width = 0.0;
00905 silkscreen_package_outline = TRUE;
00906 silkscreen_length = 0.20;
00907 silkscreen_width = 4.80;
00908 silkscreen_line_width = 0.20;
00909 courtyard_length = 6.00;
00910 courtyard_width = 5.50;
00911 courtyard_line_width = 0.05;
00912 g_free (footprint_name);
00913 footprint_name = g_strdup ("INDC4648X310N");
00914 return (EXIT_SUCCESS);
00915 }
00916 else if (!strcmp (footprint_name, "?INDC5750X180N"))
00917 {
00918 footprint_units = g_strdup ("mm");
00919 package_body_length = 5.90;
00920 package_body_width = 5.30;
00921 package_body_height = 1.80;
00922 package_is_radial = FALSE;
00923 number_of_pins = 2;
00924 number_of_columns = 0;
00925 number_of_rows = 0;
00926 count_x = 0;
00927 count_y = 0;
00928 pitch_x = 5.40;
00929 pitch_y = 0.0;
00930 pad_length = 1.20;
00931 pad_width = 5.30;
00932 pad_shape = g_strdup ("rectangular pad");
00933 pad_shapes_type = SQUARE;
00934 thermal = FALSE;
00935 thermal_length = 0.0;
00936 thermal_width = 0.0;
00937 silkscreen_package_outline = TRUE;
00938 silkscreen_length = 3.50;
00939 silkscreen_width = 5.00;
00940 silkscreen_line_width = 0.20;
00941 courtyard_length = 7.10;
00942 courtyard_width = 5.80;
00943 courtyard_line_width = 0.05;
00944 g_free (footprint_name);
00945 footprint_name = g_strdup ("INDC5750X180N");
00946 if (verbose)
00947 {
00948 g_log ("", G_LOG_LEVEL_INFO,
00949 (_("%s is also known as")), footprint_name,
00950 " EIA 2220, metric 5650.");
00951 }
00952 return (EXIT_SUCCESS);
00953 }
00954 else if (!strcmp (footprint_name, "?INDC6350X200N"))
00955 {
00956 footprint_units = g_strdup ("mm");
00957 package_body_length = 6.50;
00958 package_body_width = 5.30;
00959 package_body_height = 2.00;
00960 package_is_radial = FALSE;
00961 number_of_pins = 2;
00962 number_of_columns = 0;
00963 number_of_rows = 0;
00964 count_x = 0;
00965 count_y = 0;
00966 pitch_x = 6.00;
00967 pitch_y = 0.0;
00968 pad_length = 1.20;
00969 pad_width = 5.30;
00970 pad_shape = g_strdup ("rectangular pad");
00971 pad_shapes_type = SQUARE;
00972 thermal = FALSE;
00973 thermal_length = 0.0;
00974 thermal_width = 0.0;
00975 silkscreen_package_outline = TRUE;
00976 silkscreen_length = 4.10;
00977 silkscreen_width = 5.00;
00978 silkscreen_line_width = 0.20;
00979 courtyard_length = 7.70;
00980 courtyard_width = 5.80;
00981 courtyard_line_width = 0.05;
00982 g_free (footprint_name);
00983 footprint_name = g_strdup ("INDC6350X200N");
00984 if (verbose)
00985 {
00986 g_log ("", G_LOG_LEVEL_INFO,
00987 (_("%s is also known as")), footprint_name,
00988 " EIA 2520, metric 6350.");
00989 }
00990 return (EXIT_SUCCESS);
00991 }
00992 else
00993 {
00994 g_log ("", G_LOG_LEVEL_WARNING,
00995 _("default values for footprint %s not found.\n"),
00996 footprint_name);
00997 return (EXIT_FAILURE);
00998 }
00999 return (EXIT_FAILURE);
01000 }
01001
01002
01010 #if GUI
01011 int
01012 indc_set_gui_constraints ()
01013 {
01014
01015 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
01016 "package_is_radial_checkbutton");
01017 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
01018 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
01019
01020
01021 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
01022 "number_of_columns_entry");
01023 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
01024 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
01025 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
01026 "number_of_rows_entry");
01027 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "1");
01028 gtk_widget_set_sensitive (number_of_rows_entry, FALSE);
01029 GtkWidget *pitch_y_entry = lookup_widget (GTK_WIDGET (widget),
01030 "pitch_y_entry");
01031 gtk_entry_set_text (GTK_ENTRY (pitch_y_entry), "");
01032 gtk_widget_set_sensitive (pitch_y_entry, FALSE);
01033 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
01034 "count_x_entry");
01035 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
01036 gtk_widget_set_sensitive (count_x_entry, FALSE);
01037 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
01038 "count_y_entry");
01039 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
01040 gtk_widget_set_sensitive (count_y_entry, FALSE);
01041 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
01042 "number_1_position_entry");
01043 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
01044 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
01045
01046
01047 gui_constraints_disable_thermal_tab_widgets (widget);
01048
01049
01050 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
01051 return (EXIT_SUCCESS);
01052 }
01053 #endif
01054
01055
01062 int
01063 indc_write_footprint ()
01064 {
01065 gdouble xmax;
01066 gdouble xmin;
01067 gdouble ymax;
01068 gdouble ymin;
01069 gdouble x_text;
01070 gdouble y_text;
01071 gchar *pin_pad_flags = g_strdup ("");
01072
01073
01074 fp = fopen (footprint_filename, "w");
01075 if (!fp)
01076 {
01077 g_log ("", G_LOG_LEVEL_WARNING,
01078 _("could not open file for %s footprint: %s."),
01079 footprint_type, footprint_filename);
01080 fclose (fp);
01081 return (EXIT_FAILURE);
01082 }
01083
01084 if (license_in_footprint)
01085 {
01086 write_license ();
01087 }
01088
01089
01090 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
01091 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
01092 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
01093 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
01094
01095
01096 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
01097 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
01098 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
01099 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
01100 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
01101 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
01102 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
01103 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
01104
01105 if (multiplier * (-courtyard_length / 2.0) < xmin)
01106 xmin = multiplier * (-courtyard_length / 2.0);
01107 if (multiplier * (courtyard_length / 2.0) > xmax)
01108 xmax = multiplier * (courtyard_length / 2.0);
01109 if (multiplier * (-courtyard_width / 2.0) < ymin)
01110 ymin = multiplier * (-courtyard_width / 2.0);
01111 if (multiplier * (courtyard_width / 2.0) > ymax)
01112 ymax = multiplier * (courtyard_width / 2.0);
01113
01114
01115 x_text = 0.0 ;
01116 y_text = (ymin - 10000.0);
01117 write_element_header (x_text, y_text);
01118
01119 if (!strcmp (pad_shape, "rectangular pad"))
01120 pin_pad_flags = g_strdup ("square");
01121 if (pad_length > pad_width)
01122 {
01123
01124 write_pad
01125 (
01126 1,
01127 "",
01128 multiplier * ((-pitch_x - pad_length + pad_width) / 2.0),
01129 0,
01130 multiplier * ((-pitch_x + pad_length - pad_width) / 2.0),
01131 0,
01132 multiplier * pad_width,
01133 multiplier * pad_clearance,
01134 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
01135
01136 (pin1_square) ? "square" : pin_pad_flags
01137 );
01138
01139 write_pad
01140 (
01141 2,
01142 "",
01143 multiplier * ((pitch_x - pad_length + pad_width) / 2.0),
01144 0,
01145 multiplier * ((pitch_x + pad_length - pad_width) / 2.0),
01146 0,
01147 multiplier * pad_width,
01148 multiplier * pad_clearance,
01149 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
01150 pin_pad_flags
01151 );
01152 }
01153 else
01154 {
01155
01156 write_pad
01157 (
01158 1,
01159 "",
01160 multiplier * (-pitch_x / 2.0),
01161 multiplier * ((pad_width - pad_length) / 2.0),
01162 multiplier * (-pitch_x / 2),
01163 multiplier * ((-pad_width + pad_length) / 2.0),
01164 multiplier * pad_length,
01165 multiplier * pad_clearance,
01166 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
01167
01168 (pin1_square) ? "square" : pin_pad_flags
01169 );
01170
01171 write_pad
01172 (
01173 2,
01174 "",
01175 multiplier * (pitch_x / 2.0),
01176 multiplier * ((pad_width - pad_length) / 2.0),
01177 multiplier * (pitch_x / 2.0),
01178 multiplier * ((-pad_width + pad_length) / 2.0),
01179 multiplier * pad_length,
01180 multiplier * pad_clearance,
01181 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
01182 pin_pad_flags
01183 );
01184 }
01185
01186 if (silkscreen_package_outline && (package_body_width))
01187 {
01188 fprintf (fp, "# Write a package body on the silkscreen\n");
01189 write_element_line
01190 (
01191 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01192 multiplier * (package_body_width / 2.0),
01193 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
01194 multiplier * (package_body_width / 2.0),
01195 multiplier * silkscreen_line_width
01196 );
01197 write_element_line
01198 (
01199 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01200 multiplier * (-package_body_width / 2.0),
01201 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
01202 multiplier * (-package_body_width / 2.0),
01203 multiplier * silkscreen_line_width
01204 );
01205 }
01206
01207 if (silkscreen_indicate_1)
01208 {
01209
01210 }
01211
01212 if (courtyard)
01213 {
01214 fprintf (fp, "# Write a courtyard on the silkscreen\n");
01215 write_rectangle
01216 (
01217 xmin,
01218 ymin,
01219 xmax,
01220 ymax,
01221 multiplier * courtyard_line_width
01222 );
01223 }
01224
01225 if (attributes_in_footprint)
01226 {
01227 write_attributes ();
01228 }
01229
01230 fprintf (fp, "\n");
01231 fprintf (fp, ")\n");
01232 fclose (fp);
01233
01234 if (verbose)
01235 {
01236 g_log ("", G_LOG_LEVEL_INFO,
01237 _("wrote a footprint for a %s package: %s."),
01238 footprint_type,
01239 footprint_filename);
01240 }
01241 return (EXIT_SUCCESS);
01242 }
01243
01244
01248 static fpw_function_t
01249 indc_function_list[] =
01250 {
01251 #if GUI
01252 {
01253 "Set GUI constraints",
01254 indc_set_gui_constraints,
01255 "Set GUI constraints for a INDC SMT package",
01256 NULL
01257 },
01258 #endif
01259 {
01260 "Create Element",
01261 indc_create_element,
01262 "Create a pcb element for an INDC SMT package",
01263 NULL
01264 },
01265 {
01266 "DRC INDC Element",
01267 indc_drc,
01268 "Design Rule Check for an INDC SMT package",
01269 NULL
01270 },
01271 {
01272 "Default Element Values",
01273 indc_get_default_footprint_values,
01274 "Get default values for a INDC SMT package",
01275 NULL
01276 },
01277 {
01278 "Write footprint",
01279 indc_write_footprint,
01280 "Write a footprint for a INDC SMT package",
01281 NULL
01282 }
01283 };
01284
01285
01286 REGISTER_FUNCTIONS (indc_function_list)
01287
01288
01289
01292 void
01293 indc_init ()
01294 {
01295 register_indc_function_list ();
01296 }
01297
01298
01299