@@ -215,6 +215,26 @@ def _number(self, number):
215
215
self ._text (string [:places ])
216
216
self ._auto_write = auto_write
217
217
218
+ def set_digit_raw (self , index , bitmask ):
219
+ """Set digit at position to raw bitmask value. Position should be a value
220
+ of 0 to 3 with 0 being the left most character on the display.
221
+
222
+ bitmask should be 2 bytes such as: 0xFFFF
223
+ If can be passed as an integer, list, or tuple
224
+ """
225
+ if not 0 <= index <= 3 :
226
+ return
227
+
228
+ if isinstance (bitmask , (tuple , list )):
229
+ bitmask = bitmask [0 ] << 8 | bitmask [1 ]
230
+
231
+ # Set the digit bitmask value at the appropriate position.
232
+ self ._set_buffer (index * 2 , (bitmask >> 8 ) & 0xFF )
233
+ self ._set_buffer (index * 2 + 1 , bitmask & 0xFF )
234
+
235
+ if self ._auto_write :
236
+ self .show ()
237
+
218
238
class Seg7x4 (Seg14x4 ):
219
239
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
220
240
supports displaying a limited set of characters."""
@@ -249,7 +269,7 @@ def _put(self, char, index=0):
249
269
if char == '.' :
250
270
self ._set_buffer (index , self ._get_buffer (index ) | 0b10000000 )
251
271
return
252
- elif char in 'abcdef' :
272
+ if char in 'abcdef' :
253
273
character = ord (char ) - 97 + 10
254
274
elif char == '-' :
255
275
character = 16
@@ -268,6 +288,19 @@ def _put(self, char, index=0):
268
288
return
269
289
self ._set_buffer (index , NUMBERS [character ])
270
290
291
+ def set_digit_raw (self , index , bitmask ):
292
+ """Set digit at position to raw bitmask value. Position should be a value
293
+ of 0 to 3 with 0 being the left most digit on the display.
294
+ """
295
+ if not 0 <= index <= 3 :
296
+ return
297
+
298
+ # Set the digit bitmask value at the appropriate position.
299
+ self ._set_buffer (self .POSITIONS [index ], bitmask & 0xFF )
300
+
301
+ if self ._auto_write :
302
+ self .show ()
303
+
271
304
class BigSeg7x4 (Seg7x4 ):
272
305
"""Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
273
306
supports displaying a limited set of characters."""
0 commit comments