esp_efuse_rtc_calib.h 2.0 KB

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