-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
I2C does not follow the embedded_hal::i2c::I2c::transaction
contract
#171
Comments
Related: rust-embedded/linux-embedded-hal#82 |
Thank you for opening this issue. If anyone is willing to implement and test this I'm happy to merge in a PR, as I won't be able to work on this myself anytime soon due to other priorities. |
Hey @golemparts, I'm happy to give it a shot. However I had a look at the code and I'm unsure how to fix it.
The only idea I have is to merge consecutive READ or WRITE with temporary buffers of summed sizes and then sending them. What do you think ? |
Well I've had a look at the linux documentation
So we cannot comply with the |
Thanks for your offer to work on this @GChalony!
I prefer not to add any dependencies for core functionality, especially something this small. As rust-i2cdev uses the same underlying ioctl interface as RPPAL does, you should be able to implement the same solution using START → Address + Write Bit → Outgoing Bytes → Repeated START → Address + Read Bit → Incoming Bytes → STOP It's been a while since I last worked on that section of the code though. After skimming through I came across this note: // NOTE: REQ_RDWR - Only a single read operation is supported as the final message (see i2c-bcm2835.c) Granted, that note is over 7 years old, so things might have changed, but at least on older Pi devices the required functionality needed to implement a transaction with any number of reads or writes in any order isn't fully supported, and will return an error if there is more than a single read message, and the read isn't the final operation. See i2c-bcm2835.c. |
Hi everyone. Could you have a look at bundling same operations in your I2C implementation?
This is required for the pn532 crate to work correctly, see WMT-GmbH/pn532#27
Two consecutive reads should be bundled together.
Two consecutive writes should be bundled together.
Quote from the docs (emphasis mine):
Transaction contract:
The text was updated successfully, but these errors were encountered: