adc_cali_interface.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_types.h"
  8. #include "esp_err.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef struct adc_cali_scheme_t adc_cali_scheme_t;
  13. /**
  14. * @brief ADC Calibration Scheme Interface and Context
  15. */
  16. struct adc_cali_scheme_t {
  17. /**
  18. * @brief Convert ADC raw data to calibrated voltage
  19. *
  20. * @param[in] arg ///< ADC calibration scheme specific context
  21. * @param[in] raw ///< ADC raw data
  22. * @param[out] voltage ///< Calibrated ADC voltage (in mV)
  23. *
  24. * @return
  25. * - ESP_OK: On success
  26. * - ESP_ERR_INVALID_ARG: Invalid argument
  27. * - ESP_ERR_INVALID_STATE: Invalid state, scheme didn't registered
  28. */
  29. esp_err_t (*raw_to_voltage)(void *arg, int raw, int *voltage);
  30. /**
  31. * @brief ADC calibration specific contexts
  32. * Can be customized to difference calibration schemes
  33. */
  34. void *ctx;
  35. };
  36. #ifdef __cplusplus
  37. }
  38. #endif