Skip to content

Commit 5918c32

Browse files
committed
Cloned Matrix8x16 to work correctly with the 8x16Feather display.
Added functionality to display text in a marquee format. Added the ability to read the current display back to an image to allow merging of a new image to the existing one.
1 parent e34b954 commit 5918c32

File tree

2 files changed

+393
-0
lines changed

2 files changed

+393
-0
lines changed

Adafruit_LED_Backpack/HT16K33.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,28 @@ def set_led(self, led, value):
9090
# Turn on the speciried LED (set bit to one).
9191
self.buffer[pos] |= (1 << offset)
9292

93+
def get_led(self, led):
94+
"""Gets specified LED (value of 0 to 127), 0/False
95+
for off and 1 (or any True/non-zero value) for on.
96+
"""
97+
if led < 0 or led > 127:
98+
raise ValueError('LED must be value of 0 to 127.')
99+
# Calculate position in byte buffer and bit offset of desired LED.
100+
pos = led // 8
101+
offset = led % 8
102+
pixel = self.buffer[pos] & (1 << offset)
103+
return 0 if pixel == 0 else 1
104+
93105
def write_display(self):
94106
"""Write display buffer to display hardware."""
95107
for i, value in enumerate(self.buffer):
96108
self._device.write8(i, value)
97109

110+
def read_display(self):
111+
"""Write display buffer to display hardware."""
112+
for pos in range(16):
113+
self.buffer[pos] = self._device.readU8(pos)
114+
98115
def clear(self):
99116
"""Clear contents of display buffer."""
100117
for i, value in enumerate(self.buffer):

0 commit comments

Comments
 (0)