Open eisterman opened 4 years ago
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. Is the non-blocking master i2c interface currently lacking any method to be used, unlike its blocking counterpart, correct?
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. In this area, many recommendations are accepted!
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.
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.
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?
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.
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?