@@ -215,6 +215,26 @@ def _number(self, number):
215215 self ._text (string [:places ])
216216 self ._auto_write = auto_write
217217
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+
218238class Seg7x4 (Seg14x4 ):
219239 """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
220240 supports displaying a limited set of characters."""
@@ -249,7 +269,7 @@ def _put(self, char, index=0):
249269 if char == '.' :
250270 self ._set_buffer (index , self ._get_buffer (index ) | 0b10000000 )
251271 return
252- elif char in 'abcdef' :
272+ if char in 'abcdef' :
253273 character = ord (char ) - 97 + 10
254274 elif char == '-' :
255275 character = 16
@@ -268,6 +288,19 @@ def _put(self, char, index=0):
268288 return
269289 self ._set_buffer (index , NUMBERS [character ])
270290
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+
271304class BigSeg7x4 (Seg7x4 ):
272305 """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
273306 supports displaying a limited set of characters."""
0 commit comments