esp_efuse_rtc_calib.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * SPDX-FileCopyrightText: 2022-2023 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 esp32P4, 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 atten Attenuation to use
  33. * @param out_digi Output buffer of the digits
  34. * @param out_vol_mv Output of the voltage, in mV
  35. * @return
  36. * - ESP_ERR_INVALID_ARG: If efuse version or attenuation is invalid
  37. * - ESP_OK: if success
  38. */
  39. esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
  40. /**
  41. * @brief Get the temperature sensor calibration number delta_T stored in the efuse.
  42. *
  43. * @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse.
  44. *
  45. * @return ESP_OK if get the calibration value successfully.
  46. * ESP_ERR_INVALID_ARG if can't get the calibration value.
  47. */
  48. esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal);
  49. #ifdef __cplusplus
  50. }
  51. #endif