Skip to content

Commit 5a46320

Browse files
committed
segments: Add properties for LED indicators of BigSeg7x4
1 parent 07119c6 commit 5a46320

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

adafruit_ht16k33/segments.py

+33-5
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,11 @@ class BigSeg7x4(Seg7x4):
273273
supports displaying a limited set of characters."""
274274
def __init__(self, i2c, address=0x70, auto_write=True):
275275
super().__init__(i2c, address, auto_write)
276+
# Use colon for controling two-dots indicator at the center (index 0)
277+
# or the two-dots indicators at the left (index 1)
276278
self.colon = Colon(self, 2)
277279

278-
def setindicator(self, index, value):
280+
def _setindicator(self, index, value):
279281
""" Set side LEDs (dots)
280282
Index is as follow :
281283
* 0 : two dots at the center
@@ -292,22 +294,48 @@ def setindicator(self, index, value):
292294
if self._auto_write:
293295
self.show()
294296

295-
def getindicator(self, index):
297+
def _getindicator(self, index):
296298
""" Get side LEDs (dots)
297299
See setindicator() for indexes
298300
"""
299301
bitmask = 1 << (index + 1)
300302
return self._get_buffer(0x04) & bitmask
301303

304+
@property
305+
def two_dots_center(self):
306+
"""The two dots at the center indicator."""
307+
return bool(self._getindicator(0))
308+
309+
@two_dots_center.setter
310+
def two_dots_center(self, value):
311+
self._setindicator(0, value)
312+
313+
@property
314+
def top_left_dot(self):
315+
"""The top-left dot indicator."""
316+
return bool(self._getindicator(1))
317+
318+
@top_left_dot.setter
319+
def top_left_dot(self, value):
320+
self._setindicator(1, value)
321+
322+
@property
323+
def bottom_left_dot(self):
324+
"""The bottom-left dot indicator."""
325+
return bool(self._getindicator(2))
326+
327+
@bottom_left_dot.setter
328+
def bottom_left_dot(self, value):
329+
self._setindicator(2, value)
330+
302331
@property
303332
def ampm(self):
304333
"""The AM/PM indicator."""
305-
return bool(self.getindicator(3))
334+
return bool(self._getindicator(3))
306335

307336
@ampm.setter
308337
def ampm(self, value):
309-
self.setindicator(3, value)
310-
338+
self._setindicator(3, value)
311339

312340
class Colon():
313341
"""Helper class for controlling the colons. Not intended for direct use."""

0 commit comments

Comments
 (0)