-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SAUL: Add periph/adc support #4863
Conversation
nice one. The problem with the physical values/scaling of RAW values could maybe be solved by adding some kind of |
What about leaving the value space processing to userland program? It should anyway be made with the knowledge of what hardware there is, what's the word width and how the adc values are preprocessed in analog domain. I would not try to abstract that into some hidden thing that magically does what you want, except when you want something other than black paint for your model T. Likewise, triggered point conversions in time are just that and a continuous conversion stream is that. Both need their respective post-processing and its needs depend quite a lot on what analog preprocessing was done before ad conversion. With respect to this, I would SAUL just the actual handling of converter control and would leave the values as is. |
Anyway, nice to see ADC coming under SAUL control and also nice to see my favourite SoC family STM32 is also getting support pretty early on, thanks a lot Hauke :) |
@temmihoo What I would like to do in a follow up however, is to add the possibility for analog sensors to give physical measurements like we have for digital sensors today. It will still be possible to configure the SAUL driver to pass the ADC values straight through with no conversion performed at all. A real world use case: The easiest way to design the control algorithm is to only use one unit for all temperatures (to avoid conversion mistakes when comparing different measurements). I want this algorithm to be future proof in the sense that I may want to replace the temperature sensors with different ones depending on availability, price, performance etc. (indoor and outdoor sensors may not even be the same kind of hardware). If I can get all my temperatures from SAUL and I know that all of them are in Celsius, then I only need to worry about implementing the actual control algorithm in my application, and I can transparently replace sensors without having to rewrite my control application. Using SAUL it will not even matter if the sensor is digital or analog, i2c or SPI, from Analog Devices or Maxim, as long as it can provide the temperature to the SAUL layer. |
@gebart |
looking into #4430 now :-) |
Needs rebase |
399ab9e
to
23c1a72
Compare
dependencies are merged, care to rebase?! |
rebased, sorted the pseudomodules list. |
return 1; | ||
} | ||
|
||
static int write_stub(void *dev, phydat_t *state) |
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.
you could remove this function and use saul_notsup()
from drivers/saul/saul.c
instead.
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.
cool, I did not know that, thanks!
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.
was just recently merged :-)
needs rebase. Otherwise ACK for the changes once the little remark above is addressed. Can we make it into the release with this one? |
499058a
to
d478e53
Compare
rebased, replaced the write stub by saul_notsup |
go Murdock, go :-) |
seems like some boards need to define |
Rebased, updated to build properly on boards with no ADC configuration, re-added a file that accidentally went missing during the last rebase. |
Can we get this in the release? |
Ask the release manager. ;) |
yes, please squash and and let's include it |
rebased, squashed, let's wait for Murdock |
oh man, things are moving fast currently. Would you be so good and rebase once more? Thanks. |
@haukepetersen rebased |
nice, Murdock is happy -> go |
(depends on #4430, #4860, #5110)This PR adds support for reading ADC lines through SAUL. Currently only raw ADC reading is supported, so no physical units yet. Only mulle is configured.
In a follow-up I intend to add scaling functions to convert raw values to physical values for analog sensors and support for multiple values. The extended use case for my application is to add an analog temperature sensor and an analog 2-axis accelerometer, and still having the application itself completely hardware independent.