We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b6fcdba + 7dd810a commit c9b3047Copy full SHA for c9b3047
adafruit_ht16k33/ht16k33.py
@@ -121,15 +121,16 @@ def fill(self, color):
121
self.show()
122
123
def _pixel(self, x, y, color=None):
124
- mask = 1 << x
+ addr = 2*y + x // 8
125
+ mask = 1 << x % 8
126
if color is None:
- return bool((self._buffer[y + 1] | self._buffer[y + 2] << 8) & mask)
127
+ return bool(self._buffer[addr + 1] & mask)
128
if color:
- self._buffer[(y * 2) + 1] |= mask & 0xff
129
- self._buffer[(y * 2) + 2] |= mask >> 8
+ # set the bit
130
+ self._buffer[addr + 1] |= mask
131
else:
- self._buffer[(y * 2) + 1] &= ~(mask & 0xff)
132
- self._buffer[(y * 2) + 2] &= ~(mask >> 8)
+ # clear the bit
133
+ self._buffer[addr + 1] &= ~mask
134
if self._auto_write:
135
136
return None
0 commit comments