00001
00025 #include "register_functions.c"
00026 #include "sil.h"
00027
00028
00035 int
00036 sil_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gint i;
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 {
00054 g_log ("", G_LOG_LEVEL_WARNING,
00055 _("could not create a valid element pointer for a %s package."),
00056 footprint_type);
00057 }
00058 return (EXIT_FAILURE);
00059 }
00060
00061
00062 element->MarkX = 0;
00063 element->MarkY = 0;
00064
00065
00066
00067
00068
00069 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00070 {
00071 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00072 }
00073 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00074 {
00075 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00076 }
00077 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00078 {
00079 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00080 }
00081 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00082 {
00083 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00084 }
00085
00086 if (multiplier * (-courtyard_length / 2.0) < xmin)
00087 {
00088 xmin = multiplier * (-courtyard_length / 2.0);
00089 }
00090 if (multiplier * (courtyard_length / 2.0) > xmax)
00091 {
00092 xmax = multiplier * (courtyard_length / 2.0);
00093 }
00094 if (multiplier * (-courtyard_width / 2.0) < ymin)
00095 {
00096 ymin = multiplier * (-courtyard_width / 2.0);
00097 }
00098 if (multiplier * (courtyard_width / 2.0) > ymax)
00099 {
00100 ymax = multiplier * (courtyard_width / 2.0);
00101 }
00102
00103 element->Name[1].Scale = 100;
00104 element->Name[1].X = 0.0 ;
00105 element->Name[1].Y = (ymin - 10000.0);
00106 element->Name[1].TextString = footprint_name;
00107 element->Name[1].Element = element;
00108 element->Name[1].Direction = EAST;
00109 element->Name[1].ID = ID++;
00110
00111 element->Name[2].Scale = 100;
00112 element->Name[2].X = 0.0 ;
00113 element->Name[2].Y = (ymin - 10000.0);
00114 element->Name[2].TextString = footprint_refdes;
00115 element->Name[2].Element = element;
00116 element->Name[2].Direction = EAST;
00117 element->Name[2].ID = ID++;
00118
00119 element->Name[3].Scale = 100;
00120 element->Name[3].X = 0.0 ;
00121 element->Name[3].Y = (ymin - 10000.0);
00122 element->Name[3].TextString = footprint_value;
00123 element->Name[3].Element = element;
00124 element->Name[3].Direction = EAST;
00125 element->Name[3].ID = ID++;
00126
00127 for (i = 0; (i < number_of_rows); i++)
00128 {
00129 pin_number = 1 + i;
00130 if (pad_shapes_type == SQUARE)
00131 {
00132 pad_flag.f = SQUARE;
00133 }
00134 else if (pin1_square && (pin_number == 1))
00135 {
00136 pad_flag.f = SQUARE;
00137 }
00138 else
00139 {
00140 pad_flag.f = CLEAR;
00141 }
00142 create_new_pin
00143 (
00144 element,
00145 (int) (multiplier * (-pitch_x / 2.0)),
00146 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) +1 + i) * pitch_y)),
00147 (int) (multiplier * pad_diameter),
00148 (int) (multiplier * 2 * pad_clearance),
00149 (int) (multiplier * (pad_diameter + (2 * pad_solder_mask_clearance))),
00150 (int) (multiplier * pin_drill_diameter),
00151 pin_pad_name,
00152 g_strdup_printf ("%d", pin_number),
00153 pad_flag
00154 );
00155 if (!strcmp (pad_shape, "rounded pad, elongated"))
00156 {
00157 pad_flag.f = ONSOLDER;
00158 create_new_pad
00159 (
00160 element,
00161 (int) (multiplier * (-pitch_x - pad_width + pad_length) / 2.0),
00162 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y)),
00163 (int) (multiplier * (-pitch_x + pad_width - pad_length) / 2.0),
00164 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y)),
00165 (int) (multiplier * pad_width),
00166 (int) (multiplier * 2 * pad_clearance),
00167 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00168 "",
00169 g_strdup_printf ("%d", pin_number),
00170 pad_flag
00171 );
00172 }
00173 }
00174
00175 if (silkscreen_package_outline)
00176 {
00177 create_new_line
00178 (
00179 element,
00180 (int) (multiplier * (-package_body_length / 2.0)),
00181 (int) (multiplier * (-package_body_width / 2.0)),
00182 (int) (multiplier * (-package_body_length / 2.0)),
00183 (int) (multiplier * (package_body_width / 2.0)),
00184 (int) (multiplier * silkscreen_line_width)
00185 );
00186 create_new_line
00187 (
00188 element,
00189 (int) (multiplier * (package_body_length / 2.0)),
00190 (int) (multiplier * (-package_body_width / 2.0)),
00191 (int) (multiplier * (package_body_length / 2.0)),
00192 (int) (multiplier * (package_body_width / 2.0)),
00193 (int) (multiplier * silkscreen_line_width)
00194 );
00195 create_new_line
00196 (
00197 element,
00198 (int) (multiplier * (-package_body_length / 2.0)),
00199 (int) (multiplier * (-package_body_width / 2.0)),
00200 (int) (multiplier * (package_body_length / 2.0)),
00201 (int) (multiplier * (-package_body_width / 2.0)),
00202 (int) (multiplier * silkscreen_line_width)
00203 );
00204 create_new_line
00205 (
00206 element,
00207 (int) (multiplier * (package_body_length / 2.0)),
00208 (int) (multiplier * (package_body_width / 2.0)),
00209 (int) (multiplier * (-package_body_length / 2.0)),
00210 (int) (multiplier * (package_body_width / 2.0)),
00211 (int) (multiplier * silkscreen_line_width)
00212 );
00213 }
00214
00215 if (silkscreen_indicate_1)
00216 {
00217
00218 create_new_line
00219 (
00220 element,
00221 (int) (multiplier * (-package_body_length / 2.0)),
00222 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y)),
00223 (int) (multiplier * (package_body_length / 2.0)),
00224 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y)),
00225 (int) (multiplier * silkscreen_line_width)
00226 );
00227
00228 if (xmax > ((multiplier * package_body_length) / 2))
00229 {
00230 create_new_line
00231 (
00232 element,
00233 (int) (multiplier * (-package_body_length / 2.0)),
00234 (int) (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)),
00235 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00236 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250),
00237 (int) (multiplier * silkscreen_line_width)
00238 );
00239 create_new_line
00240 (
00241 element,
00242 (int) (multiplier * (-package_body_length / 2.0)),
00243 (int) (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)),
00244 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00245 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250),
00246 (int) (multiplier * silkscreen_line_width)
00247 );
00248 create_new_line
00249 (
00250 element,
00251 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00252 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250),
00253 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00254 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250),
00255 (int) (multiplier * silkscreen_line_width)
00256 );
00257 }
00258 }
00259
00260 if (courtyard)
00261 {
00262 create_new_line
00263 (
00264 element,
00265 (int) (xmin),
00266 (int) (ymin),
00267 (int) (xmin),
00268 (int) (ymax),
00269 (int) (multiplier * courtyard_line_width)
00270 );
00271 create_new_line
00272 (
00273 element,
00274 (int) (xmax),
00275 (int) (ymin),
00276 (int) (xmax),
00277 (int) (ymax),
00278 (int) (multiplier * courtyard_line_width)
00279 );
00280 create_new_line
00281 (
00282 element,
00283 (int) (xmin),
00284 (int) (ymin),
00285 (int) (xmax),
00286 (int) (ymin),
00287 (int) (multiplier * courtyard_line_width)
00288 );
00289 create_new_line
00290 (
00291 element,
00292 (int) (xmax),
00293 (int) (ymax),
00294 (int) (xmin),
00295 (int) (ymax),
00296 (int) (multiplier * courtyard_line_width)
00297 );
00298 }
00299
00300 if (attributes_in_footprint)
00301 {
00302 element = create_attributes_in_element (element);
00303 }
00304
00305 if (verbose)
00306 {
00307 g_log ("", G_LOG_LEVEL_INFO,
00308 _("created an element for a %s package: %s."),
00309 footprint_type,
00310 footprint_filename);
00311 }
00312 current_element = (ElementTypePtr) &element;
00313 return (EXIT_SUCCESS);
00314 }
00315
00316
00326 int
00327 sil_create_packages_list ()
00328 {
00329 g_list_free (packages_list);
00330 packages_list = g_list_append (packages_list, "SIL");
00331 return (EXIT_SUCCESS);
00332 }
00333
00334
00366 int
00367 sil_drc ()
00368 {
00369 int result = EXIT_SUCCESS;
00370 if (verbose)
00371 {
00372 g_log ("", G_LOG_LEVEL_INFO,
00373 (_("[%s] DRC Check: checking package %s.")),
00374 footprint_type, footprint_name);
00375 }
00376
00377 if (number_of_rows < 1)
00378 {
00379 if (verbose)
00380 {
00381 g_log ("", G_LOG_LEVEL_WARNING,
00382 (_("[%s] DRC Error: number of rows < 1.")),
00383 footprint_type);
00384 }
00385 result = EXIT_FAILURE;
00386 }
00387
00388 if (number_of_columns > 1)
00389 {
00390 if (verbose)
00391 {
00392 g_log ("", G_LOG_LEVEL_WARNING,
00393 (_("[%s] DRC Error: number of columns is > 1.")),
00394 footprint_type);
00395 }
00396 number_of_columns = 1;
00397 result = EXIT_FAILURE;
00398 }
00399
00400 if (pitch_x != 0.0)
00401 {
00402 if (verbose)
00403 {
00404 g_log ("", G_LOG_LEVEL_WARNING,
00405 (_("[%s] DRC Error: pitch (X-direction) should be 0.")),
00406 footprint_type);
00407 pitch_x = 0.0;
00408 }
00409 result = EXIT_FAILURE;
00410 }
00411
00412 switch (pad_shapes_type)
00413 {
00414 case NO_SHAPE:
00415 {
00416 if (verbose)
00417 {
00418 g_log ("", G_LOG_LEVEL_WARNING,
00419 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00420 footprint_type);
00421 }
00422 result = EXIT_FAILURE;
00423 break;
00424 }
00425 case ROUND:
00426 {
00427 break;
00428 }
00429 case SQUARE:
00430 {
00431 if (verbose)
00432 {
00433 g_log ("", G_LOG_LEVEL_WARNING,
00434 (_("[%s] DRC Error: square pad shape specified for check for allowed pad shapes.")),
00435 footprint_type);
00436 }
00437 result = EXIT_FAILURE;
00438 break;
00439 }
00440 case OCTAGONAL:
00441 {
00442 if (verbose)
00443 {
00444 g_log ("", G_LOG_LEVEL_WARNING,
00445 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00446 footprint_type);
00447 }
00448 result = EXIT_FAILURE;
00449 break;
00450 }
00451 case ROUND_ELONGATED:
00452 {
00453 break;
00454 }
00455 default:
00456 {
00457 if (verbose)
00458 {
00459 g_log ("", G_LOG_LEVEL_WARNING,
00460 (_("[%s] DRC Error: no valid pad shape type specified.")),
00461 footprint_type);
00462 }
00463 result = EXIT_FAILURE;
00464 break;
00465 }
00466 }
00467
00468 if (package_body_length <= 0.0)
00469 {
00470 if (verbose)
00471 {
00472 g_log ("", G_LOG_LEVEL_WARNING,
00473 (_("[%s] DRC Error: specified package body length is too small.")),
00474 footprint_type);
00475 }
00476 result = EXIT_FAILURE;
00477 }
00478 if (package_body_width <= 0.0)
00479 {
00480 if (verbose)
00481 {
00482 g_log ("", G_LOG_LEVEL_WARNING,
00483 (_("[%s] DRC Error: specified package body width is too small.")),
00484 footprint_type);
00485 }
00486 result = EXIT_FAILURE;
00487 }
00488 if (package_body_height <= 0.0)
00489 {
00490 if (verbose)
00491 {
00492 g_log ("", G_LOG_LEVEL_WARNING,
00493 (_("[%s] DRC Error: specified package body height is too small.")),
00494 footprint_type);
00495 }
00496 result = EXIT_FAILURE;
00497 }
00498
00499 if (courtyard_length <= 0.0)
00500 {
00501 if (verbose)
00502 {
00503 g_log ("", G_LOG_LEVEL_WARNING,
00504 (_("[%s] DRC Error: specified courtyard length is too small.")),
00505 footprint_type);
00506 }
00507 result = EXIT_FAILURE;
00508 }
00509 if (courtyard_width <= 0.0)
00510 {
00511 if (verbose)
00512 {
00513 g_log ("", G_LOG_LEVEL_WARNING,
00514 (_("[%s] DRC Error: specified courtyard width is too small.")),
00515 footprint_type);
00516 }
00517 result = EXIT_FAILURE;
00518 }
00519
00520 if ((pitch_y - pad_diameter < pad_clearance) || (pitch_y - pad_width < pad_clearance))
00521 {
00522 if (verbose)
00523 {
00524 g_log ("", G_LOG_LEVEL_WARNING,
00525 (_("[%s] DRC Error: minimum clearance between copper (Y-direction) is too small.")),
00526 footprint_type);
00527 }
00528 result = EXIT_FAILURE;
00529 }
00530
00531 if (fiducial)
00532 {
00533 if (verbose)
00534 {
00535 g_log ("", G_LOG_LEVEL_WARNING,
00536 (_("[%s] DRC Error: package should not have any fiducials.")),
00537 footprint_type);
00538 }
00539 result = EXIT_FAILURE;
00540 }
00541
00542
00543 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00544 {
00545 if (verbose)
00546 {
00547 g_log ("", G_LOG_LEVEL_WARNING,
00548 (_("[%s] DRC Error: clearance of the package length with regard to the courtyard dimensions is too small.")),
00549 footprint_type);
00550 }
00551 result = EXIT_FAILURE;
00552 }
00553
00554
00555 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00556 {
00557 if (verbose)
00558 {
00559 g_log ("", G_LOG_LEVEL_WARNING,
00560 (_("[%s] DRC Error: clearance of the package width with regard to the courtyard dimensions is too small.")),
00561 footprint_type);
00562 }
00563 result = EXIT_FAILURE;
00564 }
00570
00571 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00572 {
00573 if (verbose)
00574 {
00575 g_log ("", G_LOG_LEVEL_WARNING,
00576 (_("[%s] DRC Error: silkscreen line width is too small.")),
00577 footprint_type);
00578 }
00579 result = EXIT_FAILURE;
00580 }
00581 switch (units_type)
00582 {
00583 case NO_UNITS:
00584 {
00585 if (verbose)
00586 {
00587 g_log ("", G_LOG_LEVEL_WARNING,
00588 (_("[%s] DRC Error: no units specified.")),
00589 footprint_type);
00590 }
00591 result = EXIT_FAILURE;
00592 break;
00593 }
00594 case MIL:
00595 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00596 {
00597 if (verbose)
00598 {
00599 g_log ("", G_LOG_LEVEL_WARNING,
00600 (_("[%s] DRC Error: silkscreen line width too wide.")),
00601 footprint_type);
00602 }
00603 result = EXIT_FAILURE;
00604 break;
00605 }
00606 case MIL_100:
00607 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00608 {
00609 if (verbose)
00610 {
00611 g_log ("", G_LOG_LEVEL_WARNING,
00612 (_("[%s] DRC Error: silkscreen line width too wide.")),
00613 footprint_type);
00614 }
00615 result = EXIT_FAILURE;
00616 break;
00617 }
00618 case MM:
00619 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00620 {
00621 if (verbose)
00622 {
00623 g_log ("", G_LOG_LEVEL_WARNING,
00624 (_("[%s] DRC Error: silkscreen line width too wide.")),
00625 footprint_type);
00626 }
00627 result = EXIT_FAILURE;
00628 break;
00629 }
00630 default:
00631 {
00632 if (verbose)
00633 {
00634 g_log ("", G_LOG_LEVEL_WARNING,
00635 (_("[%s] DRC Error: no valid units type specified.")),
00636 footprint_type);
00637 }
00638 result = EXIT_FAILURE;
00639 break;
00640 }
00641 }
00642
00643 if (verbose && (result == EXIT_SUCCESS))
00644 {
00645 g_log ("", G_LOG_LEVEL_INFO,
00646 (_("[%s] DRC Check: no errors while checking package %s.")),
00647 footprint_type, footprint_name);
00648 }
00649 return (result);
00650 }
00651
00652
00666 int
00667 sil_get_default_footprint_values ()
00668 {
00669 if (!strcmp (footprint_name, "?SIL04"))
00670 {
00671 footprint_units = g_strdup ("mil");
00672 number_of_pins = 4;
00673 package_body_width = 200;
00674 package_body_length = 100;
00675 package_body_height = 200;
00676 package_is_radial = FALSE;
00677 number_of_columns = 1;
00678 number_of_rows = 2;
00679 pitch_x = 0;
00680 pitch_y = 100;
00681 count_x = 0;
00682 count_y = 0;
00683 pad_shape = g_strdup ("circular pad");
00684 pin_drill_diameter = 28;
00685 pad_diameter = 60;
00686 pad_clearance = 6;
00687 pad_solder_mask_clearance = 6;
00688 g_free (footprint_name);
00689 footprint_name = g_strdup ("SIL04");
00690 return (EXIT_SUCCESS);
00691 }
00692 else
00693 {
00694 fprintf (stderr,
00695 _("WARNING: default values for footprint %s not found.\n"),
00696 footprint_name);
00697 return (EXIT_FAILURE);
00698 }
00699 return (EXIT_SUCCESS);
00700 }
00701
00702
00710 #if GUI
00711 int
00712 sil_set_gui_constraints ()
00713 {
00714
00715 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00716 "package_is_radial_checkbutton");
00717 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00718 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00719
00720
00721 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00722 "number_of_columns_entry");
00723 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "1");
00724 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00725 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00726 "number_of_rows_entry");
00727 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "");
00728 gtk_widget_set_sensitive (number_of_rows_entry, TRUE);
00729 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00730 "count_x_entry");
00731 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00732 gtk_widget_set_sensitive (count_x_entry, FALSE);
00733 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00734 "count_y_entry");
00735 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00736 gtk_widget_set_sensitive (count_y_entry, FALSE);
00737 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00738 "number_1_position_entry");
00739 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00740 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00741
00742
00743 gui_constraints_disable_thermal_tab_widgets (widget);
00744
00745
00746 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00747 return (EXIT_SUCCESS);
00748 }
00749 #endif
00750
00751
00764 int
00765 sil_write_footprint ()
00766 {
00767 gdouble xmax;
00768 gdouble xmin;
00769 gdouble ymax;
00770 gdouble ymin;
00771 gdouble x_text;
00772 gdouble y_text;
00773 gint pin_number;
00774 gchar *pin_pad_name = g_strdup ("");
00775 gchar *pin_pad_flags = g_strdup ("");
00776 gint i;
00777
00778 number_of_columns = 1;
00779
00780 fp = fopen (footprint_filename, "w");
00781 if (!fp)
00782 {
00783 g_log ("", G_LOG_LEVEL_WARNING,
00784 _("could not open file for %s footprint: %s."),
00785 footprint_type, footprint_filename);
00786 fclose (fp);
00787 return (EXIT_FAILURE);
00788 }
00789
00790 if (license_in_footprint)
00791 {
00792 write_license ();
00793 }
00794
00795
00796 xmin = multiplier *
00797 (
00798 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / -2.0) - pad_solder_mask_clearance
00799 );
00800 xmax = multiplier *
00801 (
00802 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / 2.0) + pad_solder_mask_clearance
00803 );
00804 ymin = multiplier *
00805 (
00806 (((-number_of_rows + 1) / 2.0) * pitch_y) -
00807 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) -
00808 pad_solder_mask_clearance
00809 );
00810 ymax = multiplier *
00811 (
00812 (((number_of_rows - 1 ) / 2.0) * pitch_y) +
00813 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) +
00814 pad_solder_mask_clearance
00815 );
00816
00817
00818 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00819 {
00820 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00821 }
00822 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00823 {
00824 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00825 }
00826 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00827 {
00828 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00829 }
00830 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00831 {
00832 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00833 }
00834
00835 if (multiplier * (-courtyard_length / 2.0) < xmin)
00836 {
00837 xmin = multiplier * (-courtyard_length / 2.0);
00838 }
00839 if (multiplier * (courtyard_length / 2.0) > xmax)
00840 {
00841 xmax = multiplier * (courtyard_length / 2.0);
00842 }
00843 if (multiplier * (-courtyard_width / 2.0) < ymin)
00844 {
00845 ymin = multiplier * (-courtyard_width / 2.0);
00846 }
00847 if (multiplier * (courtyard_width / 2.0) > ymax)
00848 {
00849 ymax = multiplier * (courtyard_width / 2.0);
00850 }
00851
00852
00853 x_text = 0.0 ;
00854 y_text = (ymin - 10000.0);
00855 write_element_header (x_text, y_text);
00856
00857 for (i = 0; (i < number_of_rows); i++)
00858 {
00859 pin_number = 1 + i;
00860 write_pin
00861 (
00862 pin_number,
00863 pin_pad_name,
00864 0,
00865 multiplier * ((((-number_of_rows - 1) / 2.0) +1 + i) * pitch_y),
00866 multiplier * pad_diameter,
00867 multiplier * 2 * pad_clearance,
00868 multiplier * (pad_diameter + (2 * pad_solder_mask_clearance)),
00869 multiplier * pin_drill_diameter,
00870 (pin1_square && (pin_number == 1)) ? "square" : pin_pad_flags
00871 );
00872 if (!strcmp (pad_shape, "rounded pad, elongated"))
00873 {
00874 if (!strcmp (pin_pad_flags, ""))
00875 pin_pad_flags = g_strconcat (pin_pad_flags, "onsolder", NULL);
00876 else
00877 pin_pad_flags = g_strconcat (pin_pad_flags, ",onsolder", NULL);
00878 write_pad
00879 (
00880 pin_number,
00881 pin_pad_name,
00882 multiplier * (-pad_width + pad_length) / 2.0,
00883 multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y),
00884 multiplier * (pad_width - pad_length) / 2.0,
00885 multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y),
00886 multiplier * pad_width,
00887 multiplier * 2 * pad_clearance,
00888 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00889 pin_pad_flags
00890 );
00891 }
00892 }
00893
00894 if (silkscreen_package_outline)
00895 {
00896 fprintf (fp, "# Write a package body on the silkscreen\n");
00897 write_rectangle
00898 (
00899 multiplier * ((-package_body_length) / 2.0),
00900 multiplier * ((-package_body_width) / 2.0),
00901 multiplier * ((package_body_length) / 2.0),
00902 multiplier * ((package_body_width) / 2.0),
00903 multiplier * silkscreen_line_width
00904 );
00905 }
00906
00907 if (silkscreen_indicate_1)
00908 {
00909 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
00910
00911 write_element_line
00912 (
00913 multiplier * (-package_body_length / 2.0),
00914 multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y),
00915 multiplier * (package_body_length / 2.0),
00916 multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y),
00917 multiplier * (silkscreen_line_width)
00918 );
00919
00920 if (xmax > ((multiplier * package_body_length) / 2))
00921 {
00922 write_element_line
00923 (
00924 multiplier * (-package_body_length / 2.0),
00925 multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y),
00926 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00927 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250,
00928 multiplier * (silkscreen_line_width)
00929 );
00930 write_element_line
00931 (
00932 multiplier * (-package_body_length / 2.0),
00933 multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y),
00934 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00935 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250,
00936 multiplier * (silkscreen_line_width)
00937 );
00938 write_element_line
00939 (
00940 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00941 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250,
00942 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00943 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250,
00944 multiplier * (silkscreen_line_width)
00945 );
00946 }
00947 }
00948
00949 if (courtyard)
00950 {
00951 fprintf (fp, "# Write a courtyard on the silkscreen\n");
00952 write_rectangle
00953 (
00954 xmin,
00955 ymin,
00956 xmax,
00957 ymax,
00958 multiplier * courtyard_line_width
00959 );
00960 }
00961
00962 if (attributes_in_footprint)
00963 {
00964 write_attributes ();
00965 }
00966
00967 fprintf (fp, "\n");
00968 fprintf (fp, ")\n");
00969 fclose (fp);
00970
00971 if (verbose)
00972 {
00973 g_log ("", G_LOG_LEVEL_INFO,
00974 _("wrote a footprint for a %s package: %s."),
00975 footprint_type,
00976 footprint_filename);
00977 }
00978 return (EXIT_SUCCESS);
00979 }
00980
00981
00985 static fpw_function_t
00986 sil_function_list[] =
00987 {
00988 #if GUI
00989 {
00990 "Set GUI constraints",
00991 sil_set_gui_constraints,
00992 "Set GUI constraints for a SIL package",
00993 NULL
00994 },
00995 #endif
00996 {
00997 "Create Package List",
00998 sil_create_packages_list,
00999 "Create a list of packages with known values",
01000 NULL
01001 },
01002 {
01003 "DRC SIL Element",
01004 sil_drc,
01005 "Design Rule Check for a SIL package",
01006 NULL
01007 },
01008 {
01009 "Default Element Values",
01010 sil_get_default_footprint_values,
01011 "Get default values for a selected SIL package",
01012 NULL
01013 },
01014 {
01015 "Write footprint",
01016 sil_write_footprint,
01017 "Write footprint for a selected SIL package",
01018 NULL
01019 }
01020 };
01021
01022
01026 REGISTER_FUNCTIONS (sil_function_list)
01027
01028
01029
01032 void
01033 sil_init ()
01034 {
01035 register_sil_function_list ();
01036 }
01037
01038
01039