1
- # The MIT License (MIT)
1
+ # SPDX-FileCopyrightText: Radomir Dopieralski 2016 for Adafruit Industries
2
+ # SPDX-FileCopyrightText: Tony DiCola 2016 for Adafruit Industries
2
3
#
3
- # Copyright (c) 2016 Radomir Dopieralski & Tony DiCola for Adafruit Industries
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
4
+ # SPDX-License-Identifier: MIT
22
5
23
6
"""
24
7
Segment Displays
@@ -216,13 +199,13 @@ def _text(self, text):
216
199
217
200
def _number (self , number , decimal = 0 ):
218
201
"""
219
- Display a floating point or integer number on the Adafruit HT16K33 based displays
202
+ Display a floating point or integer number on the Adafruit HT16K33 based displays
220
203
221
- Param: number - The floating point or integer number to be displayed, which must be
222
- in the range 0 (zero) to 9999 for integers and floating point or integer numbers
223
- and between 0.0 and 999.0 or 99.00 or 9.000 for floating point numbers.
224
- Param: decimal - The number of decimal places for a floating point number if decimal
225
- is greater than zero, or the input number is an integer if decimal is zero.
204
+ Param: number - The floating point or integer number to be displayed, which must be
205
+ in the range 0 (zero) to 9999 for integers and floating point or integer numbers
206
+ and between 0.0 and 999.0 or 99.00 or 9.000 for floating point numbers.
207
+ Param: decimal - The number of decimal places for a floating point number if decimal
208
+ is greater than zero, or the input number is an integer if decimal is zero.
226
209
227
210
Returns: The output text string to be displayed.
228
211
"""
@@ -319,7 +302,7 @@ def _scroll_marquee(self, text, delay):
319
302
320
303
class Seg7x4 (Seg14x4 ):
321
304
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
322
- supports displaying a limited set of characters."""
305
+ supports displaying a limited set of characters."""
323
306
324
307
POSITIONS = (0 , 2 , 6 , 8 ) # The positions of characters.
325
308
@@ -402,7 +385,7 @@ def colon(self, turn_on):
402
385
403
386
class BigSeg7x4 (Seg7x4 ):
404
387
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
405
- supports displaying a limited set of characters."""
388
+ supports displaying a limited set of characters."""
406
389
407
390
def __init__ (self , i2c , address = 0x70 , auto_write = True ):
408
391
super ().__init__ (i2c , address , auto_write )
@@ -411,12 +394,12 @@ def __init__(self, i2c, address=0x70, auto_write=True):
411
394
self .colon = Colon (self , 2 )
412
395
413
396
def _setindicator (self , index , value ):
414
- """ Set side LEDs (dots)
415
- Index is as follow :
416
- * 0 : two dots at the center
417
- * 1 : top-left dot
418
- * 2 : bottom-left dot
419
- * 3 : right dot (also ampm indicator)
397
+ """Set side LEDs (dots)
398
+ Index is as follow :
399
+ * 0 : two dots at the center
400
+ * 1 : top-left dot
401
+ * 2 : bottom-left dot
402
+ * 3 : right dot (also ampm indicator)
420
403
"""
421
404
bitmask = 1 << (index + 1 )
422
405
current = self ._get_buffer (0x04 )
@@ -428,8 +411,8 @@ def _setindicator(self, index, value):
428
411
self .show ()
429
412
430
413
def _getindicator (self , index ):
431
- """ Get side LEDs (dots)
432
- See setindicator() for indexes
414
+ """Get side LEDs (dots)
415
+ See setindicator() for indexes
433
416
"""
434
417
bitmask = 1 << (index + 1 )
435
418
return self ._get_buffer (0x04 ) & bitmask
0 commit comments