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

Discrepancies between core displayio "send" methods on I2C implementation cause downstream issues with some displays #137

Open
EAGrahamJr opened this issue Aug 2, 2024 · 0 comments

Comments

@EAGrahamJr
Copy link

As referenced in the following:

there is an issue when using a single-byte command for sleep/wake. For this particular library, the error occurs when attempting to construct the "send" buffer vs the 4-Wire implementations, and apparently as well in the "core" CircuitPython images for micro-controllers.

Example from the SSD1306 driver (as mentioned above):

  • (0xAE, b"")
  • (0xAE, [])

Previous version (2.0.1) used the first form, but that did not work on Blinka, which I was using at the time. Version 2.0.2 incorporated my change, the second form.

The following code exemplifies the issue:

from circuitpython_typing import ReadableBuffer

def pretty_print(prefix, data):
    hex_code = "".join(["%02X " % x for x in data])
    print(f"{prefix} {hex_code}\n")

def i2c_usage(command: int, data: ReadableBuffer):
    sent_this = bytes([command] + data)
    pretty_print("i2c", sent_this)

def four_wire(command: int, data: ReadableBuffer):
    b = bytes([command])
    pretty_print("4-cmd", b)
    pretty_print("4-buffer", data)

# SSD1036 "sleep"
# 2.0.2
print("My change-----------------")
four_wire(0xAE, [])
i2c_usage(0xAE, [])

# 2.0.1
print("Old usage-----------------")
four_wire(0xAE,b"")
i2c_usage(0xAE,b"")

I do not have all the available interface devices needed to test "all the changes", but my opinion is that the least disruptive would be to update this library's I2C implementation to be more forgiving and "revert" the SSD1306 change in a new 2.0.3 version.

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 a pull request may close this issue.

1 participant