Skip to content

Commit 47837b6

Browse files
authored
Merge pull request #84 from mikeysklar/1680z-alignment
off by one adjustments
2 parents b896b61 + 6d0086e commit 47837b6

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

adafruit_epd/ssd1680.py

+28-3
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,44 @@ def power_up(self):
244244

245245
self.command(
246246
_SSD1680_DRIVER_CONTROL,
247-
bytearray([self._height - 1, (self._height - 1) >> 8, 0x00]),
247+
bytearray([self._height, (self._height) >> 8, 0x00]),
248248
)
249249
self.command(_SSD1680_DATA_MODE, bytearray([0x03]))
250-
self.command(_SSD1680_SET_RAMXPOS, bytearray([0x00, (self._width // 8) - 1]))
250+
251+
# Set voltages
252+
self.command(_SSD1680_WRITE_VCOM_REG, bytearray([0x36]))
253+
self.command(_SSD1680_GATE_VOLTAGE, bytearray([0x17]))
254+
self.command(_SSD1680_SOURCE_VOLTAGE, bytearray([0x41, 0x00, 0x32]))
255+
256+
self.command(_SSD1680_SET_RAMXPOS, bytearray([0x00, (self._width // 8)]))
251257
self.command(
252258
_SSD1680_SET_RAMYPOS,
253-
bytearray([0x00, 0x00, self._height - 1, (self._height - 1) >> 8]),
259+
bytearray([0x00, 0x00, self._height, (self._height) >> 8]),
254260
)
255261

262+
# Set border waveform
263+
self.command(_SSD1680_WRITE_BORDER, bytearray([0x05]))
264+
265+
# Set ram X count
266+
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([0x01]))
267+
# Set ram Y count
268+
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([self._height, 0]))
269+
self.busy_wait()
270+
256271
def update(self):
257272
"""Update the display specifically for SSD1680Z."""
258273
self.command(_SSD1680_DISP_CTRL2, bytearray([0xF7])) # Full update for SSD1680Z
259274
self.command(_SSD1680_MASTER_ACTIVATE)
260275
self.busy_wait()
261276
if not self.busy_pin:
262277
time.sleep(3) # Wait for update to complete
278+
279+
def set_ram_address(
280+
self, x: int, y: int
281+
) -> None: # pylint: disable=unused-argument, no-self-use
282+
"""Set the RAM address location, not used on this chipset but required by
283+
the superclass"""
284+
# Set RAM X address counter
285+
self.command(_SSD1680_SET_RAMXCOUNT, bytearray([x]))
286+
# Set RAM Y address counter
287+
self.command(_SSD1680_SET_RAMYCOUNT, bytearray([y, y >> 8]))

0 commit comments

Comments
 (0)