rust-embedded / rust-i2cdev

Rust library for interfacing with i2c devices under Linux
Apache License 2.0
207 stars 54 forks source link

Transactional read/write via I2C_RDWR ioctl - take 2 #51

Closed eldruin closed 5 years ago

eldruin commented 5 years ago

This alternative is based on #50 but goes further and implements the I2CTransfer trait for I2CDevices. With this proposal, it is possible to use the bus directly and send messages as well as send messages to a existing I2CDevice. The most relevant change compared to #50 is in the I2CMessage trait, where the address has been separated into a separate method similar to with_flags() so that the same trait can be used for transfers with an I2CDevice without having to specify the address repeatedly as this is fixed for a given I2CDevice.

rust-highfive commented 5 years ago

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @posborne (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

eldruin commented 5 years ago

@andy-sdc confirmed that using this in the implementation of i2c::WriteRead in linux-embedded-hal solved the original issue (https://github.com/rust-embedded/linux-embedded-hal/issues/25) and the hardware device works as expected with the driver.

eldruin commented 5 years ago

Hi @posborne, did you have any chance to look at this?

posborne commented 5 years ago

Hi @posborne, did you have any chance to look at this?

Sorry, will try to take a look later today, but bug me again if I haven't submitted a review by tomorrow.

eldruin commented 5 years ago

Hi @posborne, here is the reminder :)

eldruin commented 5 years ago

Great, I just fixed them.

posborne commented 5 years ago

bors r+

posborne commented 5 years ago

Ah, haven't set bors up on this one yet. Merging, thanks for the changes!