mcu: Allow reserving hardware interfaces with [name] syntax

This commit is contained in:
Desuuuu 2022-05-22 18:21:21 +02:00
parent 4d7c6e3005
commit e21ba2e94f
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
1 changed files with 4 additions and 1 deletions

View File

@ -783,7 +783,10 @@ class MCU:
for cname, value in self.get_constants().items():
if cname.startswith("RESERVE_PINS_"):
for pin in value.split(','):
pin_resolver.reserve_pin(pin, cname[13:])
if pin.startswith('[') and pin.endswith(']'):
pin_resolver.reserve_interface(pin[1:-1], cname[13:])
else:
pin_resolver.reserve_pin(pin, cname[13:])
self._mcu_freq = self.get_constant_float('CLOCK_FREQ')
self._stats_sumsq_base = self.get_constant_float('STATS_SUMSQ_BASE')
self._emergency_stop_cmd = self.lookup_command("emergency_stop")