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 /** 25 * @brief For I2S dma to claim the usage of ADC1. 26 * 27 * Other tasks will be forbidden to use ADC1 between ``adc1_dma_mode_acquire`` and ``adc1_i2s_release``. 28 * The I2S module may have to wait for a short time for the current conversion (if exist) to finish. 29 * 30 * @return 31 * - ESP_OK success 32 * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success. 33 */ 34 esp_err_t adc1_dma_mode_acquire(void); 35 36 /** 37 * @brief For ADC1 to claim the usage of ADC1. 38 * 39 * Other tasks will be forbidden to use ADC1 between ``adc1_rtc_mode_acquire`` and ``adc1_i2s_release``. 40 * The ADC1 may have to wait for some time for the I2S read operation to finish. 41 * 42 * @return 43 * - ESP_OK success 44 * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success. 45 */ 46 esp_err_t adc1_rtc_mode_acquire(void); 47 48 /** 49 * @brief to let other tasks use the ADC1 when I2S is not work. 50 * 51 * Other tasks will be forbidden to use ADC1 between ``adc1_adc/i2s_mode_acquire`` and ``adc1_i2s_release``. 52 * Call this function to release the occupation of ADC1 53 * 54 * @return always return ESP_OK. 55 */ 56 esp_err_t adc1_lock_release(void); 57 58 #ifdef __cplusplus 59 } 60 #endif 61