Skip to content

I2C writeto_then_readfrom in a single transaction on u2if - #888

Merged
makermelissa merged 8 commits into
adafruit:mainfrom
ryanmesh-sd:main
Apr 15, 2026
Merged

I2C writeto_then_readfrom in a single transaction on u2if#888
makermelissa merged 8 commits into
adafruit:mainfrom
ryanmesh-sd:main

Conversation

@ryanmesh-sd

Copy link
Copy Markdown
Contributor

Implemented WRITE_THEN_READ on I2C interface in U2IF (associated PR: adafruit/u2if#12)

This allows reading from specific registers in I2C devices without sending two separate commands from the host, which significantly increases latency between the pointer write and read and causes timeouts in certain I2C devices (like the ones I've been using).

Previous commit failed CI due to changes made by formatter.
@ryanmesh-sd

Copy link
Copy Markdown
Contributor Author

Looks to now pass tests on my branch CI. Would it be better to do this with a fallback to the old (two separate HID reports) method to accommodate U2IF devices using older firmware?

@FoamyGuy

Copy link
Copy Markdown
Contributor

Looks to now pass tests on my branch CI. Would it be better to do this with a fallback to the old (two separate HID reports) method to accommodate U2IF devices using older firmware?

Yes, I think it would be best for this to have fallback for devices with the older firmware.

Thanks for working on this!

@ryanmesh-sd

Copy link
Copy Markdown
Contributor Author

Hi @FoamyGuy, I've added the fallback. Let me know what you think!

@makermelissa
makermelissa requested a review from caternuson May 5, 2025 23:38
- Fix end_w/end_r falsy check: use 'is not None' to handle end=0 correctly
- Differentiate error message for write_then_read vs regular write
- Remove commented-out debug print statements
@makermelissa
makermelissa merged commit 9765f0a into adafruit:main Apr 15, 2026
1 check passed
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.

4 participants