mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_adc: add a kconfig to disable dac on certain adc IOs
Added a kconfig option. By default, when using ADC oneshot driver, it will disable DAC channels: - ESP32: IO25, IO26 - ESP32S2: IO17, IO18 if ADC2 is in use. You can disable this option, to measure DAC output, via internal ADC. This is for test usage.
This commit is contained in:
parent
5e31d4bb2b
commit
236ba48efc
@ -41,7 +41,19 @@ menu "ADC and ADC Calibration"
|
|||||||
This option will allow the ADC calibration component to use Lookup Tables
|
This option will allow the ADC calibration component to use Lookup Tables
|
||||||
to correct for non-linear behavior in 11db attenuation. Other attenuations
|
to correct for non-linear behavior in 11db attenuation. Other attenuations
|
||||||
do not exhibit non-linear behavior hence will not be affected by this option.
|
do not exhibit non-linear behavior hence will not be affected by this option.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
config ADC_DISABLE_DAC_OUTPUT
|
||||||
|
depends on SOC_DAC_SUPPORTED
|
||||||
|
bool "Disable DAC when ADC2 is in use"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
By default, this is set. The ADC oneshot driver will disable the output of the
|
||||||
|
corresponding DAC channels:
|
||||||
|
ESP32: IO25 and IO26
|
||||||
|
ESP32S2: IO17 and IO18
|
||||||
|
|
||||||
|
Disable this option so as to measure the output of DAC by internal ADC, for test usage.
|
||||||
|
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if SOC_DAC_SUPPORTED
|
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
|
||||||
// To disable DAC, workarounds, see this function body to know more
|
// To disable DAC, workarounds, see this function body to know more
|
||||||
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel);
|
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel);
|
||||||
#endif
|
#endif
|
||||||
@ -52,7 +52,7 @@ void adc_oneshot_hal_setup(adc_oneshot_hal_ctx_t *hal, adc_channel_t chan)
|
|||||||
adc_ll_amp_disable(); //Currently the LNA is not open, close it by default.
|
adc_ll_amp_disable(); //Currently the LNA is not open, close it by default.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SOC_DAC_SUPPORTED
|
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
|
||||||
s_disable_dac(hal, chan);
|
s_disable_dac(hal, chan);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ bool adc_oneshot_hal_convert(adc_oneshot_hal_ctx_t *hal, int *out_raw)
|
|||||||
/*---------------------------------------------------------------
|
/*---------------------------------------------------------------
|
||||||
Workarounds
|
Workarounds
|
||||||
---------------------------------------------------------------*/
|
---------------------------------------------------------------*/
|
||||||
#if SOC_DAC_SUPPORTED
|
#if CONFIG_ADC_DISABLE_DAC_OUTPUT
|
||||||
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel)
|
static void s_disable_dac(adc_oneshot_hal_ctx_t *hal, adc_channel_t channel)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user