@@ -325,16 +325,7 @@ def _scroll_marquee(self, text: str, delay: float) -> None:
325
325
self .show ()
326
326
327
327
328
- class Seg7x4 (Seg14x4 ):
329
- """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
330
- supports displaying a limited set of characters.
331
-
332
- :param I2C i2c: The I2C bus object
333
- :param int address: The I2C address for the display
334
- :param bool auto_write: True if the display should immediately change when set. If False,
335
- `show` must be called explicitly.
336
- """
337
-
328
+ class _AbstractSeg7x4 (Seg14x4 ):
338
329
POSITIONS = (0 , 2 , 6 , 8 ) # The positions of characters.
339
330
340
331
def __init__ (
@@ -345,8 +336,6 @@ def __init__(
345
336
char_dict : Optional [Dict [str , int ]] = None ,
346
337
) -> None :
347
338
super ().__init__ (i2c , address , auto_write )
348
- # Use colon for controling two-dots indicator at the center (index 0)
349
- self ._colon = Colon (self )
350
339
self ._chardict = char_dict
351
340
352
341
def scroll (self , count : int = 1 ) -> None :
@@ -430,6 +419,28 @@ def set_digit_raw(self, index: int, bitmask: int) -> None:
430
419
if self ._auto_write :
431
420
self .show ()
432
421
422
+
423
+ class Seg7x4 (_AbstractSeg7x4 ):
424
+ """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
425
+ supports displaying a limited set of characters.
426
+
427
+ :param I2C i2c: The I2C bus object
428
+ :param int address: The I2C address for the display
429
+ :param bool auto_write: True if the display should immediately change when set. If False,
430
+ `show` must be called explicitly.
431
+ """
432
+
433
+ def __init__ (
434
+ self ,
435
+ i2c : I2C ,
436
+ address : int = 0x70 ,
437
+ auto_write : bool = True ,
438
+ char_dict : Optional [Dict [str , int ]] = None ,
439
+ ) -> None :
440
+ super ().__init__ (i2c , address , auto_write , char_dict )
441
+ # Use colon for controling two-dots indicator at the center (index 0)
442
+ self ._colon = Colon (self )
443
+
433
444
@property
434
445
def colon (self ) -> bool :
435
446
"""Simplified colon accessor"""
@@ -440,7 +451,7 @@ def colon(self, turn_on: bool) -> None:
440
451
self ._colon [0 ] = turn_on
441
452
442
453
443
- class BigSeg7x4 (Seg7x4 ):
454
+ class BigSeg7x4 (_AbstractSeg7x4 ):
444
455
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
445
456
supports displaying a limited set of characters.
446
457
@@ -457,11 +468,10 @@ def __init__(
457
468
auto_write : bool = True ,
458
469
char_dict : Optional [Dict [str , int ]] = None ,
459
470
) -> None :
460
- super ().__init__ (i2c , address , auto_write )
471
+ super ().__init__ (i2c , address , auto_write , char_dict )
461
472
# Use colon for controling two-dots indicator at the center (index 0)
462
473
# or the two-dots indicators at the left (index 1)
463
- self .colon = Colon (self , 2 )
464
- self ._chardict = char_dict
474
+ self .colons = Colon (self , 2 )
465
475
466
476
def _setindicator (self , index : int , value : bool ) -> None :
467
477
"""Set side LEDs (dots)
0 commit comments