Skip to content
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 configuration register #3

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

tdittr
Copy link

@tdittr tdittr commented Dec 2, 2022

Hi,

I needed the ability to configure my INA219 so I figured I might as well add it to this crate. I was also planning to add more types for the Address-Pins, more explicit units for the different measurements and some more doc comments. Should I add that to this PR?

Thanks for starting this crate and I would be happy if you can take a look at my code. I still need to test the changes with my INA219 and will then un-draft this PR.

This removes byteorder as it is no longer needed (now provided by std).
Also no longer needed is extern crate.

This makes it easier to add the changes for the configuration register.
This allows users to change the way the INA219 operates.
This makes the coding style consistent.
@scttnlsn
Copy link
Owner

scttnlsn commented Dec 3, 2022

This looks great - thanks @tdittr. Please feel free to add more types, comments, etc. like you mentioned to this PR.

tdittr and others added 25 commits December 5, 2022 14:50
Not sure yet about the calibration calculations...
Also add reading of registers to driver
This avoids looking up the pin mappings in the datasheet every time.
Added documentation, TryFrom and nicer error
This should allow zero-cost usage of the uncalibrated device.
This makes it so that only the errors that happen in a function can also
be returned and handled.
This makes the docs a bit more structured.
This should give us more confidence about future changes to not break
anything.
This should make it easy to later update to the full eh1
This introduces a feature to make all the paranoid checks optional at
 compile time. So users who do not care can just not have the overhead.
This allows users to retry initialization, because we are now not just
dropping the I2C device we were passed.
@tdittr tdittr marked this pull request as ready for review February 6, 2024 16:48
@tdittr
Copy link
Author

tdittr commented Feb 6, 2024

Uhm, this took a bit longer then expected 😁 but I finally finished this driver. I tested the examples with a Raspberry Pi and a real INA219, so I am pretty confident that it should work :)

Happy about any feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants