Skip to content

Commit 08b14b3

Browse files
committed
bitcount 0..32 range
1 parent dcda5b7 commit 08b14b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

simpleio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ def shift_out(data_pin, clock, value, msb_first=True, bitcount=8):
178178
latchpin.value = True
179179
time.sleep(1.0)
180180
"""
181-
if bitcount < 0:
182-
raise ValueError('bitcount must be positive')
181+
if bitcount < 0 or bitcount > 32:
182+
raise ValueError('bitcount must be in range 0..32 inclusive')
183183

184184
if msb_first:
185185
bitsequence = lambda: range(bitcount-1, -1, -1)

0 commit comments

Comments
 (0)