def fuse(): s = sch.Schematic(name='Fuse', refdes='F', show_pin_text=False) s.features = [ sch.Pin(numbers=1, pos=(-100, 0), len=60, dir=sch.Pin.Right, type=sch.Pin.Passive), sch.Pin(numbers=2, pos=(100, 0), len=60, dir=sch.Pin.Left, type=sch.Pin.Passive), sch.Arc(center=(-20, 0), radius=20, angle_start=180, angle_end=0), sch.Arc(center=(20, 0), radius=20, angle_start=0, angle_end=-180), ] return s
def switch(): s = sch.Schematic(name='Switch SPST', refdes='S', show_pin_text=False, show_name=False) s.features = [ sch.Pin(numbers=1, pos=(-100, 0), len=50, dir=sch.Pin.Right, type=sch.Pin.Passive), sch.Pin(numbers=2, pos=(100, 0), len=50, dir=sch.Pin.Left, type=sch.Pin.Passive), sch.Line(points=[(-50, 0), (50, 50)]), ] return s
def schottky_diode(): s = sch.Schematic(name='Schottky Diode', refdes='D', show_pin_text=False, show_name=False) s.features = [ sch.Pin(numbers=1, pos=(-100, 0), len=100, dir=sch.Pin.Right, type=sch.Pin.Passive), sch.Pin(numbers=2, pos=(100, 0), len=100, dir=sch.Pin.Left, type=sch.Pin.Passive), sch.Line(points=[(-25, -25), (25, 0), (-25, 25)], filled=True), sch.Line(points=[(15, -15), (15, -25), (25, -25), (25, 25), (35, 25), (35, 15)]), ] return s
def zener_diode(): s = sch.Schematic(name='Zener Diode', refdes='D', show_pin_text=False, show_name=False) s.features = [ sch.Pin(numbers=1, pos=(-100, 0), len=100, dir=sch.Pin.Right, type=sch.Pin.Passive), sch.Pin(numbers=2, pos=(100, 0), len=100, dir=sch.Pin.Left, type=sch.Pin.Passive), sch.Line(points=[(-25, -25), (25, 0), (-25, 25)], filled=True), sch.Line(points=[(30, -25), (25, -20), (25, 20), (20, 25)]) ] return s
def power_flag(): s = sch.Schematic(name='PWR_FLAG', refdes='#FLG', show_pin_text=False, show_name=False, show_refdes=False, power_symbol=True) s.features = [ sch.Line(points=[(0, 0), (0, 25)]), sch.Line(points=[(0, 25), (100, 75), (0, 125), (-100, 75), (0, 25)]), sch.Text(pos=(0, 75), text='PWR', font_size=40), sch.Pin(numbers=1, name='pwd', type=sch.Pin.PowerFlag, shape=sch.Pin.Hidden), ] return s
def vcc(name='VCC'): s = sch.Schematic(name=name, refdes='#PWR', description='{0} power rail'.format(name), show_pin_text=False, show_refdes=False, power_symbol=True) s.features = [ sch.Line(points=[(0, 0), (0, 50)]), sch.Line(points=[(-50, 50), (50, 50)]), sch.Pin(numbers=1, name=name, type=sch.Pin.Power, shape=sch.Pin.Hidden), ] s.name.pos = (0, 100) return s
def resistor(): s = sch.Schematic(name='Resistor', refdes='R', show_pin_text=False) s.features = [ sch.Pin(numbers=1, pos=(-100, 0), len=20, dir=sch.Pin.Right, type=sch.Pin.Passive), sch.Pin(numbers=2, pos=(100, 0), len=20, dir=sch.Pin.Left, type=sch.Pin.Passive), sch.Line(points=[ (-80, 0), (-70, 20), (-60, 0), (-50, -20), (-40, 0), (-30, 20), (-20, 0), (-10, -20), (0, 0), (10, 20), (20, 0), (30, -20), (40, 0), (50, 20), (60, 0), (70, -20), (80, 0) ]), ] return s
def gnd(name='GND'): s = sch.Schematic(name=name, refdes='#PWR', description='{0} ground rail'.format(name), show_pin_text=False, show_refdes=False, power_symbol=True) s.features = [ sch.Line(points=[(0, 0), (0, -50)]), sch.Line(points=[(-50, -50), (50, -50)]), sch.Line(points=[(-25, -75), (25, -75)]), sch.Line(points=[(-5, -100), (5, -100)]), sch.Pin(numbers=1, name=name, type=sch.Pin.Power, shape=sch.Pin.Hidden), ] s.name.pos = (0, -150) return s