HAL_ChibiOS: adjust pin counts for STM32F7

This commit is contained in:
Andrew Tridgell 2018-05-29 19:50:51 +10:00
parent 1f6ffc48e5
commit 8d2f57898b
2 changed files with 28 additions and 7 deletions

View File

@ -10,6 +10,21 @@ build = {
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32F7xx/platform.mk"
}
pincount = {
'A': 16,
'B': 16,
'C': 16,
'D': 16,
'E': 16,
'F': 16,
'G': 16,
'H': 16,
'I': 16,
'J': 0,
'K': 0
}
DMA_Map = {
# format is (DMA_TABLE, StreamNum, Channel)
"ADC1" : [(2,0,0),(2,4,0)],

View File

@ -92,6 +92,18 @@ def get_mcu_lib(mcu):
except ImportError:
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):
'''return alternative function number for a pin'''
lib = get_mcu_lib(mcu)
@ -282,13 +294,6 @@ class generic_pin(object):
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):
'''get a value from config dictionary'''
if not name in config:
@ -1040,6 +1045,7 @@ def process_line(line):
if a[0] == 'MCU':
global mcu_type
mcu_type = a[2]
setup_mcu_type_defaults()
if a[0].startswith('P') and a[0][1] in ports:
# it is a port/pin definition
try: