Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions adafruit_ht16k33/ht16k33.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ def fill(self, color):
self.show()

def _pixel(self, x, y, color=None):
mask = 1 << x
addr = 2*y + x // 8
mask = 1 << x % 8
if color is None:
return bool((self._buffer[y + 1] | self._buffer[y + 2] << 8) & mask)
return bool(self._buffer[addr + 1] & mask)
if color:
self._buffer[(y * 2) + 1] |= mask & 0xff
self._buffer[(y * 2) + 2] |= mask >> 8
# set the bit
self._buffer[addr + 1] |= mask
else:
self._buffer[(y * 2) + 1] &= ~(mask & 0xff)
self._buffer[(y * 2) + 2] &= ~(mask >> 8)
# clear the bit
self._buffer[addr + 1] &= ~mask
if self._auto_write:
self.show()
return None
Expand Down