from collections import defaultdict
from skidl import Pin, Part, Alias, SchLib, SKIDL, TEMPLATE

from skidl.pin import pin_types

SKIDL_lib_version = '0.0.1'

Interface_HID = SchLib(tool=SKIDL).add_parts(*[
        Part(**{ 'name':'JoyWarrior24A10L', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'JoyWarrior24A10L'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'joystick controller 10bit 3-axis', 'description':'', 'datasheet':'http://codemercs.com/downloads/joywarrior/JW_Datasheet.pdf', 'search_text':'/usr/share/kicad/symbols/Interface_HID.kicad_sym\nJoyWarrior24A10L\n\njoystick controller 10bit 3-axis', 'pins':[
            Pin(num='1',name='X0/B0',func=pin_types.INPUT,unit=1),
            Pin(num='10',name='PullToGnd',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='VREG',func=pin_types.PWROUT,unit=1),
            Pin(num='12',name='Direct',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='14',name='VCC',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='D-',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='D+',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='Aux3',func=pin_types.OUTPUT,unit=1),
            Pin(num='18',name='Aux1',func=pin_types.OUTPUT,unit=1),
            Pin(num='19',name='Dout',func=pin_types.OUTPUT,unit=1),
            Pin(num='2',name='X1/B1',func=pin_types.INPUT,unit=1),
            Pin(num='20',name='SCLK',func=pin_types.OUTPUT,unit=1),
            Pin(num='21',name='Y3/B7',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='Y2/B6',func=pin_types.INPUT,unit=1),
            Pin(num='23',name='Y1/B5',func=pin_types.INPUT,unit=1),
            Pin(num='24',name='Y0/B4',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='X2/B2',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='X3/B3',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='~{CS}',func=pin_types.OUTPUT,unit=1),
            Pin(num='6',name='Din',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='Aux0',func=pin_types.OUTPUT,unit=1),
            Pin(num='8',name='Aux2',func=pin_types.OUTPUT,unit=1),
            Pin(num='9',name='GND',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'SpinWarrior24A3', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'SpinWarrior24A3'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'16bit absolute position USB rotary encoder', 'description':'', 'datasheet':'http://www.codemercs.com/downloads/spinwarrior/SW_Datasheet.pdf', 'search_text':'/usr/share/kicad/symbols/Interface_HID.kicad_sym\nSpinWarrior24A3\n\n16bit absolute position USB rotary encoder', 'pins':[
            Pin(num='1',name='A0',func=pin_types.INPUT,unit=1),
            Pin(num='10',name='PullToGND',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='Vreg',func=pin_types.PWROUT,unit=1),
            Pin(num='12',name='Power',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='14',name='Vcc',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='D-',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='D+',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='~{EN}',func=pin_types.OPENCOLL,unit=1),
            Pin(num='18',name='In5',func=pin_types.INPUT,unit=1),
            Pin(num='19',name='In3',func=pin_types.INPUT,unit=1),
            Pin(num='2',name='B0',func=pin_types.INPUT,unit=1),
            Pin(num='20',name='In1',func=pin_types.INPUT,unit=1),
            Pin(num='21',name='N1',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='N0',func=pin_types.INPUT,unit=1),
            Pin(num='23',name='B2',func=pin_types.INPUT,unit=1),
            Pin(num='24',name='A2',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='A1',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='B1',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='In0',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='In2',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='In4',func=pin_types.INPUT,unit=1),
            Pin(num='8',name='N2',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='GND',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'SpinWarrior24R4', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'SpinWarrior24R4'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'8bit relative position USB rotary encoder', 'description':'', 'datasheet':'http://www.codemercs.com/downloads/spinwarrior/SW_Datasheet.pdf', 'search_text':'/usr/share/kicad/symbols/Interface_HID.kicad_sym\nSpinWarrior24R4\n\n8bit relative position USB rotary encoder', 'pins':[
            Pin(num='1',name='A0',func=pin_types.INPUT,unit=1),
            Pin(num='10',name='PullToGND',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='Vreg',func=pin_types.PWROUT,unit=1),
            Pin(num='12',name='Power',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='14',name='Vcc',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='D-',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='D+',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='~{EN}',func=pin_types.OPENCOLL,unit=1),
            Pin(num='18',name='Sw5',func=pin_types.INPUT,unit=1),
            Pin(num='19',name='Sw3',func=pin_types.INPUT,unit=1),
            Pin(num='2',name='B0',func=pin_types.INPUT,unit=1),
            Pin(num='20',name='Sw1',func=pin_types.INPUT,unit=1),
            Pin(num='21',name='B3',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='A3',func=pin_types.INPUT,unit=1),
            Pin(num='23',name='B2',func=pin_types.INPUT,unit=1),
            Pin(num='24',name='A2',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='A1',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='B1',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='Sw0',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='Sw2',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='Sw4',func=pin_types.INPUT,unit=1),
            Pin(num='8',name='Sw6',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='GND',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'SpinWarrior24R6', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'SpinWarrior24R6'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'8bit relative position USB rotary encoder', 'description':'', 'datasheet':'http://www.codemercs.com/downloads/spinwarrior/SW_Datasheet.pdf', 'search_text':'/usr/share/kicad/symbols/Interface_HID.kicad_sym\nSpinWarrior24R6\n\n8bit relative position USB rotary encoder', 'pins':[
            Pin(num='1',name='A0',func=pin_types.INPUT,unit=1),
            Pin(num='10',name='PullToGND',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='Vreg',func=pin_types.PWROUT,unit=1),
            Pin(num='12',name='Power',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='14',name='Vcc',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='D-',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='D+',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='~{EN}',func=pin_types.OPENCOLL,unit=1),
            Pin(num='18',name='A5',func=pin_types.INPUT,unit=1),
            Pin(num='19',name='A4',func=pin_types.INPUT,unit=1),
            Pin(num='2',name='B0',func=pin_types.INPUT,unit=1),
            Pin(num='20',name='Sw1',func=pin_types.INPUT,unit=1),
            Pin(num='21',name='B3',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='A3',func=pin_types.INPUT,unit=1),
            Pin(num='23',name='B2',func=pin_types.INPUT,unit=1),
            Pin(num='24',name='A2',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='A1',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='B1',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='Sw0',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='Sw2',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='B4',func=pin_types.INPUT,unit=1),
            Pin(num='8',name='B5',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='GND',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'JoyWarrior24A8L', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'JoyWarrior24A8L'}), 'ref_prefix':'U', 'fplist':['', ''], 'footprint':'', 'keywords':'joystick controller, 8 bit, 4 axis', 'description':'', 'datasheet':'http://codemercs.com/downloads/joywarrior/JW_Datasheet.pdf', 'search_text':'/usr/share/kicad/symbols/Interface_HID.kicad_sym\nJoyWarrior24A8L\n\njoystick controller, 8 bit, 4 axis', 'pins':[
            Pin(num='1',name='X0/B0',func=pin_types.INPUT,unit=1),
            Pin(num='10',name='PullToGnd',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='VREG',func=pin_types.PWROUT,unit=1),
            Pin(num='12',name='Direct',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='14',name='VCC',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='D-',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='D+',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='Aux3',func=pin_types.OUTPUT,unit=1),
            Pin(num='18',name='Aux1',func=pin_types.OUTPUT,unit=1),
            Pin(num='19',name='Dout',func=pin_types.OUTPUT,unit=1),
            Pin(num='2',name='X1/B1',func=pin_types.INPUT,unit=1),
            Pin(num='20',name='SCLK',func=pin_types.OUTPUT,unit=1),
            Pin(num='21',name='Y3/B7',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='Y2/B6',func=pin_types.INPUT,unit=1),
            Pin(num='23',name='Y1/B5',func=pin_types.INPUT,unit=1),
            Pin(num='24',name='Y0/B4',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='X2/B2',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='X3/B3',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='~{CS}',func=pin_types.OUTPUT,unit=1),
            Pin(num='6',name='Din',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='Aux0',func=pin_types.OUTPUT,unit=1),
            Pin(num='8',name='Aux2',func=pin_types.OUTPUT,unit=1),
            Pin(num='9',name='GND',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] })])