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 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 
15 typedef struct adc_cali_scheme_t adc_cali_scheme_t;
16 
17 /**
18  * @brief ADC Calibration Scheme Interface and Context
19  */
20 struct adc_cali_scheme_t {
21 
22     /**
23      * @brief Convert ADC raw data to calibrated voltage
24      *
25      * @param[in]  arg        ///< ADC calibration scheme specific context
26      * @param[in]  raw        ///< ADC raw data
27      * @param[out] voltage    ///< Calibrated ADC voltage (in mV)
28      *
29      * @return
30      *         - ESP_OK:                On success
31      *         - ESP_ERR_INVALID_ARG:   Invalid argument
32      *         - ESP_ERR_INVALID_STATE: Invalid state, scheme didn't registered
33      */
34     esp_err_t (*raw_to_voltage)(void *arg, int raw, int *voltage);
35 
36     /**
37      * @brief ADC calibration specific contexts
38      * Can be customized to difference calibration schemes
39      */
40     void *ctx;
41 
42 };
43 
44 #ifdef __cplusplus
45 }
46 #endif
47