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'

RF_WiFi = SchLib(tool=SKIDL).add_parts(*[
        Part(**{ 'name':'HF-A11-SMT', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'HF-A11-SMT'}), 'ref_prefix':'U', 'fplist':[''], 'footprint':'', 'keywords':'WiFi IEEE802.11 b/g/n', 'description':'', 'datasheet':'http://www.hi-flying.com/index.php?route=tool/upload/download&code=190ec6c62d497905ed783d140f8e5af7a753b8ab', 'search_text':'/usr/share/kicad/symbols/RF_WiFi.kicad_sym\nHF-A11-SMT\n\nWiFi IEEE802.11 b/g/n', 'pins':[
            Pin(num='1',name='3.3V',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='RX+',func=pin_types.PASSIVE,unit=1),
            Pin(num='11',name='RX-',func=pin_types.PASSIVE,unit=1),
            Pin(num='14',name='~{LINK}',func=pin_types.OUTPUT,unit=1),
            Pin(num='15',name='~{RESET}',func=pin_types.INPUT,unit=1),
            Pin(num='16',name='~{READY}',func=pin_types.OUTPUT,unit=1),
            Pin(num='17',name='~{RELOAD}',func=pin_types.INPUT,unit=1),
            Pin(num='18',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='19',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='2',name='3.3V',func=pin_types.PWRIN,unit=1),
            Pin(num='20',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='21',name='UART1_RXD',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='UART1_TXD',func=pin_types.OUTPUT,unit=1),
            Pin(num='23',name='1.8VOUT',func=pin_types.PWROUT,unit=1),
            Pin(num='24',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='25',name='RF',func=pin_types.PASSIVE,unit=1),
            Pin(num='26',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='3',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='4',name='UART_TXD',func=pin_types.OUTPUT,unit=1),
            Pin(num='5',name='UART_RXD',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='UART_RTS',func=pin_types.OUTPUT,unit=1),
            Pin(num='7',name='UART_CTS',func=pin_types.INPUT,unit=1),
            Pin(num='8',name='TX+',func=pin_types.PASSIVE,unit=1),
            Pin(num='9',name='TX-',func=pin_types.PASSIVE,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'USR-C322', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'USR-C322'}), 'ref_prefix':'U', 'fplist':['RF_WiFi:USR-C322'], 'footprint':'RF_WiFi:USR-C322', 'keywords':'WiFi IEEE802.11 b/g/n', 'description':'', 'datasheet':'https://www.usriot.com/download/WIFI/USR-C322%20User%20Manual%20V2.3.pdf', 'search_text':'/usr/share/kicad/symbols/RF_WiFi.kicad_sym\nUSR-C322\n\nWiFi IEEE802.11 b/g/n', 'pins':[
            Pin(num='1',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='11',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='12',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='13',name='VBT_CC',func=pin_types.PWRIN,unit=1),
            Pin(num='14',name='VDD_ANA2',func=pin_types.PWRIN,unit=1),
            Pin(num='15',name='GPIO2',func=pin_types.BIDIR,unit=1),
            Pin(num='16',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='17',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='18',name='GPIO3',func=pin_types.BIDIR,unit=1),
            Pin(num='19',name='UART0_TX',func=pin_types.OUTPUT,unit=1),
            Pin(num='2',name='GPIO0',func=pin_types.BIDIR,unit=1),
            Pin(num='20',name='UART0_RX',func=pin_types.INPUT,unit=1),
            Pin(num='21',name='~{RELOAD}',func=pin_types.INPUT,unit=1),
            Pin(num='22',name='~{READY}',func=pin_types.OPENCOLL,unit=1),
            Pin(num='23',name='~{LINK}',func=pin_types.OPENCOLL,unit=1),
            Pin(num='24',name='UART0_CTS',func=pin_types.INPUT,unit=1),
            Pin(num='25',name='UART0_RTS',func=pin_types.OUTPUT,unit=1),
            Pin(num='26',name='GPIO4',func=pin_types.BIDIR,unit=1),
            Pin(num='27',name='GPIO5',func=pin_types.BIDIR,unit=1),
            Pin(num='28',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='29',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='3',name='GPIO1',func=pin_types.BIDIR,unit=1),
            Pin(num='30',name='UART1_TX',func=pin_types.OUTPUT,unit=1),
            Pin(num='31',name='UART1_RX',func=pin_types.INPUT,unit=1),
            Pin(num='32',name='GPIO6',func=pin_types.BIDIR,unit=1),
            Pin(num='33',name='GPIO7',func=pin_types.BIDIR,unit=1),
            Pin(num='34',name='GPIO8',func=pin_types.BIDIR,unit=1),
            Pin(num='35',name='GPIO9',func=pin_types.BIDIR,unit=1),
            Pin(num='36',name='GPIO10',func=pin_types.BIDIR,unit=1),
            Pin(num='37',name='GPIO11',func=pin_types.BIDIR,unit=1),
            Pin(num='38',name='GPIO12',func=pin_types.BIDIR,unit=1),
            Pin(num='39',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='4',name='~{RESET}',func=pin_types.INPUT,unit=1),
            Pin(num='40',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='41',name='GPIO13',func=pin_types.BIDIR,unit=1),
            Pin(num='42',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='43',name='NC',func=pin_types.NOCONNECT,unit=1),
            Pin(num='44',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='5',name='SOP2',func=pin_types.PASSIVE,unit=1),
            Pin(num='6',name='SOP1',func=pin_types.PASSIVE,unit=1),
            Pin(num='7',name='SOP0',func=pin_types.PASSIVE,unit=1),
            Pin(num='8',name='ANA_DC-DC',func=pin_types.PASSIVE,unit=1),
            Pin(num='9',name='NC',func=pin_types.NOCONNECT,unit=1)], 'unit_defs':[] })])