Join GitHub today
Introduce reworked API for ADC drivers #7691
This replaces #6176 and introduces a new API for ADC drivers basing on the feedback gathered there.
Marked as DNM, since existing ADC drivers (and "grove" sensors) need to be updated for this one to be merged.
List of drivers to be converted
referenced this pull request
May 21, 2018
@@ Coverage Diff @@ ## master #7691 +/- ## ======================================= Coverage 52.12% 52.12% ======================================= Files 212 212 Lines 25939 25939 Branches 5590 5590 ======================================= Hits 13521 13521 Misses 10177 10177 Partials 2241 2241
2 times, most recently
Jun 4, 2018
I am aware that I am very late to the review, unfortunately I was not able to devote much time to the Zephyr project in last months.
The new ADC API is definitely the step in the right direction, however its design has some problems. The main one is the lack of support for triggers. ADC hardware comes in an overwhelming variety of design variants often with a distinctively different architectures. It makes it difficult to design universal API, there are however some fairly common features. One of such features is the concept of a trigger. Once the ADC module is configured - using the nomenclature of this API - the sequence is defined, the measurement can be started by a trigger whereas trigger is typically:
of those the new API supports software trigger and makes an attempt to support timer trigger. The pin trigger and subsystem trigger is missing. The subsystem trigger is popular on many low power MCUs where it is possible to start ADC measurement on some internal, predefined condition without waking up the CPU.
Unfortunately this API can not be easily extended. The next time a project needs to trigger ADC measurement on the pin level change the ADC API would need to be completely reworked.
In Linux the ADC driver is handled by Industrial I/O driver (IIO) subsystem. Its API is build around the concept of triggers.