def side_pth_fab(pins): out = [] w = fab_width centre = (0, -2.6) # Draw outline nw, ne, se, sw, _ = draw_square(2.5 * (pins - 1) + 5, 8.2, centre, "F.Fab", w) out.append(fp_line(nw, ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, (se[0] - 1, se[1]), "F.Fab", w)) out.append( fp_line((se[0] - 1, se[1]), (se[0] - 1, se[1] - 2.2), "F.Fab", w)) out.append( fp_line((se[0] - 1, se[1] - 2.2), (sw[0] + 1, sw[1] - 2.2), "F.Fab", w)) out.append(fp_line(nw, sw, "F.Fab", w)) out.append(fp_line(sw, (sw[0] + 1, sw[1]), "F.Fab", w)) out.append( fp_line((sw[0] + 1, sw[1]), (sw[0] + 1, sw[1] - 2.2), "F.Fab", w)) # Draw the pins x = 1.25 * (pins - 1) for pin in range(pins): sq = draw_square(0.5, 0.75, (x, -0.125), "F.Fab", fab_width) out += sq[4] out.append( fp_line((x - .25, -.25), (x + .25, -.25), "F.Fab", fab_width)) x -= 2.5 return out
def side_smd_fab(pins): out = [] w = fab_width # Draw outline nw, ne, se, sw, sq = draw_square(2 * pins + 4, 8.9, (0, -3.5), "F.Fab", w) out.append(fp_line(nw, (nw[0] + 3, nw[1]), "F.Fab", w)) out.append( fp_line((nw[0] + 3, nw[1]), (nw[0] + 3, nw[1] + 1.4), "F.Fab", w)) out.append( fp_line((nw[0] + 3, nw[1] + 1.4), (ne[0] - 3, ne[1] + 1.4), "F.Fab", w)) out.append( fp_line((ne[0] - 3, ne[1] + 1.4), (ne[0] - 3, ne[1]), "F.Fab", w)) out.append(fp_line((ne[0] - 3, ne[1]), ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, sw, "F.Fab", w)) out.append(fp_line(sw, nw, "F.Fab", w)) # Draw pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(0.5, 2.5, (x, 2.5 / 2), "F.Fab", w) out += sq x -= 2 return out
def side_pth_fab(pins): out = [] w = fab_width centre = (0, -2.35) # Draw outline nw, ne, se, sw, _ = draw_square(2*(pins-1)+4, 11.7, centre, "F.Fab", w) out.append(fp_line(nw, ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, (se[0]-1, se[1]), "F.Fab", w)) out.append(fp_line((se[0]-1, se[1]), (se[0]-1, se[1]-4), "F.Fab", w)) out.append(fp_line((se[0]-1, se[1]-4), (sw[0]+1, sw[1]-4), "F.Fab", w)) out.append(fp_line(nw, sw, "F.Fab", w)) out.append(fp_line(sw, (sw[0]+1, sw[1]), "F.Fab", w)) out.append(fp_line((sw[0]+1, sw[1]), (sw[0]+1, sw[1]-4), "F.Fab", w)) # Draw side legs x = (2*(pins-1)+4)//2 - 0.3 _, _, _, _, sq = draw_square(0.6, 0.8, (x, -2.1), "F.Fab", w) out += sq _, _, _, _, sq = draw_square(0.6, 0.8, (-x, -2.1), "F.Fab", w) out += sq # Draw the pins x = pins - 1 for pin in range(pins): sq = draw_square(0.5, 0.75, (x, -0.125), "F.Fab", fab_width) out += sq[4] out.append(fp_line((x-.25, -.25), (x+.25, -.25), "F.Fab", fab_width)) x -= 2 return out
def side_pth_fab(pins): out = [] w = fab_width centre = (0, -2.35) # Draw outline nw, ne, se, sw, _ = draw_square(2 * (pins - 1) + 4, 11.7, centre, "F.Fab", w) out.append(fp_line(nw, ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, (se[0] - 1, se[1]), "F.Fab", w)) out.append(fp_line((se[0] - 1, se[1]), (se[0] - 1, se[1] - 4), "F.Fab", w)) out.append( fp_line((se[0] - 1, se[1] - 4), (sw[0] + 1, sw[1] - 4), "F.Fab", w)) out.append(fp_line(nw, sw, "F.Fab", w)) out.append(fp_line(sw, (sw[0] + 1, sw[1]), "F.Fab", w)) out.append(fp_line((sw[0] + 1, sw[1]), (sw[0] + 1, sw[1] - 4), "F.Fab", w)) # Draw side legs x = (2 * (pins - 1) + 4) // 2 - 0.3 _, _, _, _, sq = draw_square(0.6, 0.8, (x, -2.1), "F.Fab", w) out += sq _, _, _, _, sq = draw_square(0.6, 0.8, (-x, -2.1), "F.Fab", w) out += sq # Draw the pins x = pins - 1 for pin in range(pins): sq = draw_square(0.5, 0.75, (x, -0.125), "F.Fab", fab_width) out += sq[4] out.append( fp_line((x - .25, -.25), (x + .25, -.25), "F.Fab", fab_width)) x -= 2 return out
def fab(conf): """ Generate a drawing of the chip on the Fab layer, including its outline, the outline of the pins, and a pin 1 indicator. """ chip_w, chip_h = conf['chip_shape'] pin_w, pin_h = conf['pin_shape'] out = [] # Chip outline nw, _, _, _, sq = draw_square(chip_w, chip_h, (0, 0), "F.Fab", fab_width) out += sq # Pin 1 centre = (nw[0] + fab_pin1_offset, nw[1] + fab_pin1_offset) end = (centre[0], centre[1] + fab_pin1_r) out.append(fp_circle(centre, end, "F.Fab", fab_width)) # Pins leftr, bottomr, rightr, topr = pin_centres(conf) idx = 1 for pin in leftr: idx += 1 if idx - 1 in conf.get('skip_pins', []): continue xy = -(chip_w + pin_w) / 2.0, pin[1] _, _, _, _, sq = draw_square(pin_w, pin_h, xy, "F.Fab", fab_width) out += [sq[0], sq[2], sq[3]] for pin in rightr: idx += 1 if idx - 1 in conf.get('skip_pins', []): continue xy = (chip_w + pin_w) / 2.0, pin[1] _, _, _, _, sq = draw_square(pin_w, pin_h, xy, "F.Fab", fab_width) out += [sq[0], sq[1], sq[2]] if conf['rows'] == 4: for pin in topr: idx += 1 if idx - 1 in conf.get('skip_pins', []): continue xy = pin[0], -(chip_h + pin_w) / 2.0 _, _, _, _, sq = draw_square(pin_h, pin_w, xy, "F.Fab", fab_width) out += [sq[0], sq[1], sq[3]] for pin in bottomr: idx += 1 if idx - 1 in conf.get('skip_pins', []): continue xy = pin[0], (chip_h + pin_w) / 2.0 _, _, _, _, sq = draw_square(pin_h, pin_w, xy, "F.Fab", fab_width) out += [sq[1], sq[2], sq[3]] return out
def ctyd(conf): row_pitch = conf['row_pitch'] pad_w, pad_h = conf['pad_shape'] chip_w, chip_h = conf['chip_shape'] if conf['rows'] == 2: width = row_pitch + pad_w + 2 * ctyd_gap height = chip_h + 2 * ctyd_gap elif conf['rows'] == 4: # We need to handle non-square chips slightly differently, # depending on whether row_pitch is given as (w, h) or just a scalar. if isinstance(row_pitch, float): height = width = row_pitch + pad_w + 2 * ctyd_gap else: width = row_pitch[0] + pad_w + 2 * ctyd_gap height = row_pitch[1] + pad_w + 2 * ctyd_gap # Ensure courtyard lies on a specified grid # (double the grid since we halve the width/height) grid = 2*ctyd_grid width = grid * int(math.ceil(width / (2*ctyd_grid))) height = grid * int(math.ceil(height / (2*ctyd_grid))) _, _, _, _, sq = draw_square(width, height, (0, 0), "F.CrtYd", ctyd_width) return sq
def top_smd_fab(pins): out = [] w = fab_width # Outline _, _, _, _, sq = draw_square(2*pins+4, 5.7, (0, 3.35), "F.Fab", w) out += sq # Pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(0.5, 2.5, (x, -0), "F.Fab", w) out += sq x -= 2 return out
def ctyd(conf): chip_w, chip_h = conf['chip_shape'] if 'cols' in conf: width, height = chip_w + 2 * ctyd_gap, chip_h + 2 * ctyd_gap elif conf['rows'] == 2: pad_w, pad_h = conf['pad_shape'] row_pitch = conf['row_pitch'] width = row_pitch + pad_w + 2 * ctyd_gap height = chip_h + 2 * ctyd_gap elif conf['rows'] == 4: pad_w, pad_h = conf['pad_shape'] row_pitch = conf['row_pitch'] # We need to handle non-square chips slightly differently, # depending on whether row_pitch is given as (w, h) or just a scalar. if isinstance(row_pitch, float): height = width = row_pitch + pad_w + 2 * ctyd_gap else: width = row_pitch[0] + pad_w + 2 * ctyd_gap height = row_pitch[1] + pad_w + 2 * ctyd_gap # Ensure courtyard lies on a specified grid # (double the grid since we halve the width/height) grid = 2 * ctyd_grid width = grid * int(math.ceil(width / (2 * ctyd_grid))) height = grid * int(math.ceil(height / (2 * ctyd_grid))) _, _, _, _, sq = draw_square(width, height, (0, 0), "F.CrtYd", ctyd_width) return sq
def fab(conf): """Generate a drawing of the chip on the Fab layer.""" out = [] cw, ch = conf['chip_shape'] pw, ph = conf['pin_shape'] w = fab_width # Chip body _, _, _, _, sq = draw_square(cw, ch, (0, 0), "F.Fab", w) out += sq # Pin 1 indicator if conf.get('silk') in ("triangle", "internal_pin1", "external_pin1"): out.append(fp_line( (-cw/4, -ch/2), (-cw/4, ch/2), "F.Fab", w)) # Left pin out.append(fp_line((-cw/2 - pw, -ph/2), (-cw/2 - pw, ph/2), "F.Fab", w)) if ph != ch: out.append(fp_line((-cw/2 - pw, -ph/2), (-cw/2, -ph/2), "F.Fab", w)) out.append(fp_line((-cw/2 - pw, ph/2), (-cw/2, ph/2), "F.Fab", w)) # Right pin out.append(fp_line((cw/2 + pw, -ph/2), (cw/2 + pw, ph/2), "F.Fab", w)) if ph != ch: out.append(fp_line((cw/2 + pw, -ph/2), (cw/2, -ph/2), "F.Fab", w)) out.append(fp_line((cw/2 + pw, ph/2), (cw/2, ph/2), "F.Fab", w)) return out
def sfml_silk(pins): out = [] l = "F.SilkS" w = silk_width a_x = (3.94 - 0.38) / 2.0 a_y = (3.05 - 1.52) / 2.0 nw, ne, se, sw, _ = draw_square(pins * 1.27 + 0.38 - w, 3.05 - w, (0, 0), l, w) out.append(fp_line(ne, (ne[0], ne[1] + a_y), l, w)) out.append(fp_line((ne[0], ne[1] + a_y), (ne[0] + a_x, ne[1] + a_y), l, w)) out.append( fp_line((ne[0] + a_x, ne[1] + a_y), (se[0] + a_x, se[1] - a_y), l, w)) out.append(fp_line((se[0] + a_x, se[1] - a_y), (se[0], se[1] - a_y), l, w)) out.append(fp_line((se[0], se[1] - a_y), se, l, w)) out.append(fp_line(se, (se[0] - 0.3, se[1]), l, w)) out.append(fp_line((sw[0] + 0.3, sw[1]), sw, l, w)) out.append(fp_line(sw, (sw[0], sw[1] - a_y), l, w)) out.append(fp_line((sw[0], sw[1] - a_y), (sw[0] - a_x, sw[1] - a_y), l, w)) out.append( fp_line((sw[0] - a_x, sw[1] - a_y), (nw[0] - a_x, nw[1] + a_y), l, w)) out.append(fp_line((nw[0] - a_x, nw[1] + a_y), (nw[0], nw[1] + a_y), l, w)) out.append(fp_line((nw[0], nw[1] + a_y), nw, l, w)) return out
def top_smd_fab(pins): out = [] w = fab_width # Outline _, _, _, _, sq = draw_square(2 * pins + 4, 5.7, (0, 3.35), "F.Fab", w) out += sq # Pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(0.5, 2.5, (x, -0), "F.Fab", w) out += sq x -= 2 return out
def ctyd(pins, h): w = pins * 2.54 + 2 * ctyd_gap h = h + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / grid)) h = grid * int(math.ceil(h / grid)) _, _, _, _, sq = draw_square(w, h, (0, 0), "F.CrtYd", ctyd_width) return sq
def top_pth_ctyd(pins): w = 2 * (pins - 1) + 4 + 2 * ctyd_gap h = 5.3 + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / grid)) h = grid * int(math.ceil(h / grid)) _, _, _, _, sq = draw_square(w, h, (0, 0), "F.CrtYd", ctyd_width) return sq
def top_pth_ctyd(pins): w = 2*(pins-1)+4 + 2*ctyd_gap h = 5.3 + 2*ctyd_gap grid = 2*ctyd_grid w = grid * int(math.ceil(w / grid)) h = grid * int(math.ceil(h / grid)) _, _, _, _, sq = draw_square(w, h, (0, 0), "F.CrtYd", ctyd_width) return sq
def dil_ctyd(pins): w = pins * 2.54 + 2 * ctyd_gap h = 2*2.54 + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / grid)) h = grid * int(math.ceil(h / grid)) _, _, _, _, sq = draw_square(w, h, (0, 0), "F.CrtYd", ctyd_width) return sq
def ctyd(pins): w = pins * 1.27 + 3.94 + 2 * ctyd_gap h = 6.35 + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / grid)) h = grid * int(math.ceil(h / grid)) _, _, _, _, sq = draw_square(w, h, (0, 0), "F.CrtYd", ctyd_width) return sq
def side_pth_ctyd(pins): w = 2*(pins-1)+4 + 2*ctyd_gap h = 11.7 + 2*ctyd_gap grid = 2*ctyd_grid w = grid * int(math.ceil(w / (2*ctyd_grid))) h = grid * int(math.ceil(h / (2*ctyd_grid))) centre = (0, -2.35) _, _, _, _, sq = draw_square(w, h, centre, "F.CrtYd", ctyd_width) return sq
def side_pth_ctyd(pins): w = 2 * (pins - 1) + 4 + 2 * ctyd_gap h = 11.7 + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / (2 * ctyd_grid))) h = grid * int(math.ceil(h / (2 * ctyd_grid))) centre = (0, -2.35) _, _, _, _, sq = draw_square(w, h, centre, "F.CrtYd", ctyd_width) return sq
def side_smd_ctyd(pins): w = 2 * (pins - 1 + 1.45 + 1.8 + ctyd_gap) h = 3.0 + 7.8 + 2 * ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / (2 * ctyd_grid))) h = grid * int(math.ceil(h / (2 * ctyd_grid))) centre = (0, -2.55) _, _, _, _, sq = draw_square(w, h, centre, "F.CrtYd", ctyd_width) return sq
def side_smd_ctyd(pins): w = 2 * (pins - 1 + 1.45 + 1.8 + ctyd_gap) h = 3.0 + 7.8 + 2*ctyd_gap grid = 2*ctyd_grid w = grid * int(math.ceil(w / (2*ctyd_grid))) h = grid * int(math.ceil(h / (2*ctyd_grid))) centre = (0, -2.55) _, _, _, _, sq = draw_square(w, h, centre, "F.CrtYd", ctyd_width) return sq
def top_smd_ctyd(pins): w = 1.25*(pins-1) + 2*3.6 + 2*ctyd_gap h = 3.0 + 0.6 + 1.3 + 2*ctyd_gap grid = 2 * ctyd_grid w = grid * int(math.ceil(w / (2*ctyd_grid))) h = grid * int(math.ceil(h / (2*ctyd_grid))) y = h/2 - 1.3/2 - ctyd_gap centre = (0, y) _, _, _, _, sq = draw_square(w, h, centre, "F.CrtYd", ctyd_width) return sq
def top_pth_fab(pins): out = [] # Draw outline _, _, _, _, sq = draw_square(2*(pins-1)+4, 5.3, (0, 0), "F.Fab", fab_width) out += sq # Draw side leg x = pins - 1 + 1.5 _, _, _, _, sq = draw_square(.8, .8, (x, -1.7), "F.Fab", fab_width) out += sq # Draw pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(.5, .5, (x, 0), "F.Fab", fab_width) out += sq x -= 2 return out
def dil_silk(pins): nw, ne, se, sw, _ = draw_square(pins * 2.54, 2 * 2.54, (0, 0), "F.SilkS", silk_width) layer = "F.SilkS" w = silk_width out = [] out.append(fp_line(nw, ne, layer, w)) out.append(fp_line(ne, se, layer, w)) out.append(fp_line(se, (1.27, se[1]), layer, w)) out.append(fp_line((-1.27, sw[1]), sw, layer, w)) out.append(fp_line(sw, nw, layer, w)) return out
def dil_silk(pins): nw, ne, se, sw, _ = draw_square( pins * 2.54, 2*2.54, (0, 0), "F.SilkS", silk_width) l = "F.SilkS" w = silk_width out = [] out.append(fp_line(nw, ne, l, w)) out.append(fp_line(ne, se, l, w)) out.append(fp_line(se, (1.27, se[1]), l, w)) out.append(fp_line((-1.27, sw[1]), sw, l, w)) out.append(fp_line(sw, nw, l, w)) return out
def top_pth_fab(pins): out = [] # Draw outline _, _, _, _, sq = draw_square(2 * (pins - 1) + 4, 5.3, (0, 0), "F.Fab", fab_width) out += sq # Draw side leg x = pins - 1 + 1.5 _, _, _, _, sq = draw_square(.8, .8, (x, -1.7), "F.Fab", fab_width) out += sq # Draw pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(.5, .5, (x, 0), "F.Fab", fab_width) out += sq x -= 2 return out
def tfml_silk(pins): out = [] l = "F.SilkS" w = silk_width nw, ne, se, sw, _ = draw_square( pins * 1.27 + 3.18 - w, 5.72 - w, (0, 0), l, w) out.append(fp_line((nw[0]+1.5, nw[1]), nw, l, w)) out.append(fp_line(nw, sw, l, w)) out.append(fp_line(sw, (sw[0]+1.5, sw[1]), l, w)) out.append(fp_line((se[0]-1.5, se[1]), (se[0], se[1]-1.5), l, w)) out.append(fp_line((se[0], se[1]-1.5), (ne[0], ne[1]+1.5), l, w)) out.append(fp_line((ne[0], ne[1]+1.5), (ne[0]-1.5, ne[1]), l, w)) return out
def top_smd_fab(pins): out = [] w = fab_width lyr = "F.Fab" # Outline box box_w = (pins-1)*1.25 + 2*3.6 - 2*2.1 box_h = 3.5 # XXX box_y = box_h/2 + 0.2 nw, ne, se, sw, sq = draw_square(box_w, box_h, (0, box_y), lyr, w) out += sq # Mounting pins _, _, _, _, sq = draw_square(1.8, 2.8, (nw[0]-1.8/2, sw[1]-2.8/2), lyr, w) out += sq _, _, _, _, sq = draw_square(1.8, 2.8, (ne[0]+1.8/2, sw[1]-2.8/2), lyr, w) out += sq # Connector pins x = -(pins-1)/2 * 1.25 for pin in range(pins): _, _, _, _, sq = draw_square(0.32, 0.6, (x, 2.6), lyr, w) out += sq x += 1.25 return out
def tfml_silk(pins): out = [] l = "F.SilkS" w = silk_width nw, ne, se, sw, _ = draw_square(pins * 1.27 + 3.18 - w, 5.72 - w, (0, 0), l, w) out.append(fp_line((nw[0] + 1.5, nw[1]), nw, l, w)) out.append(fp_line(nw, sw, l, w)) out.append(fp_line(sw, (sw[0] + 1.5, sw[1]), l, w)) out.append(fp_line((se[0] - 1.5, se[1]), (se[0], se[1] - 1.5), l, w)) out.append(fp_line((se[0], se[1] - 1.5), (ne[0], ne[1] + 1.5), l, w)) out.append(fp_line((ne[0], ne[1] + 1.5), (ne[0] - 1.5, ne[1]), l, w)) return out
def side_pth_silk(pins): out = [] w = silk_width centre = (0, -2.6) nw, ne, se, sw, _ = draw_square(2.5*(pins-1)+5, 8.2, centre, "F.SilkS", w) out.append(fp_line(nw, ne, "F.SilkS", w)) out.append(fp_line(ne, se, "F.SilkS", w)) out.append(fp_line(se, (se[0]-1, se[1]), "F.SilkS", w)) out.append(fp_line((se[0]-1, se[1]), (se[0]-1, se[1]-2.2), "F.SilkS", w)) out.append(fp_line(nw, sw, "F.SilkS", w)) out.append(fp_line(sw, (sw[0]+1, sw[1]), "F.SilkS", w)) out.append(fp_line((sw[0]+1, sw[1]), (sw[0]+1, sw[1]-2.2), "F.SilkS", w)) return out
def side_smd_fab(pins): out = [] w = fab_width # Draw outline nw, ne, se, sw, sq = draw_square(2*pins+4, 8.9, (0, -3.5), "F.Fab", w) out.append(fp_line(nw, (nw[0]+3, nw[1]), "F.Fab", w)) out.append(fp_line((nw[0]+3, nw[1]), (nw[0]+3, nw[1]+1.4), "F.Fab", w)) out.append(fp_line((nw[0]+3, nw[1]+1.4), (ne[0]-3, ne[1]+1.4), "F.Fab", w)) out.append(fp_line((ne[0]-3, ne[1]+1.4), (ne[0]-3, ne[1]), "F.Fab", w)) out.append(fp_line((ne[0]-3, ne[1]), ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, sw, "F.Fab", w)) out.append(fp_line(sw, nw, "F.Fab", w)) # Draw pins x = pins - 1 for pin in range(pins): _, _, _, _, sq = draw_square(0.5, 2.5, (x, 2.5/2), "F.Fab", w) out += sq x -= 2 return out
def side_pth_silk(pins): out = [] w = silk_width centre = (0, -2.35) nw, ne, se, sw, _ = draw_square(2*(pins-1)+4, 11.7, centre, "F.SilkS", w) out.append(fp_line(nw, ne, "F.SilkS", w)) out.append(fp_line(ne, se, "F.SilkS", w)) out.append(fp_line(se, (se[0]-1, se[1]), "F.SilkS", w)) out.append(fp_line((se[0]-1, se[1]), (se[0]-1, se[1]-4), "F.SilkS", w)) out.append(fp_line(nw, sw, "F.SilkS", w)) out.append(fp_line(sw, (sw[0]+1, sw[1]), "F.SilkS", w)) out.append(fp_line((sw[0]+1, sw[1]), (sw[0]+1, sw[1]-4), "F.SilkS", w)) return out
def top_smd_silk(pins): out = [] w = silk_width l = "F.SilkS" nw, ne, se, sw, _ = draw_square(2 * pins + 4, 5.7, (0, 3.35), l, w) # Top left corner out.append(fp_line((nw[0], nw[1] + 2.4), (nw[0], nw[1]), l, w)) out.append(fp_line((nw[0], nw[1]), (nw[0] + 2.3, nw[1]), l, w)) # Top right corner out.append(fp_line((ne[0], ne[1] + 2.4), (ne[0], ne[1]), l, w)) out.append(fp_line((ne[0], ne[1]), (ne[0] - 2.3, ne[1]), l, w)) # Bottom out.append(fp_line((sw[0] + 1.8, sw[1]), (se[0] - 1.8, se[1]), l, w)) return out
def top_smd_silk(pins): out = [] w = silk_width lyr = "F.SilkS" box_w = (pins-1)*1.25 + 2*3.6 - 2*2.1 - silk_width box_h = 3.5 # XXX box_y = box_h/2 + 0.2 nw, ne, se, sw, _ = draw_square(box_w, box_h, (0, box_y), lyr, w) out.append(fp_line((nw[0]+0.8, nw[1]), nw, lyr, w)) out.append(fp_line(nw, sw, lyr, w)) out.append(fp_line(sw, se, lyr, w)) out.append(fp_line(se, ne, lyr, w)) out.append(fp_line((ne[0]-0.8, ne[1]), ne, lyr, w)) return out
def top_smd_silk(pins): out = [] w = silk_width l = "F.SilkS" nw, ne, se, sw, _ = draw_square(2*pins+4, 5.7, (0, 3.35), l, w) # Top left corner out.append(fp_line((nw[0], nw[1]+2.4), (nw[0], nw[1]), l, w)) out.append(fp_line((nw[0], nw[1]), (nw[0]+2.3, nw[1]), l, w)) # Top right corner out.append(fp_line((ne[0], ne[1]+2.4), (ne[0], ne[1]), l, w)) out.append(fp_line((ne[0], ne[1]), (ne[0]-2.3, ne[1]), l, w)) # Bottom out.append(fp_line((sw[0]+1.8, sw[1]), (se[0]-1.8, se[1]), l, w)) return out
def side_pth_fab(pins): out = [] w = fab_width centre = (0, -2.6) # Draw outline nw, ne, se, sw, _ = draw_square(2.5*(pins-1)+5, 8.2, centre, "F.Fab", w) out.append(fp_line(nw, ne, "F.Fab", w)) out.append(fp_line(ne, se, "F.Fab", w)) out.append(fp_line(se, (se[0]-1, se[1]), "F.Fab", w)) out.append(fp_line((se[0]-1, se[1]), (se[0]-1, se[1]-2.2), "F.Fab", w)) out.append(fp_line((se[0]-1, se[1]-2.2), (sw[0]+1, sw[1]-2.2), "F.Fab", w)) out.append(fp_line(nw, sw, "F.Fab", w)) out.append(fp_line(sw, (sw[0]+1, sw[1]), "F.Fab", w)) out.append(fp_line((sw[0]+1, sw[1]), (sw[0]+1, sw[1]-2.2), "F.Fab", w)) # Draw the pins x = 1.25*(pins - 1) for pin in range(pins): sq = draw_square(0.5, 0.75, (x, -0.125), "F.Fab", fab_width) out += sq[4] out.append(fp_line((x-.25, -.25), (x+.25, -.25), "F.Fab", fab_width)) x -= 2.5 return out
def side_smd_silk(pins): out = [] w = silk_width l = "F.SilkS" nw, ne, se, sw, _ = draw_square(2*pins+4, 8.9, (0, -3.5), l, w) out.append(fp_line(nw, (nw[0]+3, nw[1]), l, w)) out.append(fp_line((nw[0]+3, nw[1]), (nw[0]+3, nw[1]+1.4), l, w)) out.append(fp_line((nw[0]+3, nw[1]+1.4), (ne[0]-3, ne[1]+1.4), l, w)) out.append(fp_line((ne[0]-3, ne[1]+1.4), (ne[0]-3, ne[1]), l, w)) out.append(fp_line((ne[0]-3, ne[1]), ne, l, w)) out.append(fp_line(ne, (ne[0], ne[1]+2.8-w), l, w)) out.append(fp_line(nw, (nw[0], nw[1]+2.8-w), l, w)) out.append(fp_line(se, (se[0], se[1]-2.3+w), l, w)) out.append(fp_line(se, (se[0]-1.8, se[1]), l, w)) out.append(fp_line(sw, (sw[0], sw[1]-2.3+w), l, w)) out.append(fp_line(sw, (sw[0]+1.8, sw[1]), l, w)) return out
def side_smd_silk(pins): out = [] w = silk_width l = "F.SilkS" nw, ne, se, sw, _ = draw_square(2 * pins + 4, 8.9, (0, -3.5), l, w) out.append(fp_line(nw, (nw[0] + 3, nw[1]), l, w)) out.append(fp_line((nw[0] + 3, nw[1]), (nw[0] + 3, nw[1] + 1.4), l, w)) out.append( fp_line((nw[0] + 3, nw[1] + 1.4), (ne[0] - 3, ne[1] + 1.4), l, w)) out.append(fp_line((ne[0] - 3, ne[1] + 1.4), (ne[0] - 3, ne[1]), l, w)) out.append(fp_line((ne[0] - 3, ne[1]), ne, l, w)) out.append(fp_line(ne, (ne[0], ne[1] + 2.8 - w), l, w)) out.append(fp_line(nw, (nw[0], nw[1] + 2.8 - w), l, w)) out.append(fp_line(se, (se[0], se[1] - 2.3 + w), l, w)) out.append(fp_line(se, (se[0] - 1.8, se[1]), l, w)) out.append(fp_line(sw, (sw[0], sw[1] - 2.3 + w), l, w)) out.append(fp_line(sw, (sw[0] + 1.8, sw[1]), l, w)) return out
def ctyd(conf): row_pitch = conf['row_pitch'] pad_w, pad_h = conf['pad_shape'] chip_w, chip_h = conf['chip_shape'] width = row_pitch + pad_w + 2 * ctyd_gap if conf['rows'] == 2: height = chip_h + 2 * ctyd_gap elif conf['rows'] == 4: height = width # Ensure courtyard lies on a specified grid # (double the grid since we halve the width/height) grid = 2 * ctyd_grid width = grid * int(math.ceil(width / (2 * ctyd_grid))) height = grid * int(math.ceil(height / (2 * ctyd_grid))) _, _, _, _, sq = draw_square(width, height, (0, 0), "F.CrtYd", ctyd_width) return sq
def ctyd(conf): row_pitch = conf['row_pitch'] pad_w, pad_h = conf['pad_shape'] chip_w, chip_h = conf['chip_shape'] width = row_pitch + pad_w + 2 * ctyd_gap if conf['rows'] == 2: height = chip_h + 2 * ctyd_gap elif conf['rows'] == 4: height = width # Ensure courtyard lies on a specified grid # (double the grid since we halve the width/height) grid = 2*ctyd_grid width = grid * int(math.ceil(width / (2*ctyd_grid))) height = grid * int(math.ceil(height / (2*ctyd_grid))) _, _, _, _, sq = draw_square(width, height, (0, 0), "F.CrtYd", ctyd_width) return sq
def ctyd(conf): """Draw a courtyard around the part.""" gap = conf.get('courtyard_gap', ctyd_gap) # Compute width and height of courtyard width = max(conf['pad_shape'][0] + conf['pitch'], conf['chip_shape'][0]) height = max(conf['pad_shape'][1], conf['chip_shape'][1]) width += 2 * gap height += 2 * gap # Ensure courtyard lies on a specified grid # (double the grid since we halve the width/height) grid = 2*ctyd_grid width = grid * int(math.ceil(width / (2*ctyd_grid))) height = grid * int(math.ceil(height / (2*ctyd_grid))) # Render courtyard _, _, _, _, sq = draw_square(width, height, (0, 0), "F.CrtYd", ctyd_width) return sq
def internal_silk(conf): """ Generate an internal silkscreen, with an outline of the part and a pin1 indicator. """ out = [] pins = conf['pins'] rows = conf['rows'] pin_pitch = conf['pin_pitch'] row_pitch = conf['row_pitch'] pad_shape = conf['pad_shape'] width = row_pitch - pad_shape[0] - 2 * silk_pad_igap if rows == 2: height = (((pins / rows) - 1) * pin_pitch) elif rows == 4: height = width ir = silk_pin1_ir if ir > width: ir = width c = (0, 0) layer = "F.SilkS" nw, ne, se, sw, sq = draw_square(width, height, c, layer, silk_width) out.append(fp_line((nw[0] + ir, nw[1]), ne, layer, silk_width)) out.append(fp_line(ne, se, layer, silk_width)) out.append(fp_line(se, sw, layer, silk_width)) out.append(fp_line(sw, (nw[0], nw[1] + ir), layer, silk_width)) start = (nw[0], nw[1] + ir) end = (nw[0] + ir, nw[1]) out.append(fp_line(start, end, "F.SilkS", silk_width)) # Old circular pin1 indicator: # out += sq # start = nw # end = (start[0] + silk_pin1_ir, start[1]) # out.append(fp_arc(start, end, 90, "F.SilkS", silk_width)) return out
def sfml_fab(pins): out = [] l = "F.Fab" w = fab_width a_x = (3.94 - 0.38) / 2.0 a_y = (3.05 - 1.52) / 2.0 nw, ne, se, sw, _ = draw_square( pins * 1.27 + 0.38, 3.05, (0, 0), l, w) out.append(fp_line(nw, ne, l, w)) out.append(fp_line(ne, (ne[0], ne[1]+a_y), l, w)) out.append(fp_line((ne[0], ne[1]+a_y), (ne[0]+a_x, ne[1]+a_y), l, w)) out.append(fp_line((ne[0]+a_x, ne[1]+a_y), (se[0]+a_x, se[1]-a_y), l, w)) out.append(fp_line((se[0]+a_x, se[1]-a_y), (se[0], se[1]-a_y), l, w)) out.append(fp_line((se[0], se[1]-a_y), se, l, w)) out.append(fp_line(se, sw, l, w)) out.append(fp_line(sw, (sw[0], sw[1]-a_y), l, w)) out.append(fp_line((sw[0], sw[1]-a_y), (sw[0]-a_x, sw[1]-a_y), l, w)) out.append(fp_line((sw[0]-a_x, sw[1]-a_y), (nw[0]-a_x, nw[1]+a_y), l, w)) out.append(fp_line((nw[0]-a_x, nw[1]+a_y), (nw[0], nw[1]+a_y), l, w)) out.append(fp_line((nw[0], nw[1]+a_y), nw, l, w)) return out
def sfml_silk(pins): out = [] l = "F.SilkS" w = silk_width a_x = (3.94 - 0.38) / 2.0 a_y = (3.05 - 1.52) / 2.0 nw, ne, se, sw, _ = draw_square( pins * 1.27 + 0.38 - w, 3.05 - w, (0, 0), l, w) out.append(fp_line(ne, (ne[0], ne[1]+a_y), l, w)) out.append(fp_line((ne[0], ne[1]+a_y), (ne[0]+a_x, ne[1]+a_y), l, w)) out.append(fp_line((ne[0]+a_x, ne[1]+a_y), (se[0]+a_x, se[1]-a_y), l, w)) out.append(fp_line((se[0]+a_x, se[1]-a_y), (se[0], se[1]-a_y), l, w)) out.append(fp_line((se[0], se[1]-a_y), se, l, w)) out.append(fp_line(se, (se[0]-0.3, se[1]), l, w)) out.append(fp_line((sw[0]+0.3, sw[1]), sw, l, w)) out.append(fp_line(sw, (sw[0], sw[1]-a_y), l, w)) out.append(fp_line((sw[0], sw[1]-a_y), (sw[0]-a_x, sw[1]-a_y), l, w)) out.append(fp_line((sw[0]-a_x, sw[1]-a_y), (nw[0]-a_x, nw[1]+a_y), l, w)) out.append(fp_line((nw[0]-a_x, nw[1]+a_y), (nw[0], nw[1]+a_y), l, w)) out.append(fp_line((nw[0], nw[1]+a_y), nw, l, w)) return out
def tfml_fab(pins): _, _, _, _, sq = draw_square( pins * 1.27 + 3.18, 5.72, (0, 0), "F.Fab", fab_width) return sq
def internal_silk(conf): """Draw internal silkscreen.""" w = conf['pitch'] - conf['pad_shape'][0] - 2*silk_pad_igap h = conf['chip_shape'][1] - silk_width _, _, _, _, sq = draw_square(w, h, (0, 0), "F.SilkS", silk_width) return sq
def top_pth_silk(pins): s = draw_square(2*(pins-1)+4, 5.3, (0, 0), "F.SilkS", silk_width) return s[4]
def sil_silk(pins): _, _, _, _, sq = draw_square(pins * 2.54, 2.54, (0, 0), "F.SilkS", silk_width) return sq
def kk_fab(pins): w = fab_width nw, ne, se, sw, sq = draw_square(pins * 2.54, 6.35, (0, 0), "F.Fab", w) sq.append(fp_line((nw[0], nw[1] + 2.0), (ne[0], ne[1] + 2.0), "F.Fab", w)) return sq
def fab(pins, h): _, _, _, _, sq = draw_square(pins * 2.54, h, (0, 0), "F.Fab", fab_width) return sq
def sil_silk(pins): _, _, _, _, sq = draw_square( pins * 2.54, 2.54, (0, 0), "F.SilkS", silk_width) return sq
def dil_fab(pins): _, _, _, _, sq = draw_square( pins * 2.54, 2*2.54, (0, 0), "F.Fab", fab_width) return sq