|
|
@ -92,6 +92,18 @@ def get_mcu_lib(mcu): |
|
|
|
except ImportError: |
|
|
|
except ImportError: |
|
|
|
error("Unable to find module for MCU %s" % mcu) |
|
|
|
error("Unable to find module for MCU %s" % mcu) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup_mcu_type_defaults(): |
|
|
|
|
|
|
|
'''setup defaults for given mcu type''' |
|
|
|
|
|
|
|
lib = get_mcu_lib(mcu_type) |
|
|
|
|
|
|
|
if hasattr(lib, 'pincount'): |
|
|
|
|
|
|
|
pincount = lib.pincount |
|
|
|
|
|
|
|
ports = pincount.keys() |
|
|
|
|
|
|
|
# setup default as input pins |
|
|
|
|
|
|
|
for port in ports: |
|
|
|
|
|
|
|
portmap[port] = [] |
|
|
|
|
|
|
|
for pin in range(pincount[port]): |
|
|
|
|
|
|
|
portmap[port].append(generic_pin(port, pin, None, 'INPUT', [])) |
|
|
|
|
|
|
|
|
|
|
|
def get_alt_function(mcu, pin, function): |
|
|
|
def get_alt_function(mcu, pin, function): |
|
|
|
'''return alternative function number for a pin''' |
|
|
|
'''return alternative function number for a pin''' |
|
|
|
lib = get_mcu_lib(mcu) |
|
|
|
lib = get_mcu_lib(mcu) |
|
|
@ -282,13 +294,6 @@ class generic_pin(object): |
|
|
|
str) |
|
|
|
str) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# setup default as input pins |
|
|
|
|
|
|
|
for port in ports: |
|
|
|
|
|
|
|
portmap[port] = [] |
|
|
|
|
|
|
|
for pin in range(pincount[port]): |
|
|
|
|
|
|
|
portmap[port].append(generic_pin(port, pin, None, 'INPUT', [])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_config(name, column=0, required=True, default=None, type=None): |
|
|
|
def get_config(name, column=0, required=True, default=None, type=None): |
|
|
|
'''get a value from config dictionary''' |
|
|
|
'''get a value from config dictionary''' |
|
|
|
if not name in config: |
|
|
|
if not name in config: |
|
|
@ -1040,6 +1045,7 @@ def process_line(line): |
|
|
|
if a[0] == 'MCU': |
|
|
|
if a[0] == 'MCU': |
|
|
|
global mcu_type |
|
|
|
global mcu_type |
|
|
|
mcu_type = a[2] |
|
|
|
mcu_type = a[2] |
|
|
|
|
|
|
|
setup_mcu_type_defaults() |
|
|
|
if a[0].startswith('P') and a[0][1] in ports: |
|
|
|
if a[0].startswith('P') and a[0][1] in ports: |
|
|
|
# it is a port/pin definition |
|
|
|
# it is a port/pin definition |
|
|
|
try: |
|
|
|
try: |
|
|
|