bus: Allow reserving hardware interfaces with [name] syntax

The special name "_" is treated as the bus name.
This commit is contained in:
Desuuuu 2022-05-22 18:22:23 +02:00
parent e21ba2e94f
commit 81629071b1
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
1 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,13 @@ def resolve_bus_name(mcu, param, bus):
if reserve_pins is not None: if reserve_pins is not None:
pin_resolver = ppins.get_pin_resolver(mcu_name) pin_resolver = ppins.get_pin_resolver(mcu_name)
for pin in reserve_pins.split(','): for pin in reserve_pins.split(','):
if pin.startswith('[') and pin.endswith(']'):
interface = pin[1:-1]
if interface == '_':
interface = bus
pin_resolver.reserve_interface(interface, "%s[%s]" % (
param, bus))
else:
pin_resolver.reserve_pin(pin, bus) pin_resolver.reserve_pin(pin, bus)
return bus return bus