Skip to content

Commit

Permalink
Fix #52 Distinguish stride from width for SSD1680
Browse files Browse the repository at this point in the history
Apply fix from 8022b34 to Adafruit_SSD1680, allowing rotations of 1 and
2 to be used even when width is not a multiple of 8.
  • Loading branch information
cdmuhlb committed Jun 12, 2021
1 parent d44ecf5 commit f0ffe0c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions adafruit_epd/ssd1680.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ def __init__(
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
)

if width % 8 != 0:
width += 8 - width % 8
stride = width
if stride % 8 != 0:
stride += 8 - stride % 8

self._buffer1_size = int(width * height / 8)
self._buffer1_size = int(stride * height / 8)
self._buffer2_size = self._buffer1_size

if sramcs_pin:
Expand All @@ -92,10 +93,18 @@ def __init__(
self._buffer2 = bytearray(self._buffer2_size)

self._framebuf1 = adafruit_framebuf.FrameBuffer(
self._buffer1, width, height, buf_format=adafruit_framebuf.MHMSB
self._buffer1,
width,
height,
stride=stride,
buf_format=adafruit_framebuf.MHMSB,
)
self._framebuf2 = adafruit_framebuf.FrameBuffer(
self._buffer2, width, height, buf_format=adafruit_framebuf.MHMSB
self._buffer2,
width,
height,
stride=stride,
buf_format=adafruit_framebuf.MHMSB,
)
self.set_black_buffer(0, True)
self.set_color_buffer(1, False)
Expand Down

0 comments on commit f0ffe0c

Please sign in to comment.