soc version needed for analog read linearisation

VormsThierry
Posts: 8
Joined: Fri Mar 30, 2018 4:38 pm

soc version needed for analog read linearisation

Postby VormsThierry » Mon May 29, 2023 1:27 pm

Hello,
I see a code on internet to correct the ADC.
This code need to know wich version of ESP32 is used.
The part of code is:
//ADC Calibration
#if CONFIG_IDF_TARGET_ESP32
#define ADC_EXAMPLE_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_VREF
#elif CONFIG_IDF_TARGET_ESP32S2
#define ADC_EXAMPLE_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_TP
#elif CONFIG_IDF_TARGET_ESP32C3
#define ADC_EXAMPLE_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_TP
#elif CONFIG_IDF_TARGET_ESP32S3
#define ADC_EXAMPLE_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_TP_FIT
#endif

These define are not available to the Arduino developpement.
I need similar define to build my code.
Can you tell me how I can found SOC define in Arduino env ?

Many thanks !

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

Re: soc version needed for analog read linearisation

Postby boarchuz » Tue May 30, 2023 5:10 am

Code: Select all

#include "sdkconfig.h"
It's almost certainly already indirectly defined as many other headers will be including sdkconfig.h.

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: soc version needed for analog read linearisation

Postby MicroController » Tue May 30, 2023 9:54 am

Code: Select all

#include <Arduino.h>
may do the trick already.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: soc version needed for analog read linearisation

Postby lbernstone » Tue May 30, 2023 4:52 pm

There are already APIs included in Arduino and ESP-IDF to abstract this. Don't reinvent the wheel with something that will be difficult to maintain.
https://github.com/espressif/arduino-es ... adc.c#L269
https://docs.espressif.com/projects/esp ... alibration

Who is online

Users browsing this forum: Google [Bot] and 112 guests