Skip to content

Commit 1d6f795

Browse files
author
caternuson
committed
tweak the init, add check
1 parent e92c95f commit 1d6f795

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_ht16k33/ht16k33.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, i2c, address=0x70, auto_write=True):
4444
self.i2c_device = i2c_device.I2CDevice(i2c, address)
4545
self._temp = bytearray(1)
4646
self._buffer = bytearray(17)
47+
self._auto_write = None
4748
self._auto_write = auto_write
4849
self.fill(0)
4950
self._write_cmd(_HT16K33_OSCILATOR_ON)
@@ -93,7 +94,10 @@ def auto_write(self):
9394

9495
@auto_write.setter
9596
def auto_write(self, auto_write):
96-
self._auto_write = auto_write
97+
if isinstance(auto_write, bool):
98+
self._auto_write = auto_write
99+
else:
100+
raise ValueError('Must set to either True or False.')
97101

98102
def show(self):
99103
"""Refresh the display and show the changes."""

0 commit comments

Comments
 (0)