1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef _DRIVER_ADC1_I2S_PRIVATE_H_
16 #define _DRIVER_ADC1_I2S_PRIVATE_H_
26 * @brief Force power on for SAR ADC.
27 * This function should be called for the scenario in which ADC are controlled by digital function like DMA.
28 * When the ADC power is always on, RTC FSM can still be functional.
29 * This is an internal API for I2S module to call to enable I2S-ADC function.
30 * Note that adc_power_off() can still power down ADC.
32 void adc_power_always_on();
35 * @brief For I2S dma to claim the usage of ADC1.
37 * Other tasks will be forbidden to use ADC1 between ``adc1_i2s_mode_acquire`` and ``adc1_i2s_release``.
38 * The I2S module may have to wait for a short time for the current conversion (if exist) to finish.
42 * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
44 esp_err_t adc1_i2s_mode_acquire();
47 * @brief For ADC1 to claim the usage of ADC1.
49 * Other tasks will be forbidden to use ADC1 between ``adc1_adc_mode_acquire`` and ``adc1_i2s_release``.
50 * The ADC1 may have to wait for some time for the I2S read operation to finish.
54 * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
56 esp_err_t adc1_adc_mode_acquire();
59 * @brief to let other tasks use the ADC1 when I2S is not work.
61 * Other tasks will be forbidden to use ADC1 between ``adc1_adc/i2s_mode_acquire`` and ``adc1_i2s_release``.
62 * Call this function to release the occupation of ADC1
64 * @return always return ESP_OK.
66 esp_err_t adc1_lock_release();
72 #endif /*_DRIVER_ADC1_I2S_PRIVATE_H_*/