[riot-notifications] [RIOT-OS/RIOT] drivers/adc_ng: Added common ADC API (#13247)
notifications at github.com
Mon Jan 25 11:02:27 CET 2021
Thanks for the input. This PR is currently stalling as I want to change the `adc_burst()` API to use a ring buffer instead. I think this is more convenient and better to use, if one needs a continuous stream of ADC samples - as the delay between two adjacent samples would be lower if the are part of the same "burst" or part of two subsequent "bursts".
I opened a PR for my still WIP ring buffer PR: https://github.com/RIOT-OS/RIOT/pull/15853 - this way it will be easier to monitor progress on this PR.
I like the idea of being able to control the sample rate of the ADC. However, I think this is not as easy to provide: For the continuous sample mode (which will replace the "burst" sampling mode), I have three different implementations in mind:
1. Using DMA (if that is supported by an MCU)
2. Using ADC IRQs (e.g. ATmega), if that is supported but no DMA. The idea is that the ADC is sampling continuously and triggers and IRQ whenever a sample is ready, and the ISR pushes this into the ring buffer. That should behave similar to the DMA, but with less CPU time available for threads. For same platforms, it might also be possible to abuse `periph_timer_periodic` to start an ADC conversion and fetch the result. This will double the load (two IRQs per sample), but should be relatively predictive in delay between two samples.
3. Using a `sys/event` thread to do this fully in software. That would be the fallback solution, if neither DMA or IRQs can be used for sampling.
I believe most convenient and flexible would be some API where one can request a sample rate, and the API will return the actually chosen sample rate that ideally matches the requested rate (or is at least close to it).
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications