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