HAL_ChibiOS: fixed regex error for GPIOs

This commit is contained in:
Andrew Tridgell 2021-11-05 15:22:48 +11:00
parent d3742989ef
commit 97aee6f45e

View File

@ -558,9 +558,9 @@ class generic_pin(object):
def periph_instance(self): def periph_instance(self):
'''return peripheral instance''' '''return peripheral instance'''
if self.periph_type() == 'PERIPH_TYPE::GPIO': if self.periph_type() == 'PERIPH_TYPE::GPIO':
result = re.match(r'[A-Z_]*([0-9]*)', self.label) result = re.match(r'[A-Z_]*([0-9]+)', self.label)
else: else:
result = re.match(r'[A-Z_]*([0-9]*)', self.type) result = re.match(r'[A-Z_]*([0-9]+)', self.type)
if result: if result:
return int(result.group(1)) return int(result.group(1))
return 0 return 0