@@ -325,29 +325,16 @@ 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__ (
341
332
self ,
342
333
i2c : I2C ,
343
334
address : int = 0x70 ,
344
- auto_write : bool = True ,
345
- char_dict : Optional [Dict [str , int ]] = None ,
335
+ auto_write : bool = True
346
336
) -> None :
347
337
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
- self ._chardict = char_dict
351
338
352
339
def scroll (self , count : int = 1 ) -> None :
353
340
"""Scroll the display by specified number of places.
@@ -430,6 +417,27 @@ def set_digit_raw(self, index: int, bitmask: int) -> None:
430
417
if self ._auto_write :
431
418
self .show ()
432
419
420
+ class Seg7x4 (_AbstractSeg7x4 ):
421
+ """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
422
+ supports displaying a limited set of characters.
423
+
424
+ :param I2C i2c: The I2C bus object
425
+ :param int address: The I2C address for the display
426
+ :param bool auto_write: True if the display should immediately change when set. If False,
427
+ `show` must be called explicitly.
428
+ """
429
+ def __init__ (
430
+ self ,
431
+ i2c : I2C ,
432
+ address : int = 0x70 ,
433
+ auto_write : bool = True ,
434
+ char_dict : Optional [Dict [str , int ]] = None ,
435
+ ) -> None :
436
+ super ().__init__ (i2c , address , auto_write )
437
+ # Use colon for controling two-dots indicator at the center (index 0)
438
+ self ._colon = Colon (self )
439
+ self ._chardict = char_dict
440
+
433
441
@property
434
442
def colon (self ) -> bool :
435
443
"""Simplified colon accessor"""
@@ -440,7 +448,7 @@ def colon(self, turn_on: bool) -> None:
440
448
self ._colon [0 ] = turn_on
441
449
442
450
443
- class BigSeg7x4 (Seg7x4 ):
451
+ class BigSeg7x4 (_AbstractSeg7x4 ):
444
452
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
445
453
supports displaying a limited set of characters.
446
454
@@ -460,7 +468,7 @@ def __init__(
460
468
super ().__init__ (i2c , address , auto_write )
461
469
# Use colon for controling two-dots indicator at the center (index 0)
462
470
# or the two-dots indicators at the left (index 1)
463
- self .colon = Colon (self , 2 )
471
+ self .colons = Colon (self , 2 )
464
472
self ._chardict = char_dict
465
473
466
474
def _setindicator (self , index : int , value : bool ) -> None :
@@ -514,7 +522,6 @@ def ampm(self) -> bool:
514
522
def ampm (self , value : bool ) -> None :
515
523
self ._setindicator (3 , value )
516
524
517
-
518
525
class Colon :
519
526
"""Helper class for controlling the colons. Not intended for direct use."""
520
527
0 commit comments