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

periph/adc: add adc_sample_multi() #20622

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

Conversation

benpicco
Copy link
Contributor

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

4c00 dat

two lines on different ADCs

4c00 dat

Issues/PRs references

alternative to #20619

@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: drivers Area: Device drivers Area: cpu Area: CPU/MCU ports labels Apr 25, 2024
@benpicco benpicco requested review from kfessel and maribu April 25, 2024 14:04
Comment on lines 136 to 137
* @param[out] bufs target buffer(s)
* @param[in] buf_len number of samples to sample per line
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@Teufelchen1
Copy link
Contributor

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).

@github-actions github-actions bot added the Area: build system Area: Build system label May 8, 2024
@benpicco
Copy link
Contributor Author

benpicco commented May 8, 2024

@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'.

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: tests Area: tests and testing framework Platform: ARM Platform: This PR/issue effects ARM-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants