Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ssd1680z 2.13 eink bonnet #83

Merged
merged 9 commits into from
Oct 30, 2024
Merged

Conversation

mikeysklar
Copy link
Contributor

@mikeysklar mikeysklar commented Oct 27, 2024

The Adafruit 2.13" eink bonnet has been through several revisions. The most recent uses the GDEY0213B74 which uses a SSD1680z chip.

The differences are minor, but created some edge drawing problems. This ssd1680z accounts for the following changes.

I've included some an example grid demo code as this change warrants additional testing and feedback. The display init is only showing complete redraw with the width set to 128 (only 122 pixel). That still needs to be resolved.

+-----------------------------+-------------------------------+-------------------------------+
|        Feature/Command      |       SSD1680 Library         |       SSD1680Z Library        |
+-----------------------------+-------------------------------+-------------------------------+
| Data Entry Mode             | bytearray([0x03])             | bytearray([0x01])             |
+-----------------------------+-------------------------------+-------------------------------+
| Set RAM X Start/End         | bytearray([0x01, width // 8]) | bytearray([0x00, (width // 8)-1])|
+-----------------------------+-------------------------------+-------------------------------+
| Set RAM Y Start/End         | bytearray([0, 0, height - 1,  | bytearray([0x00, 0x00,        |
|                             | (height - 1) >> 8])           | height - 1, (height - 1) >> 8])|
+-----------------------------+-------------------------------+-------------------------------+
| Border Waveform Control     | bytearray([0x05])             | bytearray([0x80])             |
+-----------------------------+-------------------------------+-------------------------------+
| Display Update Control      | bytearray([0xF4])             | bytearray([0xF7])             |
+-----------------------------+-------------------------------+-------------------------------+
| Set RAM X Count             | bytearray([0x01])             | bytearray([0x00])             |
+-----------------------------+-------------------------------+-------------------------------+
| Set RAM Y Count             | bytearray([height - 1, 0])    | bytearray([0x00, 0x00])       |
+-----------------------------+-------------------------------+-------------------------------+
import time
import board
import busio
import digitalio
from adafruit_epd.ssd1680z import Adafruit_SSD1680Z

# Define SPI and pins
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
ecs = digitalio.DigitalInOut(board.CE0)  # Chip select
dc = digitalio.DigitalInOut(board.D22)   # Data/command
rst = digitalio.DigitalInOut(board.D27)  # Reset
busy = digitalio.DigitalInOut(board.D17) # Busy

# Initialize the display with SSD1680Z driver
display = Adafruit_SSD1680Z(
    128, 250, spi, cs_pin=ecs, dc_pin=dc, sramcs_pin=None, rst_pin=rst, busy_pin=busy
)

# Set display to portrait mode
display.rotation = 0

# Clear the display to white
display.fill(1)

def draw_8px_grid():

    # Draw vertical lines for the grid
    for x in range(0, display.width, 8):  # Adjust grid spacing to 8 pixels
        display.line(x, 0, x, display.height - 1, 0)  # Vertical line from top to bottom

    # Draw horizontal lines for the grid
    for y in range(0, display.height, 8):  # Adjust grid spacing to 8 pixels
        display.line(0, y, display.width - 1, y, 0)  # Horizontal line from left to right

    # Update the display
    display.display()

# Draw the grid

@mikeysklar
Copy link
Contributor Author

@ladyada

@ladyada
Copy link
Member

ladyada commented Oct 28, 2024

can you subclass the SSD1680 with only the updates added?

@mikeysklar
Copy link
Contributor Author

mikeysklar commented Oct 28, 2024

A subclass seems reasonable. The changes are minor. It would be different than what was done with the SSD1675 vs SSD1675b, for example, which each have their own.

I only have the newer SSD1680z eink hardware so I thought it might be safer to breakout the library to prevent breaking the original SSD1680.

@ladyada
Copy link
Member

ladyada commented Oct 28, 2024

ok thanks, tag me again when done!

dropped separate ssd1680z lib for a combined 1680 + 1680z.
@mikeysklar
Copy link
Contributor Author

@ladyada - SSD1680z sub-class tested with weather example along with my blank white / black / grid patterns. All pass. Key difference with initialization is:

from adafruit_epd.ssd1680 import Adafruit_SSD1680Z

display = Adafruit_SSD1680Z(

@ladyada
Copy link
Member

ladyada commented Oct 30, 2024

can you undo the deletions from the original code? just add the subclass at the end plz 🙏

@mikeysklar
Copy link
Contributor Author

Sure, that makes more sense. Reverting back to original plus subclass addition at the bottom.

plus 1680Z subclass at bottom
@mikeysklar
Copy link
Contributor Author

@ladyada - All script checks pass (blank, black, grid, weather). The weirdest part is that its 72F today and Manhattan. I had to go verify that on-line.

@ladyada ladyada merged commit b896b61 into adafruit:main Oct 30, 2024
1 check passed
@ladyada
Copy link
Member

ladyada commented Oct 30, 2024

thanks this is fine now!

@joxl
Copy link

joxl commented Dec 2, 2024

It looks like there are several display commands in the old Adafruit_SSD1680.power_up() method that have been omitted in the new one. Specifically, these commands are no longer sent in the new Adafruit_SSD1680Z.power_up() method:

  • _SSD1680_WRITE_VCOM_REG
  • _SSD1680_GATE_VOLTAGE
  • _SSD1680_WRITE_BORDER
  • _SSD1680_SET_RAMXCOUNT
  • _SSD1680_SET_RAMYCOUNT

I'm curious if these commands just aren't needed anymore (on the SSD1680Z chipset), or were they omitted for another reason (perhaps left as an exercise for another time, etc)?

_SSD1680_DRIVER_CONTROL,
bytearray([self._height - 1, (self._height - 1) >> 8, 0x00]),
)
self.command(_SSD1680_DATA_MODE, bytearray([0x03]))
Copy link

@joxl joxl Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding the chart in the PR description (and quoted below) correctly, shouldn't the value for this _SSD1680_DATA_MODE command be 0x01?

Feature/Command SSD1680 Library SSD1680Z Library
Data Entry Mode bytearray([0x03]) bytearray([0x01])
... ... ...

I'm not familiar with these chips (yet), so I'm still trying to figure out where the old vs new values came from. If you could share any pointers regarding where/how you found the new values, it would be much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants