@@ -59,6 +59,7 @@ def _shift_in(target_byte, val):
59
59
target_byte <<= 1
60
60
if val :
61
61
target_byte |= 0x01
62
+ return target_byte
62
63
63
64
64
65
class TLC59711 :
@@ -147,10 +148,11 @@ def __init__(self, spi, *, auto_show=True):
147
148
# the auto_show property and instead you must manually call show
148
149
# after changing them (reduces the need to make frivolous
149
150
# memory-hogging properties).
150
- self .outtmg = False
151
+ # Set OUTTMG, TMGRST, and DSPRPT to on like the Arduino library.
152
+ self .outtmg = True
151
153
self .extgclk = False
152
- self .tmgrst = False
153
- self .dsprpt = False
154
+ self .tmgrst = True
155
+ self .dsprpt = True
154
156
self .blank = False
155
157
156
158
def _write (self ):
@@ -166,14 +168,14 @@ def _write(self):
166
168
self ._shift_reg [0 ] = 0x25 # 0x25 in top 6 bits initiates write.
167
169
# Lower two bits control OUTTMG and EXTGCLK bits, set them
168
170
# as appropriate.
169
- _shift_in (self ._shift_reg [0 ], self .outtmg )
170
- _shift_in (self ._shift_reg [0 ], self .extgclk )
171
+ self . _shift_reg [ 0 ] = _shift_in (self ._shift_reg [0 ], self .outtmg )
172
+ self . _shift_reg [ 0 ] = _shift_in (self ._shift_reg [0 ], self .extgclk )
171
173
# Next byte contains remaining function control state and start of
172
174
# brightness control bits.
173
175
self ._shift_reg [1 ] = 0x00
174
- _shift_in (self ._shift_reg [1 ], self .tmgrst )
175
- _shift_in (self ._shift_reg [1 ], self .dsprpt )
176
- _shift_in (self ._shift_reg [1 ], self .blank )
176
+ self . _shift_reg [ 1 ] = _shift_in (self ._shift_reg [1 ], self .tmgrst )
177
+ self . _shift_reg [ 1 ] = _shift_in (self ._shift_reg [1 ], self .dsprpt )
178
+ self . _shift_reg [ 1 ] = _shift_in (self ._shift_reg [1 ], self .blank )
177
179
# Top 5 bits from BC blue channel.
178
180
self ._shift_reg [1 ] <<= 5
179
181
self ._shift_reg [1 ] |= (self ._bcb >> 2 ) & 0b11111
0 commit comments