1 /*
2  * SPDX-FileCopyrightText: 2020-2022 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 #define ESP_EFUSE_ADC_CALIB_VER_MIN  ESP_EFUSE_ADC_CALIB_VER
17 #define ESP_EFUSE_ADC_CALIB_VER_MAX  ESP_EFUSE_ADC_CALIB_VER
18 
19 /**
20  * @brief Get the RTC calibration efuse version
21  *
22  * @return Version of the stored efuse
23  */
24 int esp_efuse_rtc_calib_get_ver(void);
25 
26 /**
27  * @brief Get the init code in the efuse, for the corresponding attenuation.
28  *
29  * @param version       Version of the stored efuse
30  * @param adc_unit      ADC unit
31  * @param atten         Attenuation of the init code
32  * @return The init code stored in efuse
33  */
34 uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten);
35 
36 /**
37  * @brief Get the calibration digits stored in the efuse, and the corresponding voltage.
38  *
39  * @param version       Version of the stored efuse
40  * @param adc_unit      ADC unit
41  * @param atten         Attenuation to use
42  * @param out_digi      Output buffer of the digits
43  * @param out_vol_mv    Output of the voltage, in mV
44  * @return
45  *      - ESP_ERR_INVALID_ARG: If `ADC_ATTEN_DB_2_5` or `ADC_ATTEN_DB_6` is used
46  *      - ESP_OK: if success
47  */
48 esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t *out_digi, uint32_t *out_vol_mv);
49 
50 /**
51  * @brief Get the temperature sensor calibration number delta_T stored in the efuse.
52  *
53  * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse.
54  *
55  * @return ESP_OK if get the calibration value successfully.
56  *         ESP_ERR_INVALID_ARG if can't get the calibration value.
57  */
58 esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63