Skip to content

Commit 77e2c5d

Browse files
author
=Dale Weber
committed
Merge branch 'master' of https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 into modify_brightness_property
2 parents 0aea7b8 + 50773e2 commit 77e2c5d

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ jobs:
3434
with:
3535
repository: adafruit/actions-ci-circuitpython-libs
3636
path: actions-ci
37-
- name: Install deps
37+
- name: Install dependencies
38+
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
3839
run: |
3940
source actions-ci/install.sh
41+
- name: Pip install pylint, black, & Sphinx
42+
run: |
43+
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
4044
- name: Library version
4145
run: git describe --dirty --always --tags
4246
- name: PyLint

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:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Basic example of using FrameBuffer to create and scroll text on the matrix.
2+
3+
# Requires: adafruit_framebuf
4+
5+
import board
6+
import busio
7+
import adafruit_framebuf
8+
9+
# Import the HT16K33 LED matrix module.
10+
from adafruit_ht16k33 import matrix
11+
12+
# Create the I2C interface.
13+
i2c = busio.I2C(board.SCL, board.SDA)
14+
15+
# Create the matrix class.
16+
# This creates a 16x8 matrix:
17+
matrix = matrix.Matrix16x8(i2c)
18+
19+
# Low brightness so it's easier to look at
20+
matrix.brightness = 0
21+
22+
# Clear the matrix.
23+
matrix.fill(0)
24+
25+
text_to_show = "Hello Blinka"
26+
27+
# Create a framebuffer for our display
28+
buf = bytearray(16) # 1 bytes tall x 16 wide = 16 bytes
29+
fb = adafruit_framebuf.FrameBuffer(buf, 16, 8, adafruit_framebuf.MVLSB)
30+
31+
32+
while True:
33+
for i in range(len(text_to_show) * 8):
34+
fb.fill(0)
35+
fb.text(text_to_show, -i + 16, 0, color=1)
36+
# turn all LEDs off
37+
matrix.fill(0)
38+
for x in range(16):
39+
# using the FrameBuffer text result
40+
bite = buf[x]
41+
for y in range(8):
42+
bit = 1 << y & bite
43+
# if bit > 0 then set the pixel brightness
44+
if bit:
45+
matrix[16-x, y+1] = 1

0 commit comments

Comments
 (0)