Skip to content

Commit 04032f3

Browse files
committed
Update ssd1680.py
1 parent 3ebcc90 commit 04032f3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

adafruit_epd/ssd1680.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def power_up(self) -> None:
153153
# driver output control
154154
self.command(
155155
_SSD1680_DRIVER_CONTROL,
156-
bytearray([self._height - 1, (self._height - 1) >> 8, 0x00]),
156+
bytearray([(self._height - 1) & 0xFF, (self._height - 1) >> 8, 0x00]),
157157
)
158158
# data entry mode
159159
self.command(_SSD1680_DATA_MODE, bytearray([0x03]))
@@ -163,20 +163,23 @@ def power_up(self) -> None:
163163
self.command(_SSD1680_GATE_VOLTAGE, bytearray([0x17]))
164164
self.command(_SSD1680_SOURCE_VOLTAGE, bytearray([0x41, 0x00, 0x32]))
165165

166+
height = self._width
167+
if height % 8 != 0:
168+
height += 8 - (height % 8)
166169
# Set ram X start/end postion
167-
self.command(_SSD1680_SET_RAMXPOS, bytearray([0x01, 0x10]))
170+
self.command(_SSD1680_SET_RAMXPOS, bytearray([0x00, (height // 8) - 1]))
168171
# Set ram Y start/end postion
169172
self.command(
170173
_SSD1680_SET_RAMYPOS,
171-
bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]),
174+
bytearray([0x00, 0x00, (self._height - 1) & 0xFF, (self._height - 1) >> 8]),
172175
)
173176
# Set border waveform
174177
self.command(_SSD1680_WRITE_BORDER, bytearray([0x05]))
175178

176179
# Set ram X count
177-
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([0x01]))
180+
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([0x00]))
178181
# Set ram Y count
179-
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([self._height - 1, 0]))
182+
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([0x00, 0x00]))
180183
self.busy_wait()
181184

182185
def power_down(self) -> None:
@@ -206,9 +209,9 @@ def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
206209
"""Set the RAM address location, not used on this chipset but required by
207210
the superclass"""
208211
# Set RAM X address counter
209-
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([x + 1]))
212+
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([0]))
210213
# Set RAM Y address counter
211-
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([y, y >> 8]))
214+
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([0, 0]))
212215

213216

214217
class Adafruit_SSD1680Z(Adafruit_SSD1680):

0 commit comments

Comments
 (0)