AP_HAL_ChibiOS: add support for GPIO pins as software CTS

This commit is contained in:
Andrew Tridgell 2024-06-22 08:57:22 +10:00 committed by Peter Barker
parent b6cdb8b1a6
commit ebc4ee99a9

View File

@ -189,9 +189,9 @@ class ChibiOSHWDef(object):
return 0
return None
if function and function.endswith("_RTS") and (
if function and (function.endswith("_RTS") or function.endswith("_CTS_GPIO")) and (
function.startswith('USART') or function.startswith('UART')):
# we do software RTS
# we do software RTS and can do either software CTS or hardware CTS
return None
for label in self.af_labels:
@ -1891,6 +1891,8 @@ INCLUDE common.ld
rts_line_name = dev + '_RTS'
rts_line = self.make_line(rts_line_name)
cts_line = self.make_line(dev + '_CTS')
if cts_line == "0":
cts_line = self.make_line(dev + '_CTS_GPIO')
if rts_line != "0":
have_rts_cts = True
f.write('#define HAL_HAVE_RTSCTS_SERIAL%u\n' % num)
@ -2927,12 +2929,12 @@ Please run: Tools/scripts/build_bootloaders.py %s
if ptype == 'OUTPUT' and re.match(r'US?ART\d+_(TXINV|RXINV)', label):
return True
m1 = re.match(r'USART(\d+)', ptype)
m2 = re.match(r'USART(\d+)_(RX|TX|CTS|RTS)', label)
m2 = re.match(r'USART(\d+)_(RX|TX|CTS|RTS|CTS_GPIO)', label)
if (m1 and not m2) or (m2 and not m1) or (m1 and m1.group(1) != m2.group(1)):
'''usart numbers need to match'''
return False
m1 = re.match(r'UART(\d+)', ptype)
m2 = re.match(r'UART(\d+)_(RX|TX|CTS|RTS)', label)
m2 = re.match(r'UART(\d+)_(RX|TX|CTS|RTS|CTS_GPIO)', label)
if (m1 and not m2) or (m2 and not m1) or (m1 and m1.group(1) != m2.group(1)):
'''uart numbers need to match'''
return False