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
periph/adc: add adc_sample_multi() #20622
base: master
Are you sure you want to change the base?
periph/adc: add adc_sample_multi() #20622
Conversation
drivers/include/periph/adc.h
Outdated
* @param[out] bufs target buffer(s) | ||
* @param[in] buf_len number of samples to sample per line |
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.
I think this needs to be reworded. I do not understand how many buffers I need and how to specify their size.
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.
I re-shuffled the arguments to make the compiler able to check the array sizes, I hope this also makes this easier to understand.
Have you tried to implement it for another board as well? Just to see if the proposed API is not over-fitted for the SAM (unlikely). |
@maribu suggested to make the memory layout of the samples implementation defined and provide an accessor function for individual elements. I'm not a huge fan, since this hurts the ergonomics of the result, but if this turns out to be necessary to reach full performance on some platforms I'm willing to do it - but I'd like to avoid uglifying the API 'just in case'. |
Contribution description
This adds an API to sample multiple ADC samples into a into a buffer.
Multiple ADC lines can be sampled in a round-robin fashion or in parallel if the hardware supports it.
Testing procedure
No integration in the test app yet, but I can produce some nice graphs of the sample data with Gnuplot:
two lines on a single ADC
two lines on different ADCs
Issues/PRs references
alternative to #20619