Skip to content

periph/adc: introduce periph_adc_continuous#20045

Merged
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:periph_adc_continous
Nov 10, 2023
Merged

periph/adc: introduce periph_adc_continuous#20045
benpicco merged 3 commits intoRIOT-OS:masterfrom
benpicco:periph_adc_continous

Conversation

@benpicco
Copy link
Contributor

@benpicco benpicco commented Nov 3, 2023

Contribution description

The current ADC API configure the ADC for each measurement and turn it off afterwards.
This is a problem as the voltage on the ADC may take some time to settle, so what we actually measure is this:

adc

For periodic / frequent measurements the overhead of always turning off and on the ADC is also significant.

Testing procedure

The effect becomes evident with the test application already:

tests/periph/adc

2023-11-03 15:40:25,681 - INFO # ADC_LINE(0): 230
2023-11-03 15:40:25,682 - INFO # ADC_LINE(1): 305
2023-11-03 15:40:25,684 - INFO # ADC_LINE(2): 278
2023-11-03 15:40:25,785 - INFO # ADC_LINE(0): 226
2023-11-03 15:40:25,787 - INFO # ADC_LINE(1): 306
2023-11-03 15:40:25,788 - INFO # ADC_LINE(2): 283
2023-11-03 15:40:25,890 - INFO # ADC_LINE(0): 231
2023-11-03 15:40:25,891 - INFO # ADC_LINE(1): 308
2023-11-03 15:40:25,893 - INFO # ADC_LINE(2): 286
2023-11-03 15:40:25,995 - INFO # ADC_LINE(0): 236
2023-11-03 15:40:25,996 - INFO # ADC_LINE(1): 311
2023-11-03 15:40:25,998 - INFO # ADC_LINE(2): 282
2023-11-03 15:40:26,099 - INFO # ADC_LINE(0): 231
2023-11-03 15:40:26,101 - INFO # ADC_LINE(1): 305
2023-11-03 15:40:26,102 - INFO # ADC_LINE(2): 276
2023-11-03 15:40:26,204 - INFO # ADC_LINE(0): 224

tests/periph/adc_continous

2023-11-03 15:39:18,387 - INFO # ADC_LINE(0): 341
2023-11-03 15:39:18,387 - INFO # ADC_LINE(1): 399
2023-11-03 15:39:18,387 - INFO # ADC_LINE(2): 380
2023-11-03 15:39:18,388 - INFO # ADC_LINE(0): 341
2023-11-03 15:39:18,388 - INFO # ADC_LINE(1): 400
2023-11-03 15:39:18,388 - INFO # ADC_LINE(2): 373
2023-11-03 15:39:18,388 - INFO # ADC_LINE(0): 329
2023-11-03 15:39:18,389 - INFO # ADC_LINE(1): 390
2023-11-03 15:39:18,389 - INFO # ADC_LINE(2): 363
2023-11-03 15:39:18,389 - INFO # ADC_LINE(0): 319
2023-11-03 15:39:18,389 - INFO # ADC_LINE(1): 403
2023-11-03 15:39:18,390 - INFO # ADC_LINE(2): 376
2023-11-03 15:39:18,390 - INFO # ADC_LINE(0): 341
2023-11-03 15:39:18,390 - INFO # ADC_LINE(1): 418
2023-11-03 15:39:18,390 - INFO # ADC_LINE(2): 395

Issues/PRs references

This is meant as a stop-gap solution to fix an existing application until we have #13247

@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: drivers Area: Device drivers Area: cpu Area: CPU/MCU ports labels Nov 3, 2023
@benpicco benpicco force-pushed the periph_adc_continous branch from 51ef1fb to 30bbd17 Compare November 3, 2023 14:41
@benpicco benpicco requested a review from maribu November 3, 2023 14:41
@benpicco benpicco force-pushed the periph_adc_continous branch from 30bbd17 to ebbf012 Compare November 3, 2023 14:48
@benpicco benpicco changed the title periph/adc: introduce periph_adc_continous periph/adc: introduce periph_adc_continuous Nov 3, 2023
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 3, 2023
@dylad
Copy link
Member

dylad commented Nov 3, 2023

Should we consider it as API changes ? (even if there is no changes, just addition)

@maribu maribu added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Nov 3, 2023
@maribu
Copy link
Member

maribu commented Nov 3, 2023

Should we consider it as API changes ? (even if there is no changes, just addition)

I'd say we rather should label this as a new feature, not as an API change. (And I already did so.)

@riot-ci
Copy link

riot-ci commented Nov 3, 2023

Murdock results

✔️ PASSED

d3dfd4b periph/adc_continous: add test for ADC continous API

Success Failures Total Runtime
7956 0 7956 10m:11s

Artifacts

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me, the API makes sense and is well aligned with the current API, and I trust your testing

@benpicco benpicco force-pushed the periph_adc_continous branch from ebbf012 to 92848dd Compare November 6, 2023 18:35
@benpicco benpicco requested a review from jia200x as a code owner November 6, 2023 18:35
@github-actions github-actions bot added the Area: Kconfig Area: Kconfig integration label Nov 6, 2023
@benpicco benpicco enabled auto-merge November 10, 2023 10:19
@benpicco benpicco force-pushed the periph_adc_continous branch from 92848dd to d3dfd4b Compare November 10, 2023 11:11
@benpicco benpicco added this pull request to the merge queue Nov 10, 2023
Merged via the queue into RIOT-OS:master with commit 04617ee Nov 10, 2023
@benpicco benpicco deleted the periph_adc_continous branch November 10, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants