-
Notifications
You must be signed in to change notification settings - Fork 55
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
Additional ioctl #42
Comments
I'm definitely interested in I2C_RDWR, but to make it space/computationally efficient is going to be difficult... |
My current plan for the API is a factory method pattern. Here's how an external user would interact with it: const ADDRESS1 = 0x52;
const ADDERSS2 = 0x62;
const MESSAGE: &'static [u8] = &[0x01, 0x32, 0x04];
let data1 = [0u8; 1];
let data2 = [0u8; 12]
let builder = I2C_Messages::new(ADDRESS1);
let mut items = [
builder::write(&MESSAGE),
builder::read(&data),
builder::custom(&data, ADDERSS2, I2C_M_IGNORE_NAK),
];
let i2cdev = LinuxI2CDevice::new(device, ADDERSS1).unwrap();
i2cdev.transfer(&items); I spent some time reading over the source code and have a few thoughts that stand out:
Specifically for points 3, 4, and 5 I wonder if a new crate should be created. I don't like fragmentation as it divides contributors but I can't see a case where you would need both methods at the same time. I'm honestly good with either option, but am leaning towards a separate crate. |
Proposed working solution without abstraction, good error handling, or using i2cdev yet is in this snapshot. |
I have a pretty complete implementation and a working example here. |
Ooo! I have one sitting somewhat unfinished here that I wanted to polish up: I like that you went with a different trait for this. It didn’t feel right to bolt it into the existing one, but I wanted to finish it up before getting advice. |
I went with a different trait because the I2C_RDWR isn't associated with a particular I2C slave device (which is what LinuxI2CDevice represents), but rather operates at the bus level instead. I also went with Vectors for the messages and the data buffers so that they could be dynamically sized by the application at runtime, rather than using rust's compile time sized arrays. |
We encountered a problem with the current implementation of |
That PR looks good to me!
Regards,
Edwin
… On Nov 7, 2019, at 2:42 PM, Diego Barrios Romero ***@***.***> wrote:
We encountered a problem with the current implementation of WriteRead in linux-embedded-hal as the write and read are independent and this is refused by the VEML6030 device. (See: rust-embedded/linux-embedded-hal#25 for more info)
I had a look at @RandomInsano's and @piersfinlayson's and formulated a new proposal in #50
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Closing, thank you @eldruin and @RandomInsano for pushing this along, sorry for the delays along the way. |
Has anyone implemented any additional ioctl() calls? Particularly I2C_RDWR? If not I will give it a try.
The text was updated successfully, but these errors were encountered: