Fix STM footprint to include TI-style pad with vias
[hw/telegps] / packages / footprint.5c
index 7d6fdcb05f0bc8c319552ba2ff425fcdace1a737..885c21a081060430889094610d992693a74fc5f1 100644 (file)
@@ -41,13 +41,59 @@ namespace Footprint {
                printf (")\n");
        }
        
-       public void pad_mm_clear(real center_x,
-                                real center_y,
-                                real width,
-                                real height,
-                                real clearance,
-                                string name,
-                                string num)
+       public void pad_mm_clear_mask_options(real center_x,
+                                             real center_y,
+                                             real width,
+                                             real height,
+                                             real clearance,
+                                             real mask,
+                                             string name,
+                                             string num,
+                                             string options)
+       {
+               real    x1 = 0;
+               real    y1 = 0;
+               real    x2 = 0;
+               real    y2 = 0;
+               real    thickness = 0;
+
+               if (width > height) {
+                       thickness = height;
+                       y1 = center_y;
+                       x1 = center_x - (width - height) / 2;
+                       y2 = center_y;
+                       x2 = center_x + (width - height) / 2;
+               } else {
+                       thickness = width;
+                       x1 = center_x;
+                       y1 = center_y - (height - width) / 2;
+                       x2 = center_x;
+                       y2 = center_y + (height - width) / 2;
+               }
+
+
+               printf ("    Pad[");
+               printf (" %6d %6d %6d %6d",
+                       mm2mils100(x1),
+                       mm2mils100(y1),
+                       mm2mils100(x2),
+                       mm2mils100(y2));
+               printf (" %6d %6d %6d",
+                       mm2mils100(thickness),
+                       mm2mils100(clearance),
+                       mm2mils100(mask));
+               printf (" \"%s\" \"%s\" \"square%s%s\"]\n",
+                       name, num, options == "" ? "" : ",", options);
+       }
+
+       public void pad_mm_clear_options(real center_x,
+                                        real center_y,
+                                        real width,
+                                        real height,
+                                        real clearance,
+                                        string name,
+                                        string num,
+                                        string options)
        {
                real    x1 = 0;
                real    y1 = 0;
@@ -81,8 +127,26 @@ namespace Footprint {
                        mm2mils100(thickness),
                        mm2mils100(clearance),
                        mm2mils100(mask));
-               printf (" \"%s\" \"%s\" \"square\"]\n",
-                       name, num);
+               printf (" \"%s\" \"%s\" \"square%s%s\"]\n",
+                       name, num, options == "" ? "" : ",", options);
+       }
+
+       public void pad_mm_clear(real center_x,
+                                real center_y,
+                                real width,
+                                real height,
+                                real clearance,
+                                string name,
+                                string num)
+       {
+               pad_mm_clear_options(center_x,
+                                    center_y,
+                                    width,
+                                    height,
+                                    clearance,
+                                    name,
+                                    num,
+                                    "");
        }
 
        public void pad_mm(real center_x,
@@ -122,6 +186,26 @@ namespace Footprint {
                       
        }
 
+       public void pin_mm_clear_mask(real x, real y,
+                                     real drill, real copper, real clearance, real mask,
+                                     string name, string number)
+       {
+               real thickness = drill + copper * 2;
+               printf("    Pin[");
+               printf(" %6d %6d",
+                      mm2mils100(x),
+                      mm2mils100(y));
+               printf(" %6d %6d %6d %6d",
+                      mm2mils100(thickness),
+                      mm2mils100(clearance),
+                      mm2mils100(mask),
+                      mm2mils100(drill));
+               printf (" \"%s\" \"%s\"",
+                       name, number);
+               printf (" \"\"]\n");
+                      
+       }
+
        public void pin_mm(real x, real y, real drill, real copper,
                        string name,
                        string number)