AtomVM icon indicating copy to clipboard operation
AtomVM copied to clipboard

Move atomvm_lib ADC Nif to AtomVM

Open fadushin opened this issue 3 years ago • 7 comments

The atomvm_lib repo contains an integration with the ADC API in the IDF SDK. Since this represents core functionality of the ESP32, this code should be moved into the AtomVM esp32 platform as a component.

fadushin avatar Mar 29 '22 00:03 fadushin

Do you have an estimated plan to implement this? It seems latest atomvm_adc is not compatible with latest AtomVM, I can build AtomVM image successfully but a crash happened when flashing the .avm to esp32. I am now using AtomVM 0.5.0 and old atomvm_adc version (around Mar 2022), I can see that adc is working well.

biennguyen94 avatar Jul 14 '23 06:07 biennguyen94

The atomvm_adc driver should work with esp-idf 4.x versions, but currently will not compile using esp-idf 5.x versions. The APIs completely changed and support for IDF 5.x is taking longer than anticipated, but should be available soon(ish)... ;)

UncleGrumpy avatar Jul 14 '23 14:07 UncleGrumpy

I built AtomVM image including ADC on ubuntu 22.04, Erlang OTP 25, esp-idf 4.4, latest AtomVM, latest atomvm_adc, then I flashed this image to ESP32, then I flashed the application to ESP32 but error happened as below: image

biennguyen94 avatar Jul 15 '23 03:07 biennguyen94

Since we can't merge the atomvm_adc component into AtomVM until it is updated to compile with ESP-IDF 5.x versions, would you mind opening an issue in the atomvm_adc repo so we can help you sort out this problem there? This looks like it should be easy to fix.

UncleGrumpy avatar Jul 15 '23 03:07 UncleGrumpy

thanks @UncleGrumpy, I have created a new issue in the atomvm_adc repo.

biennguyen94 avatar Jul 15 '23 04:07 biennguyen94

So eventually we decided to put adc into the VM? Doesn't it imply adding an additional component dependency?

pguyot avatar Jul 15 '23 04:07 pguyot

No, the only components that the ADC driver uses are included in the esp-idf. They only thing preventing moving atomvm_adc to AtomVM core is that it currently doesn't build with esp-idf 5.x due to complete breakage of the API in version 5 (there is literally nothing in common between 4.x and 5.x - all the way down to different data types). I have already started work on IDF 5 support, so hopefully that won't take too much longer.

UncleGrumpy avatar Jul 15 '23 14:07 UncleGrumpy