Separate count from the list of indexes in configuration.IoPin.

This commit is contained in:
Jean-Paul Chaput 2022-05-12 17:52:55 +02:00
parent 59c0ab067b
commit 5ff81b59ec
1 changed files with 6 additions and 7 deletions

View File

@ -1186,7 +1186,12 @@ class IoPin ( object ):
self.stem = stem
self.upos = upos
self.ustep = ustep
if isinstance(count,int):
self.count = count
self.indexes = range(self.count)
else:
self.count = len(count)
self.indexes = count
if self.upos == 0 and not (self.flags & IoPin.A_MASK):
raise ErrorMessage( 1, [ 'IoPin.__init__(): "upos" parameter cannot be zero, corners are forbidden.'
, 'For net "{}"'.format(stem) ] )
@ -1194,12 +1199,6 @@ class IoPin ( object ):
raise ErrorMessage( 1, [ 'IoPin.__init__(): "ustep" parameter cannot be zero when "count" more than 1.'
, 'For net "{}"'.format(stem) ] )
@property
def indexes ( self ):
if isinstance(self.count,int):
return range(self.count)
return self.count
# def place ( self, block ):
# """
# Performs the actual creation of the Pin. Should be called prior to any