Browse Source

HAL_ChibiOS: adjust pin counts for STM32F7

mission-4.1.18
Andrew Tridgell 7 years ago
parent
commit
8d2f57898b
  1. 15
      libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py
  2. 20
      libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

15
libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32F767xx.py

@ -10,6 +10,21 @@ build = {
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32F7xx/platform.mk" "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 = { DMA_Map = {
# format is (DMA_TABLE, StreamNum, Channel) # format is (DMA_TABLE, StreamNum, Channel)
"ADC1" : [(2,0,0),(2,4,0)], "ADC1" : [(2,0,0),(2,4,0)],

20
libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

@ -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:

Loading…
Cancel
Save