drivers: add a common driver for ADS1X1X#21694
Conversation
crasbe
left a comment
There was a problem hiding this comment.
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. |
|
will do |
AnnsAnns
left a comment
There was a problem hiding this comment.
Looks good to me for the most part, just two very minor nitpicks. Thank you for your work on this! (Note, that I don't have the hardware for this therefore did not test this)
4aa3b85 to
f1f079f
Compare
|
Nice! I think it is reasonable to squash this down into a single commit? |
f1f079f to
d499d9c
Compare
|
Is there a problem with the CI? Murdock seems stuck |
|
Not sure whats up with murdock. Maybe it just timed-out, that sometimes happens when shithub is too slow or whatever. In the meantime, there are two commits that do not belong in this PR. Maybe you need a rebase on the current master? Both superfluous commits are already in the current master. |
Add common driver for ads1x1x family, Kconfig support, documentation and tests. Signed-off-by: Baptiste Le Duc <[email protected]>
d499d9c to
4698cb0
Compare
done :) |
|
Is there a reason why github bot removed the PR from the merge queue ? |
No, |
Okay thanks ! |
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
In a discussion onElement.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?Is it necessary to check the return value ofi2c_read_regsandi2c_write_regsevery time?I am not entirely clear on the difference between the return codesI2C_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