Skip to content

Commit 36821eb

Browse files
committed
Small fixes.
1 parent 97f8d13 commit 36821eb

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

adafruit_tlc5947.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ def write(self):
122122
# Lock the SPI bus and configure it for the shift register.
123123
while not self._spi.try_lock():
124124
pass
125-
self._spi.configure(baudrate=30000000, polarity=0, phase=0)
125+
self._spi.configure(baudrate=1000000, polarity=0, phase=0, bits=8)
126126
# First ensure latch is low.
127-
self._latch = False
127+
self._latch.value = False
128128
# Write out the bits.
129-
self._spi.write(self._shift_reg)
129+
self._spi.write(self._shift_reg, start=0, end=37)
130130
# Then toggle latch high and low to set the value.
131-
self._latch = True
132-
self._latch = False
131+
self._latch.value = True
132+
self._latch.value = False
133133
finally:
134134
# Ensure the SPI bus is unlocked.
135135
self._spi.unlock()

examples/simpletest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
# Define pins connected to the TLC5947
1212
SCK = board.SCK
1313
MOSI = board.MOSI
14-
LATCH = board.D5
14+
LATCH = digitalio.DigitalInOut(board.D5)
1515

1616
# Initialize SPI bus.
17-
spi = busio.SPI(SCK=SCK, MOSI=MOSI)
17+
spi = busio.SPI(clock=SCK, MOSI=MOSI)
1818

1919
# Initialize TLC5947
20-
tlc5947 = adafruit_tlc5947.TLC5947(spi, digitalio.DigitalInOut(LATCH))
20+
tlc5947 = adafruit_tlc5947.TLC5947(spi, LATCH)
2121
# You can optionally disable auto_write which allows you to control when
2222
# channel state is written to the chip. Normally auto_write is true and
2323
# will automatically write out changes as soon as they happen to a channel, but
2424
# if you need more control or atomic updates of multiple channels then disable
2525
# and manually call write as shown below.
26+
#tlc5947 = adafruit_tlc5947.TLC5947(spi, LATCH, auto_write=False)
2627

2728
# There are two ways to channel channel PWM values. The first is by getting
2829
# a PWMOut object that acts like the built-in PWMOut and can be used anywhere

0 commit comments

Comments
 (0)