bus: Allow bus-specific pin reservations

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

View File

@ -25,9 +25,11 @@ def resolve_bus_name(mcu, param, bus):
raise ppins.error("Unknown %s '%s'" % (param, bus))
# Check for reserved bus pins
constants = mcu.get_constants()
reserve_pins = constants.get('BUS_PINS_%s@%s' % (bus, param), None)
if reserve_pins is None:
reserve_pins = constants.get('BUS_PINS_%s' % (bus,), None)
pin_resolver = ppins.get_pin_resolver(mcu_name)
if reserve_pins is not None:
pin_resolver = ppins.get_pin_resolver(mcu_name)
for pin in reserve_pins.split(','):
pin_resolver.reserve_pin(pin, bus)
return bus