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'

MCU_AnalogDevices = SchLib(tool=SKIDL).add_parts(*[
        Part(**{ 'name':'ADUC816', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'ADUC816'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'8051 CORE MCU ADC DAC', 'description':'', 'datasheet':'https://www.analog.com/static/imported-files/data_sheets/ADUC816.pdf', 'search_text':'/usr/share/kicad/symbols/MCU_AnalogDevices.kicad_sym\nADUC816\n\n8051 CORE MCU ADC DAC', 'pins':[
            Pin(num='1',name='P1.0(T2)',func=pin_types.BIDIR,unit=1),
            Pin(num='10',name='P1.5(AIN2)',func=pin_types.INPUT,unit=1),
            Pin(num='11',name='P1.6(AIN3)',func=pin_types.INPUT,unit=1),
            Pin(num='12',name='P1.7(AIN4)',func=pin_types.BIDIR,unit=1),
            Pin(num='13',name='~{SS}',func=pin_types.INPUT,unit=1),
            Pin(num='14',name='MISO',func=pin_types.INPUT,unit=1),
            Pin(num='15',name='RESET',func=pin_types.INPUT,unit=1),
            Pin(num='16',name='(RxD)P3.0',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='(TxD)P3.1',func=pin_types.BIDIR,unit=1),
            Pin(num='18',name='(~{INT0})P3.2',func=pin_types.BIDIR,unit=1),
            Pin(num='19',name='(~{INT1})P3.3',func=pin_types.BIDIR,unit=1),
            Pin(num='2',name='P1.1(T2EX)',func=pin_types.BIDIR,unit=1),
            Pin(num='20',name='DVDD',func=pin_types.PWRIN,unit=1),
            Pin(num='21',name='DGND',func=pin_types.PWRIN,unit=1),
            Pin(num='22',name='(T0)P3.4',func=pin_types.BIDIR,unit=1),
            Pin(num='23',name='(T1)P3.5',func=pin_types.BIDIR,unit=1),
            Pin(num='24',name='(~{WR})P3.6',func=pin_types.BIDIR,unit=1),
            Pin(num='25',name='(~{RD})P3.7',func=pin_types.BIDIR,unit=1),
            Pin(num='26',name='SCLOCK',func=pin_types.BIDIR,unit=1),
            Pin(num='27',name='SDATA/MOSI',func=pin_types.BIDIR,unit=1),
            Pin(num='28',name='(A8)P2.0',func=pin_types.BIDIR,unit=1),
            Pin(num='29',name='(A9)P2.1',func=pin_types.BIDIR,unit=1),
            Pin(num='3',name='P1.2(DAC/IEXC1)',func=pin_types.BIDIR,unit=1),
            Pin(num='30',name='(A10)P2.2',func=pin_types.BIDIR,unit=1),
            Pin(num='31',name='(A11)P2.3',func=pin_types.BIDIR,unit=1),
            Pin(num='32',name='XTAL1',func=pin_types.INPUT,unit=1),
            Pin(num='33',name='XTAL2',func=pin_types.OUTPUT,unit=1),
            Pin(num='34',name='DVDD',func=pin_types.PWRIN,unit=1),
            Pin(num='35',name='DGND',func=pin_types.PWRIN,unit=1),
            Pin(num='36',name='(A12)P2.4',func=pin_types.BIDIR,unit=1),
            Pin(num='37',name='(A13)P2.5',func=pin_types.BIDIR,unit=1),
            Pin(num='38',name='(A14)P2.6',func=pin_types.BIDIR,unit=1),
            Pin(num='39',name='(A15)P2.7',func=pin_types.BIDIR,unit=1),
            Pin(num='4',name='P1.3(AIN5/IEXC2)',func=pin_types.BIDIR,unit=1),
            Pin(num='40',name='~{EA}',func=pin_types.BIDIR,unit=1),
            Pin(num='41',name='~{PSEN}',func=pin_types.OUTPUT,unit=1),
            Pin(num='42',name='ALE',func=pin_types.OUTPUT,unit=1),
            Pin(num='43',name='(AD0)P0.0',func=pin_types.TRISTATE,unit=1),
            Pin(num='44',name='(AD1)P0.1',func=pin_types.TRISTATE,unit=1),
            Pin(num='45',name='(AD2)P0.2',func=pin_types.TRISTATE,unit=1),
            Pin(num='46',name='(AD3)P0.3',func=pin_types.TRISTATE,unit=1),
            Pin(num='47',name='DGND',func=pin_types.PWRIN,unit=1),
            Pin(num='48',name='DVDD',func=pin_types.PWRIN,unit=1),
            Pin(num='49',name='(AD4)P0.4',func=pin_types.TRISTATE,unit=1),
            Pin(num='5',name='AVDD',func=pin_types.PWRIN,unit=1),
            Pin(num='50',name='(AD5)P0.5',func=pin_types.TRISTATE,unit=1),
            Pin(num='51',name='(AD6)P0.6',func=pin_types.TRISTATE,unit=1),
            Pin(num='52',name='(AD7)P0.7',func=pin_types.TRISTATE,unit=1),
            Pin(num='6',name='AGND',func=pin_types.PWRIN,unit=1),
            Pin(num='7',name='REF-',func=pin_types.PASSIVE,unit=1),
            Pin(num='8',name='REF+',func=pin_types.PASSIVE,unit=1),
            Pin(num='9',name='P1.4(AIN1)',func=pin_types.INPUT,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'MAX32660GTP', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'MAX32660GTP'}), 'ref_prefix':'U', 'fplist':['Package_DFN_QFN:TQFN-20-1EP_4x4mm_P0.5mm_EP2.7x2.7mm'], 'footprint':'Package_DFN_QFN:TQFN-20-1EP_4x4mm_P0.5mm_EP2.7x2.7mm', 'keywords':'ARM 32-bit Cortex-M4 Maxim ADI Darwin', 'description':'', 'datasheet':'https://www.analog.com/media/en/technical-documentation/data-sheets/max32660.pdf', 'search_text':'/usr/share/kicad/symbols/MCU_AnalogDevices.kicad_sym\nMAX32660GTP\n\nARM 32-bit Cortex-M4 Maxim ADI Darwin', 'pins':[
            Pin(num='1',name='P0.1',func=pin_types.BIDIR,unit=1),
            Pin(num='10',name='VCORE',func=pin_types.PASSIVE,unit=1),
            Pin(num='11',name='P0.9',func=pin_types.BIDIR,unit=1),
            Pin(num='12',name='P0.8',func=pin_types.BIDIR,unit=1),
            Pin(num='13',name='P0.11',func=pin_types.BIDIR,unit=1),
            Pin(num='14',name='P0.10',func=pin_types.BIDIR,unit=1),
            Pin(num='15',name='P0.7',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='P0.6',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='P0.5',func=pin_types.BIDIR,unit=1),
            Pin(num='18',name='P0.4',func=pin_types.BIDIR,unit=1),
            Pin(num='19',name='P0.3',func=pin_types.BIDIR,unit=1),
            Pin(num='2',name='P0.0',func=pin_types.BIDIR,unit=1),
            Pin(num='20',name='P0.2',func=pin_types.BIDIR,unit=1),
            Pin(num='21',name='V_{SS}',func=pin_types.PASSIVE,unit=1),
            Pin(num='3',name='P0.13',func=pin_types.BIDIR,unit=1),
            Pin(num='4',name='P0.12',func=pin_types.BIDIR,unit=1),
            Pin(num='5',name='~{RSTN}',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='V_{SS}',func=pin_types.PWRIN,unit=1),
            Pin(num='7',name='32KOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='8',name='32KIN',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='VDD',func=pin_types.PWRIN,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'MAX32670GTL', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'MAX32670GTL'}), 'ref_prefix':'U', 'fplist':['Package_DFN_QFN:TQFN-40-1EP_5x5mm_P0.4mm_EP3.5x3.5mm'], 'footprint':'Package_DFN_QFN:TQFN-40-1EP_5x5mm_P0.4mm_EP3.5x3.5mm', 'keywords':'ARM 32-bit Cortex-M4 Maxim ADI Darwin', 'description':'', 'datasheet':'https://www.analog.com/media/en/technical-documentation/data-sheets/max32670-max32671.pdf', 'search_text':'/usr/share/kicad/symbols/MCU_AnalogDevices.kicad_sym\nMAX32670GTL\n\nARM 32-bit Cortex-M4 Maxim ADI Darwin', 'pins':[
            Pin(num='1',name='P0.20',func=pin_types.BIDIR,unit=1),
            Pin(num='10',name='P0.6',func=pin_types.BIDIR,unit=1),
            Pin(num='11',name='P0.7',func=pin_types.BIDIR,unit=1),
            Pin(num='12',name='P0.23',func=pin_types.BIDIR,unit=1),
            Pin(num='13',name='P0.24',func=pin_types.BIDIR,unit=1),
            Pin(num='14',name='P0.25',func=pin_types.BIDIR,unit=1),
            Pin(num='15',name='P0.26',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='P0.27',func=pin_types.BIDIR,unit=1),
            Pin(num='17',name='P0.28',func=pin_types.BIDIR,unit=1),
            Pin(num='18',name='P0.29',func=pin_types.BIDIR,unit=1),
            Pin(num='19',name='P0.30',func=pin_types.BIDIR,unit=1),
            Pin(num='2',name='P0.21',func=pin_types.BIDIR,unit=1),
            Pin(num='20',name='P0.8',func=pin_types.BIDIR,unit=1),
            Pin(num='21',name='P0.9',func=pin_types.BIDIR,unit=1),
            Pin(num='22',name='P0.10',func=pin_types.BIDIR,unit=1),
            Pin(num='23',name='P0.11',func=pin_types.BIDIR,unit=1),
            Pin(num='24',name='P0.12',func=pin_types.BIDIR,unit=1),
            Pin(num='25',name='P0.13',func=pin_types.BIDIR,unit=1),
            Pin(num='26',name='P0.14',func=pin_types.BIDIR,unit=1),
            Pin(num='27',name='P0.15',func=pin_types.BIDIR,unit=1),
            Pin(num='28',name='P0.16',func=pin_types.BIDIR,unit=1),
            Pin(num='29',name='P0.17',func=pin_types.BIDIR,unit=1),
            Pin(num='3',name='P0.22',func=pin_types.BIDIR,unit=1),
            Pin(num='30',name='P0.18',func=pin_types.BIDIR,unit=1),
            Pin(num='31',name='P0.19',func=pin_types.BIDIR,unit=1),
            Pin(num='32',name='VREG1',func=pin_types.PASSIVE,unit=1),
            Pin(num='33',name='HFXIN',func=pin_types.INPUT,unit=1),
            Pin(num='34',name='HFXOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='35',name='~{RSTN}',func=pin_types.INPUT,unit=1),
            Pin(num='36',name='V_{SS}',func=pin_types.PWRIN,unit=1),
            Pin(num='37',name='VDD',func=pin_types.PWRIN,unit=1),
            Pin(num='38',name='32KOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='39',name='32KIN',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='P0.0',func=pin_types.BIDIR,unit=1),
            Pin(num='40',name='VCORE',func=pin_types.PASSIVE,unit=1),
            Pin(num='41',name='V_{SS}',func=pin_types.PASSIVE,unit=1),
            Pin(num='5',name='P0.1',func=pin_types.BIDIR,unit=1),
            Pin(num='6',name='P0.2',func=pin_types.BIDIR,unit=1),
            Pin(num='7',name='P0.3',func=pin_types.BIDIR,unit=1),
            Pin(num='8',name='P0.4',func=pin_types.BIDIR,unit=1),
            Pin(num='9',name='P0.5',func=pin_types.BIDIR,unit=1)], 'unit_defs':[] })])