• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include "esp_err.h"
22 
23 /**
24  * @brief For WIFI module to claim the usage of ADC2.
25  *
26  * Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
27  * The WIFI module may have to wait for a short time for the current conversion (if exist) to finish.
28  *
29  * @return
30  *      - ESP_OK success
31  *      - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
32  */
33 esp_err_t adc2_wifi_acquire(void);
34 
35 
36 /**
37  * @brief For WIFI module to let other tasks use the ADC2 when WIFI is not work.
38  *
39  * Other tasks will be forbidden to use ADC2 between ``adc2_wifi_acquire`` and ``adc2_wifi_release``.
40  * Call this function to release the occupation of ADC2 by WIFI.
41  *
42  * @return always return ESP_OK.
43  */
44 esp_err_t adc2_wifi_release(void);
45 
46 #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3
47 /**
48  * @brief This API help ADC2 calibration constructor be linked.
49  *
50  * @note  This is a private function, Don't call `adc2_cal_include` in user code.
51  */
52 void adc2_cal_include(void);
53 #else
54 /**
55  * @brief There's no calibration involved on this chip.
56  *
57  * @note  This is a private function, Don't call `adc2_cal_include` in user code.
58  */
59 #define adc2_cal_include()
60 #endif //CONFIG_IDF_TARGET_*
61 
62 #ifdef __cplusplus
63 }
64 #endif
65