Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADC: Add async support for oneshot reads for esp32c3 and esp32c6 #2925

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davoclavo
Copy link
Contributor

@davoclavo davoclavo commented Jan 9, 2025

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • I have added necessary changes to user code to the Migration Guide.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

Add support for ADC async oneshot reads for esp32c3 and esp32c6. Fixes #1643

Testing

Added QA example that uses embassy executor and reads every second from GPIO5. I am able to measure distinct values just by handling the devkit board with my hands.

Extra notes

  1. It seems the double oneshot read hack for esp32c6 is not required if interrupts are used. If someone is able to help me confirm this or figure out a way to replicate it I can work on adding that hack back.

  2. Could someone help me out figuring out how could I alter my QA example to be able to perform concurrent reads to multiple channels using the same ADC interface, in order to address the potential issue that is currently solved by using the active_channel attribute for the blocking implementation, in order to implement some kind of synchronization mechanism for the async version.

  3. Should I add the Dm: crate::DriverMode generic and only provide the Blocking implementation for the xtensa version of the Adc driver (and the esp32 Driver too) or leave it as is without the extra parameter? Done

@davoclavo davoclavo force-pushed the feat/async_adc_read_oneshot branch 9 times, most recently from 610c8cd to fd3aa03 Compare January 10, 2025 21:02
@davoclavo davoclavo force-pushed the feat/async_adc_read_oneshot branch from fd3aa03 to c07f1db Compare January 10, 2025 21:39
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.

async ADC read
1 participant