esp_efuse_rtc_calib.h 1.9 KB

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