Skip to content

Commit 50773e2

Browse files
authored
Merge pull request #69 from makermelissa/set_digit_raw
Fix potential issue with tuple bitmask tuple to set_digit_raw
2 parents ec61e8a + c710229 commit 50773e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

adafruit_ht16k33/segments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def set_digit_raw(self, index, bitmask):
268268
return
269269

270270
if isinstance(bitmask, (tuple, list)):
271-
bitmask = bitmask[0] << 8 | bitmask[1]
271+
bitmask = ((bitmask[0] & 0xFF) << 8) | (bitmask[1] & 0xFF)
272272

273273
# Set the digit bitmask value at the appropriate position.
274274
self._set_buffer(index * 2, bitmask & 0xFF)

examples/ht16k33_matrix_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# This creates a 16x8 matrix:
2020
matrix = matrix.Matrix16x8(i2c)
2121
# Or this creates a 16x8 matrix backpack:
22-
# matrix = matrix.MatrixBackpack16x8(i2c)
22+
#matrix = matrix.MatrixBackpack16x8(i2c)
2323
# Or this creates a 8x8 matrix:
2424
#matrix = matrix.Matrix8x8(i2c)
2525
# Or this creates a 8x8 bicolor matrix:

0 commit comments

Comments
 (0)