starting on some adc stuff and grabbed the example ( esp-idf/examples/peripherals/adc/main/adc1_example_main.c)
compiler errors out on this line: adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
with the following error:
error: invalid conversion from 'void*' to 'esp_adc_cal_characteristics_t*'
ERROR running ADC Example: invalid conversion from 'void*'
Re: ERROR running ADC Example: invalid conversion from 'void*'
It looks like the line which reads:
should likely be:
edit your copy of the sample and see if that makes progress.
Code: Select all
adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
Code: Select all
adc_chars = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: ERROR running ADC Example: invalid conversion from 'void*'
thanks Neil, that solved it
Re: ERROR running ADC Example: invalid conversion from 'void*'
Hi rwel59,
Did you copy the code from a .c file into a .cpp file? C (by default) allows implicit casting from void * to another pointer type, but C++ does not allow this without an explicit cast like the one kolban suggested.
Angus
Did you copy the code from a .c file into a .cpp file? C (by default) allows implicit casting from void * to another pointer type, but C++ does not allow this without an explicit cast like the one kolban suggested.
Angus
Re: ERROR running ADC Example: invalid conversion from 'void*'
Angus,
that is exactly what I did. just started looking at using the ADC's and copied the code from the espidf example.
thanks, I will keep that in mind next time I cut & paste.
that is exactly what I did. just started looking at using the ADC's and copied the code from the espidf example.
thanks, I will keep that in mind next time I cut & paste.
Who is online
Users browsing this forum: No registered users and 90 guests