HAL_ChibiOS: fixed serial info indexing for EMPTY uarts

This commit is contained in:
Andrew Tridgell 2021-06-05 13:51:31 +10:00
parent 6fab8feeae
commit c34d8e80e9

View File

@ -1199,12 +1199,11 @@ def write_UART_config(f):
devnames = "ABCDEFGHI"
sdev = 0
idx = 0
num_empty_uarts = 0
for dev in uart_list:
if dev == 'EMPTY':
f.write('#define HAL_UART%s_DRIVER Empty::UARTDriver uart%sDriver\n' %
(devnames[idx], devnames[idx]))
num_empty_uarts += 1
sdev += 1
else:
f.write(
'#define HAL_UART%s_DRIVER ChibiOS::UARTDriver uart%sDriver(%u)\n'
@ -1242,6 +1241,7 @@ def write_UART_config(f):
elif dev.startswith('OTG'):
n = int(dev[3:])
elif dev.startswith('EMPTY'):
devlist.append('{}')
continue
else:
error("Invalid element %s in UART_ORDER" % dev)
@ -1307,7 +1307,7 @@ def write_UART_config(f):
num_uarts -= 1
if num_uarts > 9:
error("Exceeded max num UARTs of 9 (%u)" % num_uarts)
f.write('#define HAL_UART_NUM_SERIAL_PORTS %u\n' % (num_uarts+num_empty_uarts))
f.write('#define HAL_UART_NUM_SERIAL_PORTS %u\n' % num_uarts)
def write_UART_config_bootloader(f):