1 /*
2  * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <esp_types.h>
8 #include <esp_err.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 //This is the ADC calibration value version burnt in efuse
15 #define ESP_EFUSE_ADC_CALIB_VER     1
16 
17 /**
18  * @brief Get the RTC calibration efuse version
19  *
20  * @return Version of the stored efuse
21  */
22 int esp_efuse_rtc_calib_get_ver(void);
23 
24 /**
25  * @brief Get the init code in the efuse, for the corresponding attenuation.
26  *
27  * @param version   Version of the stored efuse
28  * @param adc_unit  ADC unit. Not used, for compatibility. On esp32c3, for calibration v1, both ADC units use the same init code (calibrated by ADC1)
29  * @param atten     Attenuation of the init code
30  * @return The init code stored in efuse
31  */
32 uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten);
33 
34 /**
35  * @brief Get the calibration digits stored in the efuse, and the corresponding voltage.
36  *
37  * @param version Version of the stored efuse
38  * @param atten         Attenuation to use
39  * @param out_digi      Output buffer of the digits
40  * @param out_vol_mv    Output of the voltage, in mV
41  * @return
42  *      - ESP_ERR_INVALID_ARG: If efuse version or attenuation is invalid
43  *      - ESP_OK: if success
44  */
45 esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
46 
47 /**
48  * @brief Get the temperature sensor calibration number delta_T stored in the efuse.
49  *
50  * @param version Version of the stored efuse
51  *
52  * @return The specification of temperature sensor calibration number in efuse.
53  */
54 float esp_efuse_rtc_calib_get_cal_temp(int version);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59