00001
00024 #include "register_functions.c"
00025 #include "resc.h"
00026
00033 int
00034 resc_create_element ()
00035 {
00036 gdouble xmax;
00037 gdouble xmin;
00038 gdouble ymax;
00039 gdouble ymin;
00040 gdouble x_text;
00041 gdouble y_text;
00042 gdouble dx;
00043 gint pin_number;
00044 gchar *pin_pad_name = g_strdup ("");
00045 FlagType pad_flag;
00046 ElementTypePtr element;
00047
00048 if (!element)
00049 {
00050 if (verbose)
00051 g_log ("", G_LOG_LEVEL_WARNING,
00052 _("could not create a valid element pointer for a %s package."),
00053 footprint_type);
00054 return (EXIT_FAILURE);
00055 }
00056
00057
00058 element->MarkX = 0;
00059 element->MarkY = 0;
00060
00061
00062 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00063 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00064 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00065 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00066
00067
00068 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00069 {
00070 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00071 }
00072 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00073 {
00074 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00075 }
00076 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00077 {
00078 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00079 }
00080 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00081 {
00082 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00083 }
00084
00085 if (multiplier * (-courtyard_length / 2.0) < xmin)
00086 {
00087 xmin = multiplier * (-courtyard_length / 2.0);
00088 }
00089 if (multiplier * (courtyard_length / 2.0) > xmax)
00090 {
00091 xmax = multiplier * (courtyard_length / 2.0);
00092 }
00093 if (multiplier * (-courtyard_width / 2.0) < ymin)
00094 {
00095 ymin = multiplier * (-courtyard_width / 2.0);
00096 }
00097 if (multiplier * (courtyard_width / 2.0) > ymax)
00098 {
00099 ymax = multiplier * (courtyard_width / 2.0);
00100 }
00101
00102 element->Name[1].Scale = 100;
00103 element->Name[1].X = 0.0 ;
00104 element->Name[1].Y = (ymin - 10000.0);
00105 element->Name[1].TextString = footprint_name;
00106 element->Name[1].Element = element;
00107 element->Name[1].Direction = EAST;
00108 element->Name[1].ID = ID++;
00109
00110 element->Name[2].Scale = 100;
00111 element->Name[2].X = 0.0 ;
00112 element->Name[2].Y = (ymin - 10000.0);
00113 element->Name[2].TextString = footprint_refdes;
00114 element->Name[2].Element = element;
00115 element->Name[2].Direction = EAST;
00116 element->Name[2].ID = ID++;
00117
00118 element->Name[3].Scale = 100;
00119 element->Name[3].X = 0.0 ;
00120 element->Name[3].Y = (ymin - 10000.0);
00121 element->Name[3].TextString = footprint_value;
00122 element->Name[3].Element = element;
00123 element->Name[3].Direction = EAST;
00124 element->Name[3].ID = ID++;
00125
00126 if (pad_shapes_type == SQUARE)
00127 {
00128 pad_flag.f = SQUARE;
00129 }
00130 else
00131 {
00132 pad_flag.f = CLEAR;
00133 }
00134 if (pad_length > pad_width)
00135 {
00136
00137 create_new_pad
00138 (
00139 element,
00140 (int) (multiplier * ((pitch_x - pad_length + pad_width) / 2.0)),
00141 0,
00142 (int) (multiplier * ((pitch_x + pad_length - pad_width) / 2.0)),
00143 0,
00144 (int) (multiplier * pad_width),
00145 (int) (multiplier * pad_clearance),
00146 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00147 "",
00148 "2",
00149 pad_flag
00150 );
00151
00152 if (pin1_square)
00153 {
00154 pad_flag.f = SQUARE;
00155 }
00156
00157 create_new_pad
00158 (
00159 element,
00160 (int) (multiplier * ((-pitch_x - pad_length + pad_width) / 2.0)),
00161 0,
00162 (int) (multiplier * ((-pitch_x + pad_length - pad_width) / 2.0)),
00163 0,
00164 (int) (multiplier * pad_width),
00165 (int) (multiplier * pad_clearance),
00166 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00167 "",
00168 "1",
00169 pad_flag
00170 );
00171 }
00172 else
00173 {
00174
00175 create_new_pad
00176 (
00177 element,
00178 (int) (multiplier * (pitch_x / 2.0)),
00179 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00180 (int) (multiplier * (pitch_x / 2.0)),
00181 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00182 (int) (multiplier * pad_length),
00183 (int) (multiplier * pad_clearance),
00184 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00185 "",
00186 "2",
00187 pad_flag
00188 );
00189
00190 if (pin1_square)
00191 {
00192 pad_flag.f = SQUARE;
00193 }
00194
00195 create_new_pad
00196 (
00197 element,
00198 (int) (multiplier * (-pitch_x / 2.0)),
00199 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00200 (int) (multiplier * (-pitch_x / 2)),
00201 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00202 (int) (multiplier * pad_length),
00203 (int) (multiplier * pad_clearance),
00204 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00205 "",
00206 "1",
00207 pad_flag
00208 );
00209 }
00210
00211 if (silkscreen_package_outline && package_body_width)
00212 {
00213 create_new_line
00214 (
00215 element,
00216 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00217 (int) (multiplier * (package_body_width / 2.0)),
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 * silkscreen_line_width)
00221 );
00222 create_new_line
00223 (
00224 element,
00225 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00226 (int) (multiplier * (-package_body_width / 2.0)),
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 * silkscreen_line_width)
00230 );
00231 }
00232
00233 if (silkscreen_indicate_1)
00234 {
00235
00236 }
00237
00238 if (courtyard)
00239 {
00240 create_new_line
00241 (
00242 element,
00243 (int) (xmin),
00244 (int) (ymin),
00245 (int) (xmin),
00246 (int) (ymax),
00247 (int) (multiplier * courtyard_line_width)
00248 );
00249 create_new_line
00250 (
00251 element,
00252 (int) (xmax),
00253 (int) (ymin),
00254 (int) (xmax),
00255 (int) (ymax),
00256 (int) (multiplier * courtyard_line_width)
00257 );
00258 create_new_line
00259 (
00260 element,
00261 (int) (xmin),
00262 (int) (ymin),
00263 (int) (xmax),
00264 (int) (ymin),
00265 (int) (multiplier * courtyard_line_width)
00266 );
00267 create_new_line
00268 (
00269 element,
00270 (int) (xmax),
00271 (int) (ymax),
00272 (int) (xmin),
00273 (int) (ymax),
00274 (int) (multiplier * courtyard_line_width)
00275 );
00276 }
00277
00278 if (attributes_in_footprint)
00279 {
00280 element = create_attributes_in_element (element);
00281 }
00282
00283 if (verbose)
00284 {
00285 g_log ("", G_LOG_LEVEL_INFO,
00286 _("created an element for a %s package: %s."),
00287 footprint_type,
00288 footprint_filename);
00289 }
00290 current_element = (ElementTypePtr) &element;
00291 return (EXIT_SUCCESS);
00292 }
00293
00294
00304 int
00305 resc_create_packages_list ()
00306 {
00307 g_list_free (packages_list);
00308 packages_list = g_list_append (packages_list, "RESC");
00309 return (EXIT_SUCCESS);
00310 }
00311
00312
00342 int
00343 resc_drc ()
00344 {
00345 int result = EXIT_SUCCESS;
00346 if (verbose)
00347 {
00348 g_log ("", G_LOG_LEVEL_INFO,
00349 (_("[%s] DRC Check: checking package %s.")),
00350 footprint_type, footprint_name);
00351 }
00352
00353 if (number_of_pins != 2)
00354 {
00355 if (verbose)
00356 {
00357 g_log ("", G_LOG_LEVEL_WARNING,
00358 (_("[%s] DRC Error: check for number of pins/pads <> 2.")),
00359 footprint_type);
00360 }
00361 result = EXIT_FAILURE;
00362 }
00363
00364 switch (pad_shapes_type)
00365 {
00366 case NO_SHAPE:
00367 {
00368 if (verbose)
00369 {
00370 g_log ("", G_LOG_LEVEL_WARNING,
00371 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00372 footprint_type);
00373 }
00374 result = EXIT_FAILURE;
00375 break;
00376 }
00377 case ROUND:
00378 {
00379 if (verbose)
00380 {
00381 g_log ("", G_LOG_LEVEL_WARNING,
00382 (_("[%s] DRC Error: circular pad shape specified for check for allowed pad shapes.")),
00383 footprint_type);
00384 }
00385 result = EXIT_FAILURE;
00386 break;
00387 }
00388 case SQUARE:
00389 {
00390 break;
00391 }
00392 case OCTAGONAL:
00393 {
00394 if (verbose)
00395 {
00396 g_log ("", G_LOG_LEVEL_WARNING,
00397 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00398 footprint_type);
00399 }
00400 result = EXIT_FAILURE;
00401 break;
00402 }
00403 case ROUND_ELONGATED:
00404 {
00405 break;
00406 }
00407 default:
00408 {
00409 if (verbose)
00410 {
00411 g_log ("", G_LOG_LEVEL_WARNING,
00412 (_("[%s] DRC Error: no valid pad shape type specified.")),
00413 footprint_type);
00414 }
00415 result = EXIT_FAILURE;
00416 break;
00417 }
00418 }
00419
00420 if (package_body_length <= 0.0)
00421 {
00422 if (verbose)
00423 {
00424 g_log ("", G_LOG_LEVEL_WARNING,
00425 (_("[%s] DRC Error: check for package body length is <= 0.0.")),
00426 footprint_type);
00427 }
00428 result = EXIT_FAILURE;
00429 }
00430 if (package_body_width <= 0.0)
00431 {
00432 if (verbose)
00433 {
00434 g_log ("", G_LOG_LEVEL_WARNING,
00435 (_("[%s] DRC Error: check for package body width is <= 0.0.")),
00436 footprint_type);
00437 }
00438 result = EXIT_FAILURE;
00439 }
00440 if (package_body_height <= 0.0)
00441 {
00442 if (verbose)
00443 {
00444 g_log ("", G_LOG_LEVEL_WARNING,
00445 (_("[%s] DRC Error: check for package body height is <= 0.0.")),
00446 footprint_type);
00447 }
00448 result = EXIT_FAILURE;
00449 }
00450
00451 if (courtyard_length <= 0.0)
00452 {
00453 if (verbose)
00454 {
00455 g_log ("", G_LOG_LEVEL_WARNING,
00456 (_("[%s] DRC Error: check for courtyard length is <= 0.0.")),
00457 footprint_type);
00458 }
00459 result = EXIT_FAILURE;
00460 }
00461 if (courtyard_width <= 0.0)
00462 {
00463 if (verbose)
00464 {
00465 g_log ("", G_LOG_LEVEL_WARNING,
00466 (_("[%s] DRC Error: check for courtyard width is <= 0.0.")),
00467 footprint_type);
00468 }
00469 return (EXIT_FAILURE);
00470 }
00471
00472 if (pitch_x - pad_length < pad_clearance)
00473 {
00474 if (verbose)
00475 {
00476 g_log ("", G_LOG_LEVEL_WARNING,
00477 (_("[%s] DRC Error: check for minimum clearance between copper (X-direction).")),
00478 footprint_type);
00479 }
00480 result = EXIT_FAILURE;
00481 }
00482
00483 if (pitch_y - pad_width < pad_clearance)
00484 {
00485 if (verbose)
00486 {
00487 g_log ("", G_LOG_LEVEL_WARNING,
00488 (_("[%s] DRC Error: check for minimum clearance between copper (Y-direction).")),
00489 footprint_type);
00490 }
00491 result = EXIT_FAILURE;
00492 }
00493
00494 if (fiducial)
00495 {
00496 if (verbose)
00497 {
00498 g_log ("", G_LOG_LEVEL_WARNING,
00499 (_("[%s] DRC Error: check for fiducials, package should not have fiducials.")),
00500 footprint_type);
00501 }
00502 result = EXIT_FAILURE;
00503 }
00504
00505
00506 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00507 {
00508 if (verbose)
00509 {
00510 g_log ("", G_LOG_LEVEL_WARNING,
00511 (_("[%s] DRC Error: check for clearance of the package length with regard to the courtyard dimensions.")),
00512 footprint_type);
00513 }
00514 result = EXIT_FAILURE;
00515 }
00516
00517
00518 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00519 {
00520 if (verbose)
00521 {
00522 g_log ("", G_LOG_LEVEL_WARNING,
00523 (_("[%s] DRC Error: check for clearance of the package width with regard to the courtyard dimensions.")),
00524 footprint_type);
00525 }
00526 result = EXIT_FAILURE;
00527 }
00533
00534 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00535 {
00536 if (verbose)
00537 {
00538 g_log ("", G_LOG_LEVEL_WARNING,
00539 (_("[%s] DRC Error: line width 0.0 specified for check for a reasonable silk line width.")),
00540 footprint_type);
00541 }
00542 result = EXIT_FAILURE;
00543 }
00544 switch (units_type)
00545 {
00546 case NO_UNITS:
00547 {
00548 if (verbose)
00549 {
00550 g_log ("", G_LOG_LEVEL_WARNING,
00551 (_("[%s] DRC Error: no units specified for check for a reasonable silk line width.")),
00552 footprint_type);
00553 }
00554 result = EXIT_FAILURE;
00555 break;
00556 }
00557 case MIL:
00558 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00559 {
00560 if (verbose)
00561 {
00562 g_log ("", G_LOG_LEVEL_WARNING,
00563 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00564 footprint_type);
00565 }
00566 result = EXIT_FAILURE;
00567 break;
00568 }
00569 case MIL_100:
00570 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00571 {
00572 if (verbose)
00573 {
00574 g_log ("", G_LOG_LEVEL_WARNING,
00575 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00576 footprint_type);
00577 }
00578 result = EXIT_FAILURE;
00579 break;
00580 }
00581 case MM:
00582 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00583 {
00584 if (verbose)
00585 {
00586 g_log ("", G_LOG_LEVEL_WARNING,
00587 (_("[%s] DRC Error: line width > 1.0 mm specified check for a reasonable silk line width.")),
00588 footprint_type);
00589 }
00590 result = EXIT_FAILURE;
00591 break;
00592 }
00593 default:
00594 {
00595 if (verbose)
00596 {
00597 g_log ("", G_LOG_LEVEL_WARNING,
00598 (_("[%s] DRC Error: no valid units type specified for check for a reasonable silk line width.")),
00599 footprint_type);
00600 }
00601 result = EXIT_FAILURE;
00602 break;
00603 }
00604 }
00605
00606 if (verbose && (result == EXIT_SUCCESS))
00607 {
00608 g_log ("", G_LOG_LEVEL_INFO,
00609 (_("[%s] DRC Check: no errors while checking package %s.")),
00610 footprint_type, footprint_name);
00611 }
00612 return result;
00613 }
00614
00615
00629 int
00630 resc_get_default_footprint_values ()
00631 {
00632 if (!strcmp (footprint_name, "?RESC"))
00633 {
00634 number_of_pins = 2;
00635 package_body_length = 0.0;
00636 package_body_width = 0.0;
00637 package_body_height = 0.0;
00638 package_is_radial = FALSE;
00639 number_of_columns = 0;
00640 number_of_rows = 0;
00641 pitch_x = 0.0;
00642 pitch_y = 0.0;
00643 pad_length = 0.0;
00644 pad_width = 0.0;
00645 pad_shape = g_strdup ("rectangular pad");
00646 pad_shapes_type = SQUARE;
00647 thermal = FALSE;
00648 thermal_length = 0.0;
00649 thermal_width = 0.0;
00650 silkscreen_package_outline = FALSE;
00651 silkscreen_length = 0.0;
00652 silkscreen_width = 0.0;
00653 courtyard_length = 0.0;
00654 courtyard_width = 0.0;
00655 count_x = 0;
00656 count_y = 0;
00657 footprint_units = g_strdup ("mm");
00658 g_free (footprint_name);
00659 footprint_name = g_strdup ("RESC");
00660 return (EXIT_SUCCESS);
00661 }
00662 else
00663 {
00664 g_log ("", G_LOG_LEVEL_WARNING,
00665 _("default values for footprint %s not found.\n"),
00666 footprint_name);
00667 return (EXIT_FAILURE);
00668 }
00669 }
00670
00671
00672 #if GUI
00673
00680 int
00681 resc_set_gui_constraints ()
00682 {
00683
00684 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00685 "package_is_radial_checkbutton");
00686 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00687 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00688
00689
00690 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00691 "number_of_columns_entry");
00692 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
00693 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00694 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00695 "number_of_rows_entry");
00696 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "1");
00697 gtk_widget_set_sensitive (number_of_rows_entry, FALSE);
00698 GtkWidget *pitch_y_entry = lookup_widget (GTK_WIDGET (widget),
00699 "pitch_y_entry");
00700 gtk_entry_set_text (GTK_ENTRY (pitch_y_entry), "");
00701 gtk_widget_set_sensitive (pitch_y_entry, FALSE);
00702 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00703 "count_x_entry");
00704 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00705 gtk_widget_set_sensitive (count_x_entry, FALSE);
00706 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00707 "count_y_entry");
00708 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00709 gtk_widget_set_sensitive (count_y_entry, FALSE);
00710 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00711 "number_1_position_entry");
00712 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00713 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00714
00715
00716 gui_constraints_disable_thermal_tab_widgets (widget);
00717
00718
00719 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00720 return (EXIT_SUCCESS);
00721 }
00722 #endif
00723
00724
00731 int
00732 resc_write_footprint ()
00733 {
00734 gdouble xmax;
00735 gdouble xmin;
00736 gdouble ymax;
00737 gdouble ymin;
00738 gdouble x_text;
00739 gdouble y_text;
00740 gchar *pin_pad_flags = g_strdup ("");
00741
00742
00743 fp = fopen (footprint_filename, "w");
00744 if (!fp)
00745 {
00746 g_log ("", G_LOG_LEVEL_WARNING,
00747 _("could not open file for %s footprint: %s."),
00748 footprint_type, footprint_filename);
00749 fclose (fp);
00750 return (EXIT_FAILURE);
00751 }
00752
00753 if (license_in_footprint)
00754 {
00755 write_license ();
00756 }
00757
00758
00759 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00760 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00761 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00762 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00763
00764
00765 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00766 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00767 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00768 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00769 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00770 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00771 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00772 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00773
00774 if (multiplier * (-courtyard_length / 2.0) < xmin)
00775 xmin = multiplier * (-courtyard_length / 2.0);
00776 if (multiplier * (courtyard_length / 2.0) > xmax)
00777 xmax = multiplier * (courtyard_length / 2.0);
00778 if (multiplier * (-courtyard_width / 2.0) < ymin)
00779 ymin = multiplier * (-courtyard_width / 2.0);
00780 if (multiplier * (courtyard_width / 2.0) > ymax)
00781 ymax = multiplier * (courtyard_width / 2.0);
00782
00783
00784 x_text = 0.0 ;
00785 y_text = (ymin - 10000.0);
00786 write_element_header (x_text, y_text);
00787
00788 if (!strcmp (pad_shape, "rectangular pad"))
00789 pin_pad_flags = g_strdup ("square");
00790 if (pad_length > pad_width)
00791 {
00792
00793 write_pad
00794 (
00795 1,
00796 "",
00797 multiplier * ((-pitch_x - pad_length + pad_width) / 2.0),
00798 0,
00799 multiplier * ((-pitch_x + pad_length - pad_width) / 2.0),
00800 0,
00801 multiplier * pad_width,
00802 multiplier * pad_clearance,
00803 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00804
00805 (pin1_square) ? "square" : pin_pad_flags
00806 );
00807
00808 write_pad
00809 (
00810 2,
00811 "",
00812 multiplier * ((pitch_x - pad_length + pad_width) / 2.0),
00813 0,
00814 multiplier * ((pitch_x + pad_length - pad_width) / 2.0),
00815 0,
00816 multiplier * pad_width,
00817 multiplier * pad_clearance,
00818 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00819 pin_pad_flags
00820 );
00821 }
00822 else
00823 {
00824
00825 write_pad
00826 (
00827 1,
00828 "",
00829 multiplier * (-pitch_x / 2.0),
00830 multiplier * ((pad_width - pad_length) / 2.0),
00831 multiplier * (-pitch_x / 2),
00832 multiplier * ((-pad_width + pad_length) / 2.0),
00833 multiplier * pad_length,
00834 multiplier * pad_clearance,
00835 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00836
00837 (pin1_square) ? "square" : pin_pad_flags
00838 );
00839
00840 write_pad
00841 (
00842 2,
00843 "",
00844 multiplier * (pitch_x / 2.0),
00845 multiplier * ((pad_width - pad_length) / 2.0),
00846 multiplier * (pitch_x / 2.0),
00847 multiplier * ((-pad_width + pad_length) / 2.0),
00848 multiplier * pad_length,
00849 multiplier * pad_clearance,
00850 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00851 pin_pad_flags
00852 );
00853 }
00854
00855 if (silkscreen_package_outline && (package_body_width))
00856 {
00857 fprintf (fp, "# Write a package body on the silkscreen\n");
00858 write_element_line
00859 (
00860 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00861 multiplier * (package_body_width / 2.0),
00862 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00863 multiplier * (package_body_width / 2.0),
00864 multiplier * silkscreen_line_width
00865 );
00866 write_element_line
00867 (
00868 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00869 multiplier * (-package_body_width / 2.0),
00870 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00871 multiplier * (-package_body_width / 2.0),
00872 multiplier * silkscreen_line_width
00873 );
00874 }
00875
00876 if (silkscreen_indicate_1)
00877 {
00878
00879 }
00880
00881 if (courtyard)
00882 {
00883 fprintf (fp, "# Write a courtyard on the silkscreen\n");
00884 write_rectangle
00885 (
00886 xmin,
00887 ymin,
00888 xmax,
00889 ymax,
00890 multiplier * courtyard_line_width
00891 );
00892 }
00893
00894 if (attributes_in_footprint)
00895 {
00896 write_attributes ();
00897 }
00898
00899 fprintf (fp, "\n");
00900 fprintf (fp, ")\n");
00901 fclose (fp);
00902
00903 if (verbose)
00904 {
00905 g_log ("", G_LOG_LEVEL_INFO,
00906 _("wrote a footprint for a %s package: %s."),
00907 footprint_type,
00908 footprint_filename);
00909 }
00910 return (EXIT_SUCCESS);
00911 }
00912
00913
00917 static fpw_function_t
00918 resc_function_list[] =
00919 {
00920 #if GUI
00921 {
00922 "Set GUI constraints",
00923 resc_set_gui_constraints,
00924 "Set GUI constraints for a RESC SMT package",
00925 NULL
00926 },
00927 #endif
00928 {
00929 "Create Element",
00930 resc_create_element,
00931 "Create a pcb element for a RESC package",
00932 NULL
00933 },
00934 {
00935 "Create Packages List",
00936 resc_create_packages_list,
00937 "Create a list of known packages",
00938 NULL
00939 },
00940 {
00941 "DRC RESC Element",
00942 resc_drc,
00943 "Design Rule Check for a RESC package",
00944 NULL
00945 },
00946 {
00947 "Default Element Values",
00948 resc_get_default_footprint_values,
00949 "Get default values for a RESC SMT package",
00950 NULL
00951 },
00952 {
00953 "Write footprint",
00954 resc_write_footprint,
00955 "Write a footprint for a RESC SMT package",
00956 NULL
00957 }
00958 };
00959
00960
00964 REGISTER_FUNCTIONS (resc_function_list)
00965
00966
00969 void
00970 resc_init ()
00971 {
00972 register_resc_function_list ();
00973 }
00974
00975
00976