RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

periph/adc: add adc_sample_multi()

Open benpicco opened this issue 1 year ago • 5 comments

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

benpicco avatar Apr 25 '24 14:04 benpicco

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

Teufelchen1 avatar May 06 '24 12:05 Teufelchen1

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

benpicco avatar May 08 '24 16:05 benpicco

Murdock results

:heavy_check_mark: PASSED

08698668154b3c52e0bc829415f41379a8e73b85 cpu/sam0_common: make ADC input resistance configurable per channel

Success Failures Total Runtime
10218 0 10218 13m:52s

Artifacts

riot-ci avatar May 15 '24 16:05 riot-ci

@benpicco is this ready for another review?

Teufelchen1 avatar Oct 14 '24 08:10 Teufelchen1