8000 Discrepancies between core displayio "send" methods on I2C implementation cause downstream issues with some displays · Issue #137 · adafruit/Adafruit_Blinka_Displayio · GitHub
[go: up one dir, main page]

Skip to content
Discrepancies between core displayio "send" methods on I2C implementation cause downstream issues with some displays #137
@EAGrahamJr

Description

@EAGrahamJr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0