-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add i2c functions #2
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for suggesting this addition! 💪
I am currently unable to actually test these additions on a physical device using cgos and i2c, so I'll just review the changes from a coding style perspective. Feel free to reply or discuss on any of my comments and suggestions.
For keeping track of the conversations and todos, I ask you not to resolve the comments yourself, but rather let the original author of the comment resolve the individual open discussions. This make reviewing a lot easier from the reviewers perspective.
src/board.rs
Outdated
pub fn get_number_of_i2c(&'library self) -> usize { | ||
I2c::amount(self.handle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as below, naming: count
vs number
vs amount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your opinion on this? Can you comment, why you do not intend to make a change here?
Happy to make changes as requested.
|
Co-authored-by: Maximilian Schmidt <[email protected]>
All changes made. |
Thanks for addressing the changes, a few conversations and requested changes are still open and to be applied or discussed. |
Comments addressed. The most recent commit also adds panics in the unlikely event a user passes in buffers whose length cannot be represented by I believe all remaining open comments are those where I currently do not plan to make a change. Please advise if I am expected to press the resolve button in these conversations or how I should initiate further discussion. |
Integrate all of the cgos i2c described in v1.4 of the API reference.
Read and write functions have been tested against an external i2c sensor plugged into DDC bus an SEVAL devboard, with a SA7 SMARC running debian 12 (kernel 6.10.11+bpo-amd64)
Design decisions:
I2c::new
when instantiating an i2c bus object. The alternative would be to mark all i2c-related functions as unsafe.(Thanks for the quick response to yesterday's request!)