Skip to content

Commit fedc6eb

Browse files
authored
Merge pull request #4 from U47/patch
Add a variable to allow shifting the column address an arbitrary amount
2 parents e3517d0 + 0e4982e commit fedc6eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_st7565.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class ST7565(framebuf.FrameBuffer):
5252
# LCD Page Order
5353
pagemap = (0, 1, 2, 3, 4, 5, 6, 7)
5454

55+
# LCD Start Bytes
56+
start_bytes = 0
57+
5558
CMD_DISPLAY_OFF = const(0xAE)
5659
CMD_DISPLAY_ON = const(0xAF)
5760
CMD_SET_DISP_START_LINE = const(0x40)
@@ -146,9 +149,9 @@ def show(self):
146149
# Set page
147150
self.write_cmd(self.CMD_SET_PAGE | self.pagemap[page])
148151
# Set lower bits of column
149-
self.write_cmd(self.CMD_SET_COLUMN_LOWER | (0 & 0xF))
152+
self.write_cmd(self.CMD_SET_COLUMN_LOWER | (self.start_bytes & 0xF))
150153
# Set upper bits of column
151-
self.write_cmd(self.CMD_SET_COLUMN_UPPER | ((0 >> 4) & 0xF))
154+
self.write_cmd(self.CMD_SET_COLUMN_UPPER | ((self.start_bytes >> 4) & 0xF))
152155

153156
# Page start row
154157
row_start = page << 7

0 commit comments

Comments
 (0)