Skip to content

Commit fefd1db

Browse files
authored
Merge pull request #108 from carlfj/patch-1
Ignore last 2 bits of digital input, only on boards without long ints
2 parents 159c8ec + 6dadb45 commit fefd1db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_seesaw/seesaw.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ def digital_read_bulk(self, pins, delay=0.008):
214214
"""Get the values of all the pins on the 'A' port as a bitmask"""
215215
buf = bytearray(4)
216216
self.read(_GPIO_BASE, _GPIO_BULK, buf, delay=delay)
217-
ret = struct.unpack(">I", buf)[0]
217+
try:
218+
ret = struct.unpack(">I", buf)[0]
219+
except OverflowError:
220+
buf[0] = buf[0] & 0x3F
221+
ret = struct.unpack(">I", buf)[0]
218222
return ret & pins
219223

220224
def digital_read_bulk_b(self, pins, delay=0.008):

0 commit comments

Comments
 (0)