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 #include "sdkconfig.h" 9 #include "esp_err.h" 10 #include "hal/adc_types.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 #ifdef CONFIG_IDF_TARGET_ESP32 17 /** 18 * @brief ESP32 ADC DMA source selection. 19 */ 20 typedef enum { 21 ADC_I2S_DATA_SRC_IO_SIG = 0, /*!< I2S data from GPIO matrix signal */ 22 ADC_I2S_DATA_SRC_ADC = 1, /*!< I2S data from ADC */ 23 } adc_i2s_source_t; 24 #endif 25 26 #if CONFIG_IDF_TARGET_ESP32 27 /*--------------------------------------------------------------- 28 ESP32 Deprecated API 29 ---------------------------------------------------------------*/ 30 /** 31 * @brief Set I2S data source 32 * @param src I2S DMA data source, I2S DMA can get data from digital signals or from ADC. 33 * @return 34 * - ESP_OK success 35 */ 36 esp_err_t adc_set_i2s_data_source(adc_i2s_source_t src); 37 38 /** 39 * @brief Initialize I2S ADC mode 40 * @param adc_unit ADC unit index 41 * @param channel ADC channel index 42 * @return 43 * - ESP_OK success 44 * - ESP_ERR_INVALID_ARG Parameter error 45 */ 46 esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel); 47 #endif 48 49 #ifdef __cplusplus 50 } 51 #endif 52