@@ -280,6 +280,18 @@ def write8(self, value, char_mode=False):
280
280
self ._d7 : ((value >> 3 ) & 1 ) > 0 })
281
281
self ._pulse_enable ()
282
282
283
+ def create_char (self , location , pattern ):
284
+ """Fill one of the first 8 CGRAM locations with custom characters.
285
+ The location parameter should be between 0 and 7 and pattern should
286
+ provide an array of 8 bytes containing the pattern. E.g. you can easyly
287
+ design your custom character at http://www.quinapalus.com/hd44780udg.html
288
+ To show your custom character use eg. lcd.message('\x01 ')
289
+ """
290
+ # only position 0..7 are allowed
291
+ location &= 0x7
292
+ self .write8 (LCD_SETCGRAMADDR | (location << 3 ))
293
+ for i in range (8 ):
294
+ self .write8 (pattern [i ], char_mode = True )
283
295
284
296
def _delay_microseconds (self , microseconds ):
285
297
# Busy wait in loop because delays are generally very short (few microseconds).
@@ -404,20 +416,6 @@ def set_backlight(self, backlight):
404
416
"""
405
417
self .set_color (backlight , backlight , backlight )
406
418
407
- def create_char (self , location , pattern ):
408
- """Fill one of the first 8 CGRAM locations with custom characters.
409
- The location parameter should be between 0 and 7 and pattern should
410
- provide an array of 8 bytes containing the pattern. E.g. you can easyly
411
- design your custom character at http://www.quinapalus.com/hd44780udg.html
412
- To show your custom character use eg. lcd.message('\x01 ')
413
- """
414
- # only position 0..7 are allowed
415
- location &= 0x7
416
- self .write8 (LCD_SETCGRAMADDR | (location << 3 ))
417
- for i in range (8 ):
418
- self .write8 (pattern [i ], char_mode = True )
419
-
420
-
421
419
422
420
423
421
class Adafruit_CharLCDPlate (Adafruit_RGBCharLCD ):
0 commit comments