|
|
|
|
@@ -12,30 +12,17 @@
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
|
|
#ifndef _DRIVER_ADC_H_
|
|
|
|
|
#define _DRIVER_ADC_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
#include "driver/gpio.h"
|
|
|
|
|
#include "soc/adc_periph.h"
|
|
|
|
|
#include "hal/adc_types.h"
|
|
|
|
|
|
|
|
|
|
//this definitions are only for being back-compatible
|
|
|
|
|
#define ADC_ATTEN_0db ADC_ATTEN_DB_0
|
|
|
|
|
#define ADC_ATTEN_2_5db ADC_ATTEN_DB_2_5
|
|
|
|
|
#define ADC_ATTEN_6db ADC_ATTEN_DB_6
|
|
|
|
|
#define ADC_ATTEN_11db ADC_ATTEN_DB_11
|
|
|
|
|
//this definitions are only for being back-compatible
|
|
|
|
|
#define ADC_WIDTH_9Bit ADC_WIDTH_BIT_9
|
|
|
|
|
#define ADC_WIDTH_10Bit ADC_WIDTH_BIT_10
|
|
|
|
|
#define ADC_WIDTH_11Bit ADC_WIDTH_BIT_11
|
|
|
|
|
#define ADC_WIDTH_12Bit ADC_WIDTH_BIT_12
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**** `adc1_channel_t` will be deprecated functions, combine into `adc_channel_t` ********/
|
|
|
|
|
typedef enum {
|
|
|
|
|
@@ -71,17 +58,29 @@ typedef enum {
|
|
|
|
|
ADC2_CHANNEL_MAX,
|
|
|
|
|
} adc2_channel_t;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
ADC_UNIT_1 = 1, /*!< SAR ADC 1*/
|
|
|
|
|
ADC_UNIT_2 = 2, /*!< SAR ADC 2, not supported yet*/
|
|
|
|
|
ADC_UNIT_BOTH = 3, /*!< SAR ADC 1 and 2, not supported yet */
|
|
|
|
|
ADC_UNIT_ALTER = 7, /*!< SAR ADC 1 and 2 alternative mode, not supported yet */
|
|
|
|
|
ADC_UNIT_MAX,
|
|
|
|
|
} adc_unit_t;
|
|
|
|
|
/**
|
|
|
|
|
* @brief ADC rtc controller attenuation option.
|
|
|
|
|
*
|
|
|
|
|
* @note This definitions are only for being back-compatible
|
|
|
|
|
*/
|
|
|
|
|
#define ADC_ATTEN_0db ADC_ATTEN_DB_0
|
|
|
|
|
#define ADC_ATTEN_2_5db ADC_ATTEN_DB_2_5
|
|
|
|
|
#define ADC_ATTEN_6db ADC_ATTEN_DB_6
|
|
|
|
|
#define ADC_ATTEN_11db ADC_ATTEN_DB_11
|
|
|
|
|
//this definitions are only for being back-compatible
|
|
|
|
|
#define ADC_WIDTH_9Bit ADC_WIDTH_BIT_9
|
|
|
|
|
#define ADC_WIDTH_10Bit ADC_WIDTH_BIT_10
|
|
|
|
|
#define ADC_WIDTH_11Bit ADC_WIDTH_BIT_11
|
|
|
|
|
#define ADC_WIDTH_12Bit ADC_WIDTH_BIT_12
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief ADC digital controller encode option.
|
|
|
|
|
*
|
|
|
|
|
* @deprecated The ESP32S2 don't use I2S DMA. Call ``adc_digi_output_format_t`` instead.
|
|
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
ADC_ENCODE_12BIT, /*!< ADC to I2S data format, [15:12]-channel [11:0]-12 bits ADC data */
|
|
|
|
|
ADC_ENCODE_11BIT, /*!< ADC to I2S data format, [15]-1 [14:11]-channel [10:0]-11 bits ADC data */
|
|
|
|
|
ADC_ENCODE_12BIT, /*!< ADC to DMA data format, , [15:12]-channel [11:0]-12 bits ADC data */
|
|
|
|
|
ADC_ENCODE_11BIT, /*!< ADC to DMA data format, [15]-unit, [14:11]-channel [10:0]-11 bits ADC data */
|
|
|
|
|
ADC_ENCODE_MAX,
|
|
|
|
|
} adc_i2s_encode_t;
|
|
|
|
|
|
|
|
|
|
@@ -89,7 +88,6 @@ typedef enum {
|
|
|
|
|
* @brief Get the GPIO number of a specific ADC1 channel.
|
|
|
|
|
*
|
|
|
|
|
* @param channel Channel to get the GPIO number
|
|
|
|
|
*
|
|
|
|
|
* @param gpio_num output buffer to hold the GPIO number
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
@@ -99,60 +97,38 @@ typedef enum {
|
|
|
|
|
esp_err_t adc1_pad_get_io_num(adc1_channel_t channel, gpio_num_t *gpio_num);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configure ADC1 capture width, meanwhile enable output invert for ADC1.
|
|
|
|
|
* The configuration is for all channels of ADC1
|
|
|
|
|
* @param width_bit Bit capture width for ADC1
|
|
|
|
|
* @brief Set the attenuation of a particular channel on ADC1, and configure its associated GPIO pin mux.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK success
|
|
|
|
|
* - ESP_ERR_INVALID_ARG Parameter error
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc1_config_width(adc_bits_width_t width_bit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configure ADC capture width.
|
|
|
|
|
* @param adc_unit ADC unit index
|
|
|
|
|
* @param width_bit Bit capture width for ADC unit.
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK success
|
|
|
|
|
* - ESP_ERR_INVALID_ARG Parameter error
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set the attenuation of a particular channel on ADC1, and configure its
|
|
|
|
|
* associated GPIO pin mux.
|
|
|
|
|
* The default ADC full-scale voltage is 1.1 V. To read higher voltages (up to the pin maximum voltage,
|
|
|
|
|
* usually 3.3 V) requires setting >0 dB signal attenuation for that ADC channel.
|
|
|
|
|
*
|
|
|
|
|
* @note For any given channel, this function must be called before the first time
|
|
|
|
|
* adc1_get_raw() is called for that channel.
|
|
|
|
|
* When VDD_A is 3.3 V:
|
|
|
|
|
*
|
|
|
|
|
* @note This function can be called multiple times to configure multiple
|
|
|
|
|
* ADC channels simultaneously. adc1_get_raw() can then be called for any configured
|
|
|
|
|
* channel.
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_DB_0) gives full-scale voltage 1.1 V
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_DB_2_5) gives full-scale voltage 1.5 V
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_DB_6) gives full-scale voltage 2.2 V
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_DB_11) gives full-scale voltage 3.9 V (see note below)
|
|
|
|
|
*
|
|
|
|
|
* The default ADC full-scale voltage is 1.1 V. To read higher voltages (up to the pin maximum voltage,
|
|
|
|
|
* usually 3.3 V) requires setting >0 dB signal attenuation for that ADC channel.
|
|
|
|
|
*
|
|
|
|
|
* When VDD_A is 3.3 V:
|
|
|
|
|
*
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_DB_0) gives full-scale voltage 1.1 V
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_DB_2_5) gives full-scale voltage 1.5 V
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_DB_6) gives full-scale voltage 2.2 V
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_DB_11) gives full-scale voltage 3.9 V (see note below)
|
|
|
|
|
*
|
|
|
|
|
* @note The full-scale voltage is the voltage corresponding to a maximum reading (depending on ADC1 configured
|
|
|
|
|
* bit width, this value is: 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits.)
|
|
|
|
|
* @note The full-scale voltage is the voltage corresponding to a maximum reading (depending on ADC1 configured bit width,
|
|
|
|
|
* this value in ESP32 is: 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits.
|
|
|
|
|
* this value in ESP32S2 is: 8191 for 13-bits.)
|
|
|
|
|
*
|
|
|
|
|
* @note At 11 dB attenuation the maximum voltage is limited by VDD_A, not the full scale voltage.
|
|
|
|
|
*
|
|
|
|
|
* Due to ADC characteristics, most accurate results are obtained within the following approximate voltage ranges:
|
|
|
|
|
* @note For ESP32:
|
|
|
|
|
* Due to ADC characteristics, most accurate results are obtained within the following approximate voltage ranges:
|
|
|
|
|
*
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_DB_0) between 100 and 950 mV
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_DB_2_5) between 100 and 1250 mV
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_DB_6) between 150 to 1750 mV
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_DB_11) between 150 to 2450 mV
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_DB_0) between 100 and 950 mV
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_DB_2_5) between 100 and 1250 mV
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_DB_6) between 150 to 1750 mV
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_DB_11) between 150 to 2450 mV
|
|
|
|
|
*
|
|
|
|
|
* For maximum accuracy, use the ADC calibration APIs and measure voltages within these recommended ranges.
|
|
|
|
|
* For maximum accuracy, use the ADC calibration APIs and measure voltages within these recommended ranges.
|
|
|
|
|
*
|
|
|
|
|
* @note For any given channel, this function must be called before the first time ``adc1_get_raw()`` is called for that channel.
|
|
|
|
|
*
|
|
|
|
|
* @note This function can be called multiple times to configure multiple
|
|
|
|
|
* ADC channels simultaneously. ``adc1_get_raw()`` can then be called for any configured channel.
|
|
|
|
|
*
|
|
|
|
|
* @param channel ADC1 channel to configure
|
|
|
|
|
* @param atten Attenuation level
|
|
|
|
|
@@ -163,19 +139,31 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configure ADC1 capture width, meanwhile enable output invert for ADC1.
|
|
|
|
|
* The configuration is for all channels of ADC1
|
|
|
|
|
* @param width_bit Bit capture width for ADC1
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK success
|
|
|
|
|
* - ESP_ERR_INVALID_ARG Parameter error
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc1_config_width(adc_bits_width_t width_bit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Take an ADC1 reading from a single channel.
|
|
|
|
|
* @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on,
|
|
|
|
|
* @note ESP32:
|
|
|
|
|
* When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on,
|
|
|
|
|
* the input of GPIO36 and GPIO39 will be pulled down for about 80ns.
|
|
|
|
|
* When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39.
|
|
|
|
|
* Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue.
|
|
|
|
|
*
|
|
|
|
|
* @note Call adc1_config_width() before the first time this
|
|
|
|
|
* function is called.
|
|
|
|
|
* function is called.
|
|
|
|
|
*
|
|
|
|
|
* @note For any given channel, adc1_config_channel_atten(channel)
|
|
|
|
|
* must be called before the first time this function is called. Configuring
|
|
|
|
|
* a new channel does not prevent a previously configured channel from being read.
|
|
|
|
|
* must be called before the first time this function is called. Configuring
|
|
|
|
|
* a new channel does not prevent a previously configured channel from being read.
|
|
|
|
|
*
|
|
|
|
|
* @param channel ADC1 channel to read
|
|
|
|
|
*
|
|
|
|
|
@@ -225,22 +213,18 @@ esp_err_t adc_set_data_inv(adc_unit_t adc_unit, bool inv_en);
|
|
|
|
|
esp_err_t adc_set_clk_div(uint8_t clk_div);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set I2S data source
|
|
|
|
|
* @param src I2S DMA data source, I2S DMA can get data from digital signals or from ADC.
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK success
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc_set_i2s_data_source(adc_i2s_source_t src);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initialize I2S ADC mode
|
|
|
|
|
* @brief Configure ADC capture width.
|
|
|
|
|
*
|
|
|
|
|
* @note For ESP32S2, only support ``ADC_WIDTH_BIT_13``.
|
|
|
|
|
*
|
|
|
|
|
* @param adc_unit ADC unit index
|
|
|
|
|
* @param channel ADC channel index
|
|
|
|
|
* @param width_bit Bit capture width for ADC unit. For ESP32S2, only support ``ADC_WIDTH_BIT_13``.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK success
|
|
|
|
|
* - ESP_ERR_INVALID_ARG Parameter error
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel);
|
|
|
|
|
esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configure ADC1 to be usable by the ULP
|
|
|
|
|
@@ -253,27 +237,6 @@ esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel);
|
|
|
|
|
*/
|
|
|
|
|
void adc1_ulp_enable(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Read Hall Sensor
|
|
|
|
|
*
|
|
|
|
|
* @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on,
|
|
|
|
|
* the input of GPIO36 and GPIO39 will be pulled down for about 80ns.
|
|
|
|
|
* When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39.
|
|
|
|
|
* Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue.
|
|
|
|
|
*
|
|
|
|
|
* @note The Hall Sensor uses channels 0 and 3 of ADC1. Do not configure
|
|
|
|
|
* these channels for use as ADC channels.
|
|
|
|
|
*
|
|
|
|
|
* @note The ADC1 module must be enabled by calling
|
|
|
|
|
* adc1_config_width() before calling hall_sensor_read(). ADC1
|
|
|
|
|
* should be configured for 12 bit readings, as the hall sensor
|
|
|
|
|
* readings are low values and do not cover the full range of the
|
|
|
|
|
* ADC.
|
|
|
|
|
*
|
|
|
|
|
* @return The hall sensor reading.
|
|
|
|
|
*/
|
|
|
|
|
int hall_sensor_read(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get the GPIO number of a specific ADC2 channel.
|
|
|
|
|
*
|
|
|
|
|
@@ -290,23 +253,24 @@ esp_err_t adc2_pad_get_io_num(adc2_channel_t channel, gpio_num_t *gpio_num);
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configure the ADC2 channel, including setting attenuation.
|
|
|
|
|
*
|
|
|
|
|
* The default ADC full-scale voltage is 1.1 V. To read higher voltages (up to the pin maximum voltage,
|
|
|
|
|
* usually 3.3 V) requires setting >0 dB signal attenuation for that ADC channel.
|
|
|
|
|
*
|
|
|
|
|
* When VDD_A is 3.3 V:
|
|
|
|
|
*
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_0db) gives full-scale voltage 1.1 V
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_2_5db) gives full-scale voltage 1.5 V
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_6db) gives full-scale voltage 2.2 V
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_11db) gives full-scale voltage 3.9 V (see note below)
|
|
|
|
|
*
|
|
|
|
|
* @note This function also configures the input GPIO pin mux to
|
|
|
|
|
* connect it to the ADC2 channel. It must be called before calling
|
|
|
|
|
* ``adc2_get_raw()`` for this channel.
|
|
|
|
|
*
|
|
|
|
|
* The default ADC full-scale voltage is 1.1 V. To read higher voltages (up to the pin maximum voltage,
|
|
|
|
|
* usually 3.3 V) requires setting >0 dB signal attenuation for that ADC channel.
|
|
|
|
|
*
|
|
|
|
|
* When VDD_A is 3.3 V:
|
|
|
|
|
*
|
|
|
|
|
* - 0 dB attenuation (ADC_ATTEN_0db) gives full-scale voltage 1.1 V
|
|
|
|
|
* - 2.5 dB attenuation (ADC_ATTEN_2_5db) gives full-scale voltage 1.5 V
|
|
|
|
|
* - 6 dB attenuation (ADC_ATTEN_6db) gives full-scale voltage 2.2 V
|
|
|
|
|
* - 11 dB attenuation (ADC_ATTEN_11db) gives full-scale voltage 3.9 V (see note below)
|
|
|
|
|
* connect it to the ADC2 channel. It must be called before calling
|
|
|
|
|
* ``adc2_get_raw()`` for this channel.
|
|
|
|
|
*
|
|
|
|
|
* @note The full-scale voltage is the voltage corresponding to a maximum reading
|
|
|
|
|
* (depending on ADC2 configured bit width, this value is: 4095 for 12-bits, 2047
|
|
|
|
|
* for 11-bits, 1023 for 10-bits, 511 for 9 bits.)
|
|
|
|
|
* (depending on ADC2 configured bit width,
|
|
|
|
|
* this value of ESP32 is: 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits.
|
|
|
|
|
* this value of ESP32S2 is: 8191 for 13-bits.)
|
|
|
|
|
*
|
|
|
|
|
* @note At 11 dB attenuation the maximum voltage is limited by VDD_A, not the full scale voltage.
|
|
|
|
|
*
|
|
|
|
|
@@ -322,46 +286,32 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten);
|
|
|
|
|
/**
|
|
|
|
|
* @brief Take an ADC2 reading on a single channel
|
|
|
|
|
*
|
|
|
|
|
* @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on,
|
|
|
|
|
* @note ESP32:
|
|
|
|
|
* When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on,
|
|
|
|
|
* the input of GPIO36 and GPIO39 will be pulled down for about 80ns.
|
|
|
|
|
* When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39.
|
|
|
|
|
* Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue.
|
|
|
|
|
*
|
|
|
|
|
* @note For a given channel, ``adc2_config_channel_atten()``
|
|
|
|
|
* must be called before the first time this function is called. If Wi-Fi is started via ``esp_wifi_start()``, this
|
|
|
|
|
* function will always fail with ``ESP_ERR_TIMEOUT``.
|
|
|
|
|
* @note ESP32:
|
|
|
|
|
* For a given channel, ``adc2_config_channel_atten()``
|
|
|
|
|
* must be called before the first time this function is called. If Wi-Fi is started via ``esp_wifi_start()``, this
|
|
|
|
|
* function will always fail with ``ESP_ERR_TIMEOUT``.
|
|
|
|
|
*
|
|
|
|
|
* @param channel ADC2 channel to read
|
|
|
|
|
*
|
|
|
|
|
* @param width_bit Bit capture width for ADC2
|
|
|
|
|
* @note ESP32S2:
|
|
|
|
|
* ADC2 support hardware arbiter. The arbiter is to improve the use efficiency of ADC2. After the control right is robbed by the high priority,
|
|
|
|
|
* the low priority controller will read the invalid ADC2 data. Default priority: Wi-Fi > RTC > Digital;
|
|
|
|
|
*
|
|
|
|
|
* @param channel ADC2 channel to read
|
|
|
|
|
* @param width_bit Bit capture width for ADC2. For ESP32S2, only support ``ADC_WIDTH_BIT_13``.
|
|
|
|
|
* @param raw_out the variable to hold the output data.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK if success
|
|
|
|
|
* - ESP_ERR_TIMEOUT the WIFI is started, using the ADC2
|
|
|
|
|
* - ESP_ERR_TIMEOUT ADC2 is being used by other controller and the request timed out.
|
|
|
|
|
* - ESP_ERR_INVALID_STATE The controller status is invalid. Please try again.
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int *raw_out);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Output ADC2 reference voltage to GPIO 25 or 26 or 27
|
|
|
|
|
*
|
|
|
|
|
* This function utilizes the testing mux exclusive to ADC 2 to route the
|
|
|
|
|
* reference voltage one of ADC2's channels. Supported GPIOs are GPIOs
|
|
|
|
|
* 25, 26, and 27. This refernce voltage can be manually read from the pin
|
|
|
|
|
* and used in the esp_adc_cal component.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] gpio GPIO number (GPIOs 25, 26 and 27 are supported)
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* - ESP_OK: v_ref successfully routed to selected GPIO
|
|
|
|
|
* - ESP_ERR_INVALID_ARG: Unsupported GPIO
|
|
|
|
|
*/
|
|
|
|
|
esp_err_t adc2_vref_to_gpio(gpio_num_t gpio);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /*_DRIVER_ADC_H_*/
|
|
|
|
|
|