`async` ADC read
- [ ] esp32
- [ ] esp32s2
- [ ] esp32s3
- [x] esp32c2 - #3082
- [x] esp32c3 - https://github.com/esp-rs/esp-hal/pull/2925
- [x] esp32c6 - https://github.com/esp-rs/esp-hal/pull/2925
- [x] esp32h2 - #3082
Based on a quick skimming of the TRM (for the C6, at least) it appears that this should be possible by configuring APB_SARADC_ADC_DONE_INT, which "triggers when the ADC completes one data conversion". As long as we have an interrupt we can create a future for it.
Also thank you for pointing this out, this is very valuable feedback! It's easy to overlook things like this :)
I just stumbled upon this problem. I wanted to have an embassy wifi example returning its battery status and nb::block does not look like it can be used.
I also don't know much about the specific operation of adc. I want to ask, can't we simply use the current read_oneshot to encapsulate a future? I will post an example later.
Update: Failing that, it seems like nb is refactoring their future macros, and then, I can't wrap read_oneshot without using unsafe
I'm wondering if we could have the ADC own all the pins it needs? That might make it easier to do asynchronous stuff, but it might complicate the type declaration.
Re opening as it's only implemented for c3/c6. I've updated the original issue content.
I tried making this work on the S2 and S3 but the interrupt doesn't seem to fire for oneshot reads. I can just implement faking it by waking the task immediately when polling the async future, but it's not terribly polite. We can maybe hijack the continuous mode measurement somehow?
We can maybe hijack the continuous mode measurement somehow?
was looking for ADC continuous mode, saw it's mentioned here, just want to confirm the "ADC continuous mode" is not implemented in esp-hal yet ? As I can't find anything relating to it in the esp-hal repo.
We can maybe hijack the continuous mode measurement somehow?
was looking for ADC continuous mode, saw it's mentioned here, just want to confirm the "ADC continuous mode" is not implemented in esp-hal yet ? As I can't find anything relating to it in the esp-hal repo.
It's not implemented yet.
We can maybe hijack the continuous mode measurement somehow?
was looking for ADC continuous mode, saw it's mentioned here, just want to confirm the "ADC continuous mode" is not implemented in esp-hal yet ? As I can't find anything relating to it in the esp-hal repo.
It's not implemented yet.
in the process of porting firmware from esp-idf to Rust no_std, the original firmware use ADC continuous mode to decode a stream of RFID data. It'll be a blocker if esp-hal does not support it.
Any idea when it'll be worked on, or any pointers/guide/doc on how to properly implement it, as it involve DMA and ADC, not sure if we have any existing model to follow along.