Skip to content

[test/hal] adc oneshot/temperature: wait for async completion#276

Draft
liangyongxiang wants to merge 1 commit into
vsfteam:masterfrom
liangyongxiang:adc-test-async
Draft

[test/hal] adc oneshot/temperature: wait for async completion#276
liangyongxiang wants to merge 1 commit into
vsfteam:masterfrom
liangyongxiang:adc-test-async

Conversation

@liangyongxiang

Copy link
Copy Markdown
Contributor

Draft — not yet tested on hardware.

Summary

vsf_adc_channel_request_once is an asynchronous API: the conversion
result is delivered via the VSF_ADC_IRQ_MASK_CPL ISR callback, not by the
time the call returns.

The adc_oneshot and adc_temperature test suites registered no ISR
(cfg.isr = {NULL, NULL, 0}) and read the sample immediately after the
request — i.e. they used the async API as if it were synchronous.

Change

Mirror the correct pattern already used by vsf_test_adc_stream.c:

  • register a completion ISR that sets a volatile bool flag on VSF_ADC_IRQ_MASK_CPL;
  • clear the flag before the request;
  • VSF_TEST_WAIT_FOR(...) the conversion-complete interrupt before reading the sample.

Also add per-suite ..._PRIO (vsf_arch_prio_1) and ..._TIMEOUT_MS (500)
config defaults (overridable), matching the stream suite's convention.

Files:

  • test/.../adc/suite/vsf_test_adc_oneshot.c / .h
  • test/.../adc/suite/vsf_test_adc_temperature.c / .h

Status / TODO

  • Build
  • Run on target hardware and confirm both suites pass

Kept as a draft until the above verification is done.

vsf_adc_channel_request_once is asynchronous (result delivered via the VSF_ADC_IRQ_MASK_CPL ISR callback). The oneshot and temperature suites registered no ISR and read the sample immediately after the request.

Register a completion ISR and VSF_TEST_WAIT_FOR the conversion-complete interrupt before reading the result, mirroring vsf_test_adc_stream.c. Add per-suite PRIO / TIMEOUT_MS config defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant