mirror of https://github.com/Desuuuu/klipper.git
pin_resolver: Add hardware interface reservation
This commit is contained in:
parent
c84956befe
commit
61753fb63b
|
@ -154,6 +154,7 @@ class PinResolver:
|
|||
def __init__(self, validate_aliases=True):
|
||||
self.validate_aliases = validate_aliases
|
||||
self.reserved = {}
|
||||
self.reserved_interfaces = {}
|
||||
self.aliases = {}
|
||||
self.active_pins = {}
|
||||
def reserve_pin(self, pin, reserve_name):
|
||||
|
@ -161,6 +162,13 @@ class PinResolver:
|
|||
raise error("Pin %s reserved for %s - can't reserve for %s" % (
|
||||
pin, self.reserved[pin], reserve_name))
|
||||
self.reserved[pin] = reserve_name
|
||||
def reserve_interface(self, interface, reserve_name):
|
||||
if (interface in self.reserved_interfaces
|
||||
and self.reserved_interfaces[interface] != reserve_name):
|
||||
raise error("Interface %s reserved for %s - can't reserve for %s"
|
||||
% (interface, self.reserved_interfaces[interface],
|
||||
reserve_name))
|
||||
self.reserved_interfaces[interface] = reserve_name
|
||||
def alias_pin(self, alias, pin):
|
||||
if alias in self.aliases and self.aliases[alias] != pin:
|
||||
raise error("Alias %s mapped to %s - can't alias to %s" % (
|
||||
|
|
Loading…
Reference in New Issue