-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers: add a common driver for ADS1X1X #21694
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
base: master
Are you sure you want to change the base?
Conversation
crasbe
left a comment
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.
Please also note the static errors about whitespaces.
ce1acd9 to
3c14d95
Compare
c342f4f to
5e3525b
Compare
|
I don't see mention of the author's of the existing driver with the rename. Does this new driver really start from scratch with no influences from the existing one? |
Doing a |
In this case, how should I handle defines that are common to both Also, if I rename these defines to be specific, then functions in ads1x1x.c would need to know exactly which module they are handling, probably requiring #if macros… Finally, I’m not entirely clear on how the user is expected to select which ADS version they want to use. It would be really helpful if you could provide a small example to illustrate the intended usage, if possible. |
I think that would be logical.
As far as I can tell, the only code in the entire driver that needs to know which hardware flavor it is operating on is the
Referring to my above statement, again, I don't see the driver containing any device specific code, aside from the one conversion function. |
|
One architectural issue that I have with this PR, is that it renames the existing driver. The existing driver claims to support both flavors of the hardware, I see no reason to rename it. I prefer the new name you have chosen over the old one, but not enough to justify breaking compatibility with existing users of the driver. The rename also complicates version control, and PR review. |
The The problem with that, is the saul's |
5fdfff6 to
b6ab944
Compare
1f96022 to
58ffa37
Compare
|
@Enoch247 how can we move this further? |
I'm not likely to have time to provide a full review, nor was it ever my intent. I've only looked at the PR from a very high level view of the API and tired to provide feedback on that part only. |
|
@Teufelchen1 Hi ! It has been several month since this PR was opened. Should I do anything to make the review more simple ? |
|
From my POV only this comment is still left open: #21694 (comment) |
58ffa37 to
f938cee
Compare
I've just closed the comment after fixing what you recommended. Everything should be ok now |
|
Cool! I think it is time to squash the commits down a bit. I am honestly a bit confused whether or not the renaming PR (#21731) is still needed / still has to be merged beforehand? Maybe my brain melted a bit from all the ads1x1x01x1x0x1 mangling... 🫠 I expected the commits of the other PR to show up here, as it is build on top of it, isn't it? |
f938cee to
e1021bc
Compare
Yes you're totally right, unfortunately I've just realized that I didn't have the commits of the other PR and instead of that I had another commit that removed the folder Before that I'm going to squash my commits to clean up and to make conflicts resolution easier. |
e1021bc to
f6d82d3
Compare
f6d82d3 to
1911270
Compare
|
@Teufelchen1 I squashed my commits and rebased my work on the #21731 branch so you can see the driver renaming commit in the commit history. I also added a Kconfig support that needs to be review as it's my first time using Kconfig. |
Contribution description
While attempting to create a driver for my ADS1115 (this PR), I realized that a driver already exists here. However, the existing driver does not fully support the ADS111x family (datasheet here), which differs from the ADS101x series (datasheet here in several aspects such as bit resolution and maximum sample rate (see page 3 of the datasheet).
I have therefore implemented a common driver for the ADS1x1x family, better documented and inspired by the existing ADS101x driver. This unified driver supports both ADS101x and ADS111x variants, handling their differences internally.
Testing procedure
I adapted the existing test
tests/drivers/ads101xto create `tests/drivers/ads111x and compared the outputs to ensure identical behavior and no regressions.It may be worth adding a helper function to verify the configuration register after each write, to ensure it contains the expected value.
Open questions
Element.io, @Enoch247 pointed out that my current family-selection system is exclusive, which prevents supporting a case where both an ADS101x and an ADS111x driver are used in the same application. How should this be handled?i2c_read_regsandi2c_write_regsevery time?I2C_NODEVandI2C_NOI2C, so I am not sure I have used them correctly throughout the driver.Issues/PRs references
Follow-up from PR
See the original issue : #21612
Depends on PR to rename ads101x driver to ads1x1x: #21731