-
Notifications
You must be signed in to change notification settings - Fork 7.6k
async analogRead #220
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
Comments
Using Async here is really wrong :) this is not async at all. Interrupts are :) |
yeah i agree, its just something i was able to quickly hack together, and it seems its working (instead of waiting for adc finished flag in a loop i just am able to do other things now), but this should be solved with interrupts .... but i don't know enough to do it in the correct way :) i would appreciate it if you can provide a better way to do it (also timer with interrupt would be nice) |
ADC non-blocking api has been implemented :) void setup(){
Serial.begin(115200);
adcAttachPin(35);
adcAttachPin(25);
}
void loop(){
//start 1 pin for each ADC bus
adcStart(35);
adcStart(25);
//you can check adcBusy(pin), but adcEnd will wait anyway
uint16_t a0 = adcEnd(35);
uint16_t a1 = adcEnd(25);
Serial.printf("ADC: %u, %u\n", a0, a1);
} |
Does ESP32 have capabilities to do continuous ADC sampling via DMA? I want to do audio recording and not sure if it's possible. |
me neither at this point, but could be researched ;) At quick glance, I can not see register definitions for controlling interrupt, I do not see anything like it implemented in idf, but I could be wrong. |
This was removed for some reason, should this issue be oppened again? Removed in d8b2098 |
Hello! Why this function was removed? ILYA. |
Hi |
Not sure if, or for how long, this would work for you (it's ESP32-S3 specific) - but I needed asynchronous/non-blocking ADC conversions today (running 1.0.5), and i needed them to be a lot faster than using the regular API: https://github.com/stg/ESP32-S3-FastAnalogRead Here's hoping it might be useful to others landing here. |
* Add Matter component as part of the libs * feat(matter): adds necessary setup * feat(matter): sdkconfig for each SoC * fix(matter): no wifi within C2 * fix(matter): replaces wrong pieces * fix(matter): forgot folder reference * feat(matter): strip matter lib.a * fix(matter): missing double quote * fix(matter): bad folder name * feat(matter): testing freertos backward compatibility * feat(matter): testing not using minimal mdns * feat(matter): disable lwip ipv6 autoconfig * feat(matter): common settings * feat(matter): revert changes * feat(matter): revert changes * feat(matter): revert changes * feat(matter): revert changes * feat(matter): no WiFi matter for H2 - thread only * feat(matter): revert changes * feat(matter): revert changes * feat(matter): no support for H2 - no WiFi * feat(matter): clean up * feat(matter): script clean up --------- Co-authored-by: SuGliger <[email protected]> Co-authored-by: Rodrigo Garcia <[email protected]>
if i understand correctly we can only do a sync analog read at the moment ?
this has a problem of being super slow and wasting many cpu cycles ...
i tried to split analogRead into 3 functions .... analogReadAsync, analogReadAsyncReady and analogReadAsyncGet :
and then use it like:
however this is far from perfect and could be implemented better i guess.
also is there an Interrupt i could set to be fired when adc reading is done ? or something like free running mode on atmega chips ? can i somehow change clock freq to make it faster (and less precise i guess) ?
The text was updated successfully, but these errors were encountered: