Add request_remaining("name") that returns unallocated pins.
Improve error reporting on request_all().
This commit is contained in:
parent
a426ec9e2f
commit
0b9ffb6adb
|
@ -230,7 +230,18 @@ class ConstraintManager:
|
|||
except ConstraintError:
|
||||
break
|
||||
if not len(r):
|
||||
raise ValueError
|
||||
raise ValueError(f"Could not request some pin(s) named '{name}'")
|
||||
return Cat(r)
|
||||
|
||||
def request_remaining(self, name):
|
||||
r = []
|
||||
while True:
|
||||
try:
|
||||
r.append(self.request(name))
|
||||
except ConstraintError:
|
||||
break
|
||||
if not len(r):
|
||||
raise ValueError(f"Could not request any pins named '{name}'")
|
||||
return Cat(r)
|
||||
|
||||
def lookup_request(self, name, number=None, loose=False):
|
||||
|
@ -321,6 +332,9 @@ class GenericPlatform:
|
|||
def request_all(self, *args, **kwargs):
|
||||
return self.constraint_manager.request_all(*args, **kwargs)
|
||||
|
||||
def request_remaining(self, *args, **kwargs):
|
||||
return self.constraint_manager.request_remaining(*args, **kwargs)
|
||||
|
||||
def lookup_request(self, *args, **kwargs):
|
||||
return self.constraint_manager.lookup_request(*args, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue