aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/display/uc1701.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-20 12:40:30 -0400
committerKevinOConnor <kevin@koconnor.net>2018-09-21 16:39:38 -0400
commitc8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1 (patch)
tree41f94a7c57556d374ee0050dbcb9ab1a104626c4 /klippy/extras/display/uc1701.py
parent2a5778be3a921a59733ee85791d18ae0b8ff4a92 (diff)
downloadkutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.tar.gz
kutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.tar.xz
kutter-c8d9d575a1eaddf536002b3a4330e5e3b4dc9ad1.zip
display: Support writing single character glyphs using write_glyph()
Add write_glyph() support to hd44780.py. Update uc1701.py and st7920.py to support writing single character glyphs via write_glyph(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/display/uc1701.py')
-rw-r--r--klippy/extras/display/uc1701.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/klippy/extras/display/uc1701.py b/klippy/extras/display/uc1701.py
index 5a2239eb..ea4efb94 100644
--- a/klippy/extras/display/uc1701.py
+++ b/klippy/extras/display/uc1701.py
@@ -9,6 +9,8 @@ import icons, font8x14
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
+TextGlyphs = { 'right_arrow': '\x1a' }
+
class UC1701:
char_right_arrow = '\x1a'
CURRENT_BUF, OLD_BUF = 0, 1
@@ -153,6 +155,13 @@ class UC1701:
# Draw icon in graphics mode
for i, bits in enumerate(icon):
self.write_graphics(x, y, i, [(bits >> 8) & 0xff, bits & 0xff])
+ return 2
+ char = TextGlyphs.get(glyph_name)
+ if char is not None:
+ # Draw character
+ self.write_text(x, y, char)
+ return 1
+ return 0
def clear(self):
zeros = bytearray(128)
for page in self.vram[self.CURRENT_BUF]: