-
Notifications
You must be signed in to change notification settings - Fork 185
How to use i2c as slave without directly control the registries #163
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
Comments
No, because no one has done it yet. Notably, it lacks an I2C slave embedded trait in embedded hal. Contribution welcome! |
If there isn't any problem with it I'm glad to implement it |
Feel free to propose a first POC and ask for feedbacks. You can also chat with a lot of rust embedded developers on matrix https://github.com/rust-embedded/wg#contact |
I ask to confirm my doubt. |
I'm not sure to understand. Doesn't the slave interface by definition different because of responding to requests? |
Yes, however, there are two versions of the master, one blocker and one no. However, I noticed that only the blocking version is public (thanks to the embedded_hal traits). I was wondering if this was a lack of the current implementation or had a reason to reflect it in the slave implementation. In general, I am thinking of managing the slave in a similar way to how the Arduino Wire library does, or through the assignment of two closures, one for sending data and one for receiving data. |
I think you're talking across one another. Indeed there's no I2C slave traits to be implemented and there's also no custom I2C slave implementation implemented in this crate. It would be great to have both. |
Both versions are public, but only blocking i2c uses embedded hal traits, since there is no hal traits for non-blocking i2c. The same is true for slave i2c, so if you do implement it right now, users have to depend on stm32f1xx_hal directly. The alternative is to add a slave trait to embedded_hal, and then implement it here. That would obviously be more work but is a nicer implementation. |
Wondering if there was any progress for an I2C slave feature in this crate? Would a PR be welcome for implementing this as a device specific (ignoring the embedded-hal traits) feature for now? |
Sure. |
https://github.com/surban/openemc/blob/master/openemc-firmware/src/i2c_slave.rs and maybe https://github.com/surban/openemc/blob/master/openemc-firmware/src/i2c_reg_slave.rs Let me know if this is useful. If so, I will open a PR. |
That's quite helpful, thank you |
Is there an official method from this crate to use i2c without directly manipulate the bit of the i2c registries?
And if not, why?
The text was updated successfully, but these errors were encountered: