HAL_ChibiOS: automatically set AP_FEATURE_RTSCTS

This commit is contained in:
Andrew Tridgell 2019-12-04 10:29:52 +11:00
parent 5c4802ce25
commit 17118977dc
1 changed files with 4 additions and 0 deletions

View File

@ -943,6 +943,7 @@ def write_UART_config(f):
need_uart_driver = False
OTG2_index = None
devlist = []
have_rts_cts = False
for dev in uart_list:
if dev.startswith('UART'):
n = int(dev[4:])
@ -958,6 +959,7 @@ def write_UART_config(f):
if dev + "_RTS" in bylabel:
p = bylabel[dev + '_RTS']
rts_line = 'PAL_LINE(GPIO%s,%uU)' % (p.port, p.pin)
have_rts_cts = True
else:
rts_line = "0"
if dev.startswith('OTG2'):
@ -985,6 +987,8 @@ def write_UART_config(f):
f.write("%s, " % get_extra_bylabel(dev + "_RXINV", "POL", "0"))
f.write("%d, " % get_gpio_bylabel(dev + "_TXINV"))
f.write("%s}\n" % get_extra_bylabel(dev + "_TXINV", "POL", "0"))
if have_rts_cts:
f.write('#define AP_FEATURE_RTSCTS 1\n')
if OTG2_index is not None:
f.write('#define HAL_OTG2_UART_INDEX %d\n' % OTG2_index)
f.write('''