Skip to content

Commit 63247a8

Browse files
committed
segments: Add properties for LED indicators of BigSeg7x4
1 parent 6aacd0b commit 63247a8

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

adafruit_ht16k33/segments.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,11 @@ class BigSeg7x4(Seg7x4):
306306
supports displaying a limited set of characters."""
307307
def __init__(self, i2c, address=0x70, auto_write=True):
308308
super().__init__(i2c, address, auto_write)
309+
# Use colon for controling two-dots indicator at the center (index 0)
310+
# or the two-dots indicators at the left (index 1)
309311
self.colon = Colon(self, 2)
310312

311-
def setindicator(self, index, value):
313+
def _setindicator(self, index, value):
312314
""" Set side LEDs (dots)
313315
Index is as follow :
314316
* 0 : two dots at the center
@@ -325,22 +327,48 @@ def setindicator(self, index, value):
325327
if self._auto_write:
326328
self.show()
327329

328-
def getindicator(self, index):
330+
def _getindicator(self, index):
329331
""" Get side LEDs (dots)
330332
See setindicator() for indexes
331333
"""
332334
bitmask = 1 << (index + 1)
333335
return self._get_buffer(0x04) & bitmask
334336

337+
@property
338+
def two_dots_center(self):
339+
"""The two dots at the center indicator."""
340+
return bool(self._getindicator(0))
341+
342+
@two_dots_center.setter
343+
def two_dots_center(self, value):
344+
self._setindicator(0, value)
345+
346+
@property
347+
def top_left_dot(self):
348+
"""The top-left dot indicator."""
349+
return bool(self._getindicator(1))
350+
351+
@top_left_dot.setter
352+
def top_left_dot(self, value):
353+
self._setindicator(1, value)
354+
355+
@property
356+
def bottom_left_dot(self):
357+
"""The bottom-left dot indicator."""
358+
return bool(self._getindicator(2))
359+
360+
@bottom_left_dot.setter
361+
def bottom_left_dot(self, value):
362+
self._setindicator(2, value)
363+
335364
@property
336365
def ampm(self):
337366
"""The AM/PM indicator."""
338-
return bool(self.getindicator(3))
367+
return bool(self._getindicator(3))
339368

340369
@ampm.setter
341370
def ampm(self, value):
342-
self.setindicator(3, value)
343-
371+
self._setindicator(3, value)
344372

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

0 commit comments

Comments
 (0)