-
Notifications
You must be signed in to change notification settings - Fork 83
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
i2c: implement register access #14
Comments
I could get on board with this. I'll add it to the TODO list, hoping to have some time this week/weekend to spend a bit of time catching up with the backlog. |
Jack, From a design perspective, I would envision a new API called:
This API would take an array of transactions and perform them as a unit. The i2c_transaction data type would be a structure composed of:
|
Your example is very similar to the current libsoc_i2c_write function. I think what @yegorich was implying was something more akin to:
which would be an easy way to encapsulate a single read/write over i2c without having to mess about with buffers and lengths. Care to comment @yegorich ? |
@jackmitch that's what I mean. A call, that accepts register number. |
I understand. I didn't like the "consumability" of the option I proposed but it would give full flexibility for scenarios we hadn't anticipated. If we look at wiringPi here ... http://wiringpi.com/reference/i2c-library/ We see the following APIs:
Some I2C bytes when reading or writing a register want:
If we provided only:
Then what about the 8 bit register data read and write? Maybe the right answer would be:
|
I would be happy to consider a pull request which implemented the above functions. |
Allow to pass register address to the read function in order to read one byte from supplied register address. See an example in this blog (http://bunniestudios.com/blog/images/infocast_i2c.c) function get_i2c_register()
The text was updated successfully, but these errors were encountered: