1 /*
2  * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include "esp_err.h"
14 
15 /**
16  * @brief For WIFI module to claim the usage of ADC2.
17  *
18  * Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
19  * The WIFI module may have to wait for a short time for the current conversion (if exist) to finish.
20  *
21  * @return
22  *      - ESP_OK success
23  *      - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
24  */
25 esp_err_t adc2_wifi_acquire(void);
26 
27 
28 /**
29  * @brief For WIFI module to let other tasks use the ADC2 when WIFI is not work.
30  *
31  * Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
32  * Call this function to release the occupation of ADC2 by WIFI.
33  *
34  * @return always return ESP_OK.
35  */
36 esp_err_t adc2_wifi_release(void);
37 
38 #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32H2
39 /**
40  * @brief This API help ADC2 calibration constructor be linked.
41  *
42  * @note  This is a private function, Don't call `adc2_cal_include` in user code.
43  */
44 void adc2_cal_include(void);
45 #else
46 /**
47  * @brief There's no calibration involved on this chip.
48  *
49  * @note  This is a private function, Don't call `adc2_cal_include` in user code.
50  */
51 #define adc2_cal_include()
52 #endif //CONFIG_IDF_TARGET_*
53 
54 #ifdef __cplusplus
55 }
56 #endif
57