// Copyright 2020 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include #include #include "sdkconfig.h" #include "soc/soc_caps.h" #include "esp_attr.h" /** * @brief ADC unit enumeration. * * @note For ADC digital controller (DMA mode), ESP32 doesn't support `ADC_UNIT_2`, `ADC_UNIT_BOTH`, `ADC_UNIT_ALTER`. */ typedef enum { ADC_UNIT_1 = 1, /*!< SAR ADC 1. */ ADC_UNIT_2 = 2, /*!< SAR ADC 2. */ ADC_UNIT_BOTH = 3, /*!< SAR ADC 1 and 2. */ ADC_UNIT_ALTER = 7, /*!< SAR ADC 1 and 2 alternative mode. */ ADC_UNIT_MAX, } adc_unit_t; /** * @brief ADC channels handle. See ``adc1_channel_t``, ``adc2_channel_t``. * * @note For ESP32 ADC1, don't use `ADC_CHANNEL_8`, `ADC_CHANNEL_9`. See ``adc1_channel_t``. */ typedef enum { ADC_CHANNEL_0 = 0, /*!< ADC channel */ ADC_CHANNEL_1, /*!< ADC channel */ ADC_CHANNEL_2, /*!< ADC channel */ ADC_CHANNEL_3, /*!< ADC channel */ ADC_CHANNEL_4, /*!< ADC channel */ ADC_CHANNEL_5, /*!< ADC channel */ ADC_CHANNEL_6, /*!< ADC channel */ ADC_CHANNEL_7, /*!< ADC channel */ ADC_CHANNEL_8, /*!< ADC channel */ ADC_CHANNEL_9, /*!< ADC channel */ ADC_CHANNEL_MAX, } adc_channel_t; /** * @brief ADC attenuation parameter. Different parameters determine the range of the ADC. See ``adc1_config_channel_atten``. */ typedef enum { ADC_ATTEN_DB_0 = 0, /*! ADC_CHANNEL_MAX), The data is invalid. */ } type1; /*! ADC_CHANNEL_MAX), The data is invalid. */ uint16_t unit: 1; /*! ADC_CHANNEL_MAX), The data is invalid. */ uint32_t unit: 1; /*! threshold, Generates monitor interrupt. * MONITOR_LOW: If ADC_OUT < threshold, Generates monitor interrupt. */ typedef enum { #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32H2 ADC_DIGI_MONITOR_DIS = 0, /*! threshold, Generates monitor interrupt. */ #else ADC_DIGI_MONITOR_HIGH = 0, /*! threshold, Generates monitor interrupt. */ ADC_DIGI_MONITOR_LOW, /*!