def bb2_breakout(): brd = cu.Board((30, 30), trace=cu.mil(5), space=cu.mil(5) * 2.0, via_hole=0.2, via=0.45, via_space=cu.mil(5), silk=cu.mil(6)) dc = brd.DC((15, 15)) efm8 = EFM8BB2(dc) efm8.setnames() outers = [] for i in range(4): dc.left(90) d = dc.copy() d.forward(9).right(90) bar = dip.SIL(d, "5") outers += bar.pads for a, b in zip(efm8.pads[1:], outers): a.forward(1).meet(b) nm = a.name.replace("P", "") b.copy().w("l 90 f 2").text(nm) brd.outline() brd.save("bb2_breakout")
def proto1(): brd = cu.Board((80, 50), trace=cu.mil(6), space=cu.mil(5) * 2.0, via_hole=0.2, via=0.45, via_space=cu.mil(5), silk=cu.mil(6)) tu = brd.DC((1.4, 15)) usb = USB(tu.copy().right(90)) (aUSB, ) = usb.escape() ft230x = FT231X(tu.goxy(3.5, 8).copy().right(90)) (aSER, bUSB) = ft230x.escape() # cc = [cu.C0402(tu.copy().goxy(-1 + 1.0 * i, -3.6).right(90), "0.1") for i in range(3)] # cc[0].pads[1].copy().goto(cc[2].pads[1]).wire() # cc[0].pads[1].w("o f 1").wire() dc = brd.DC((15, 15)) efm8 = EFM8BB2(dc) efm8.setnames() ext = dip.SIL(brd.DC((72, 25)), "6") # Routing """ aUSB.w("f 4").meet(bUSB) (ft230x.s("5V").setwidth(.2).w("o f .2"). goto(cc[1].pads[0]). goto(cc[2].pads[0]). w("l 90 f 1.0 r 90 f 3"). goto(usb.s("5V").w("f 1").wire()) ).wire() # .wire() """ brd.outline() brd.save("udriver")
q = math.sqrt((ii**2) + (ii**2)) for p in self.pads[4:]: p.w("i r 45").forward(q).left(45).forward(1) for p in self.pads[:4]: p.w("o f .2") oo = list(sum(zip(self.pads[4:], self.pads[:4]), ())) cu.extend2(oo) [p.wire() for p in oo] return oo if __name__ == "__main__": brd = cu.Board((24, 12), trace=cu.mil(6), space=cu.mil(5) * 2.0, via_hole=0.3, via=0.6, via_space=cu.mil(5), silk=cu.mil(6)) dc = brd.DC((6, 6)).left(37) u1 = DIP8(dc).escape() dc = brd.DC((18, 6)) u2 = WSON8L(dc).escape() for src, dst in zip(u1, u2): src.meet(dst) brd.outline() brd.check()
p = dc.copy() p.right(90) self.pads.append(p) def padline(self, dc, n): # e.g. Digikey 2057-2RS1-15-G-ND or LCSC C225286 A = 2 * (n - 1) h = dc.copy().forward(A / 2) h.rect(2.5, 2 * (n - 1) + 2.6).silko() self.train(dc, n, lambda: self.edgepad(dc), 2.00) if __name__ == "__main__": brd = cu.Board( (50, 42), trace = cu.mil(3.5), space = cu.mil(3.5) * 1.2, via_hole = 0.2, via = 0.45, via_space = cu.mil(5), silk = cu.mil(6)) brd.hole((47.2, 2.8), 2.5, 5) brd.hole((2.8, 42 - 2.8), 2.5, 5) brd.hole((2.8, 2.8), 2.5, 5) dc = brd.DC((40, 10)) dc.push() dc.right(270) u1 = cu.BT815(dc) dc.left(225) (bt815_qspi, bt815_main, bt815_rctp) = u1.escape() dc.w("f 11.0 l 90 f 4.0 r 90")
def gen(target): brd = cu.Board( (90, 63), trace = cu.mil(6), space = cu.mil(6) * 2.0, via_hole = 0.3, via = 0.6, via_space = cu.mil(5), silk = cu.mil(6)) brd.outline() brd.layers['GML'].union(sg.box(-9.8, 0, 0, 16)) daz = Dazzler(brd.DC((28, 38)).left(90)) if target == "pico": pico = Pico(brd.DC((70, 28))) elif target == "teensy": teensy = Teensy40(brd.DC((70, 28))) breakout(teensy) elif target == "feather": feather = Feather(brd.DC((70, 28))) breakout(feather) sd = SD(brd.DC((3, 12)).right(180)) # ------------------------------ SD for nm in ("G1", "G2", "G3", "G4", "6"): sd.s(nm).w("r 90 f 1 -") sd.s("4").setname("VCC").w("r 90 f 2").wire() tt = [sd.s(c) for c in "1235789"] [t.left(90).forward(1) for t in tt] r0 = brd.enriver90(tt, 90).left(135).wire() tt = [daz.s(str(15 + i)) for i in range(7)] [t.w("o f .1") for t in tt] r1 = brd.enriver90(tt, 90).left(45).meet(r0) # ------------------------------ Wii def wii(i): y = 32.5 + 6 - i * 12 return cu.WiiPlug(brd.DC((-5, y)).right(270)).escape() wii1 = wii(-1) wii2 = wii(1) wii1.w("r 90 f 2").wire() wii2.w("f 10 r 45 f 4 r 45").wire() wii = wii2.join(wii1, 0.5).wire() tt = [daz.s(str(i)) for i in (13, 12, 11, 10, 9, 8)] [t.w("i f 4") for t in tt] daz_i2cbus = brd.enriver90(tt, -90).wire() wii.w("f 9 r 90 f 3 /").meet(daz_i2cbus) # ------------------------------ Dazzler power daz.s("VCC").thermal(1).wire() for nm in ("GND", "GND1", "GND2"): daz.s(nm).inside().forward(2).wire(width = 0.5).w("-") daz_used = ("1", "2", "22", "23", "25", "26", "27", "28", "29", "PGM") tt = [daz.s(nm) for nm in daz_used] [p.w("i f 4").wire() for p in tt] daz.s("1").left(90) daz.s("2").forward(1).left(90) daz.s("PGM").right(90) cu.extend2(tt) b1 = brd.enriver90(tt[::-1], 90) if target == "pico": b1.w("l 90 f 2 r 45").wire() pico_used = ( "GP0", "GP2", "GP3", "GP4", "GP5", "GP6", "GP7", "GP8", "GP9", "GP10" ) tt = [pico.s(str(i)) for i in pico_used] [p.setlayer("GBL").w("r 180 f 2").wire() for p in tt] b0 = brd.enriver90(tt[::-1], -90).wire() b0.shuffle(b1, { # Pico Dazzler "GP8": "1" , # UART1 TX CONSOLE IN "GP9": "2" , # UART1 RX CONOLE OUT "GP4": "22" , # SPI0 RX MISO "GP5": "25" , # GP5 GPU SEL "GP6": "26" , # GP6 SD SEL "GP7": "27" , # GP7 DAZZLER SEL "GP3": "28" , # SPI0 TX MOSI "GP2": "29" , # SPI0 SCK SCK "GP10":"PGM", # GP10 PGM "GP0": "23" , # UART0 TX UART }).w("f 9 l 45").meet(b1) daz.s("5V").setwidth(0.5).w("o f 1 l 90 f 7 r 90 f 14 r 90 f 2.5").goto(pico.s("VBUS")).wire() elif target == "teensy": b1.w("l 45 f 2 r 45").wire() teensy_used = ( "1", "8", "9", "10", "11", "12", "13", "14", "15", "16" ) tt = [teensy.s(str(i)) for i in teensy_used] [p.setlayer("GBL").w("l 90 f 2").wire() for p in tt] rv0 = brd.enriver90(tt[:6][::-1], -90).wire() rv1 = brd.enriver90(tt[6:][::-1], 90).wire() b0 = rv1.join(rv0, 1).forward(2).wire() b0.shuffle(b1, { # Teensy Dazzler "14": "1" , # TX3 CONSOLE IN "15": "2" , # RX3 CONOLE OUT "12": "22" , # MISO MISO "8" : "25" , # 8 GPU SEL "9" : "26" , # 9 SD SEL "10": "27" , # 10 DAZZLER SEL "11": "28" , # MOSI MOSI "13": "29" , # SCK SCK "16":"PGM" , # 16 PGM "1" : "23" , # UART0 TX UART }).w("f 8").meet(b1) daz.s("5V").setwidth(0.5).w("o f 2 r 90 f 39 l 90 f 23").goto(teensy.s("VIN")).wire() elif target == "feather": mapping = { # Feather Dazzler "SCK" : "29" , # SCK "MOSI" : "28" , # MOSI "MISO" : "22" , # MISO "TX" : "23" , # UART "D4" : "25" , # GPU SEL "D5" : "26" , # SD SEL "D6" : "27" , # DAZZLER SEL "D9" :"PGM" , # PGM "D10" : "2" , # CONOLE OUT "D12" : "1" , # CONSOLE IN } b1.w("l 45 f 2 r 45").wire() used = mapping.keys() tt = [feather.s(str(i)) for i in used] [p.setlayer("GBL").w("l 90 f 2").wire() for p in tt] rv0 = brd.enriver90(tt[:5][::-1], -90).wire() rv1 = brd.enriver90(tt[5:][::-1], 90).wire() b0 = rv1.join(rv0, 1).forward(19).wire() b0.shuffle(b1, mapping).w("f 8").meet(b1) daz.s("5V").setwidth(0.5).w("o f 2 r 90 f 41 l 90 f 23").goto(feather.s("USB")).wire() if 1: im = Image.open("img/gameduino-mono.png") brd.logo(16, 4, im) im = Image.open("img/dazzler-logo.png") brd.logo(36, 4, im) if target == "pico": brd.logo(pico.center.xy[0], pico.center.xy[1] - 15, gentext("PICO")) else: brd.logo(70, 4, gentext(target)) brd.logo(-5, 38.5 - 12, gentext("2").transpose(Image.ROTATE_270), scale = 0.9) brd.logo(-5, 38.5 + 12, gentext("1").transpose(Image.ROTATE_270), scale = 0.9) brd.logo(-4.8, 38.5, Image.open("img/oshw-logo-outline.png").transpose(Image.ROTATE_270), scale = 0.7) for i,s in enumerate(["(C) 2021", "EXCAMERA LABS", str(__VERSION__)]): brd.annotate(81, 60 - 1.5 * i, s) if 1: brd.fill_any("GTL", "VCC") brd.fill_any("GBL", "GL2") name = target + "_dazzler" brd.save(name) for n in brd.nets: print(n) svgout.write(brd, name + ".svg")
import math import cuflow as cu if __name__ == "__main__": D = 0.4 brd = cu.Board((10, 10), trace=D, space=D, via_hole=0.2, via=0.45, via_space=cu.mil(5), silk=cu.mil(6)) c = brd.trace + brd.space * 1 rr = [0] rr = [7, 6, 5, 4, 3, 2, 1, 0] r = cu.River(brd, [brd.DC((3.6 + c * i, 1)) for i in rr]) r.tt[-1].setlayer('GBL') def label(s): if len(rr) == 1: d = r.tt[0].copy() d.dir = 90 d.forward(0.8).ltext(s) label("fwd 3") r.w("f 3") label("left 45") r.w("l 45 f 3") label("fwd 4") r.w("f 1")
38 BCM 20 (MOSI) 39 Ground 40 BCM 21 (SCLK) """ def thermal(t, layer, d=1.3): t.setname(layer).thermal(d).wire(layer=layer) if __name__ == "__main__": brd = cu.Board((65, 56), trace=0.2, space=cu.inches(1 / 20) - 0.2, via_hole=0.3, via=0.6, via_space=cu.mil(5), silk=cu.mil(6)) WW = 0.6 # wide wire width dc = brd.DC((3.5 + 29, 56 - 3.5)).left(90) j1 = dip.HDR40(dc) for pin in "6 9 14 20 25 30 34 39".split(): thermal(j1.s(pin), "GBL") for pin in "2 4".split(): thermal(j1.s(pin), "GTL") route = (8, 12, 11, 32)
def escape(self): pp = self.pads pp[0].w("i .") pp[1].setname("GTL").w("i f 1").wire(layer="GTL") pp[2].w("i f 2").wire().via().setlayer("GBL") pp[3].w("i f 2").wire().via().setlayer("GBL") return (pp[2], pp[3]) if __name__ == "__main__": (xo, yo) = (20, 26) # (xo, yo) = (4, 4) brd = cu.Board((50 + xo, 42 + yo), trace=0.2, space=cu.inches(1 / 20) - 0.2, via_hole=0.3, via=0.6, via_space=cu.mil(5), silk=cu.mil(6)) holexy = [(47.2, 2.8), (2.8, 42 - 2.8), (2.8, 2.8), (45, 33.5)] for x, y in holexy: brd.hole((x + 2, y + 2), 2.6, 5) teensy = Teensy40(brd.DC((42, 57)).right(90)) if 0: daz = DazzlerPogo(brd.DC((25, 21))) (sda, scl) = EDS(brd.DC((10, 54))).escape() daz.pads[5].setname("GBL").forward(2).wire(layer="GBL") daz.pads[6].setwidth(1).w("r 90 f 6 l 90 f 12 r 90 f 12 l 90").goto(