mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
Merge branch 'refactor/no_dac_on_esp32s3' into 'master'
dac: added DAC support macro Closes IDF-1777 See merge request espressif/esp-idf!13038
This commit is contained in:
@@ -55,7 +55,6 @@ endif()
|
||||
|
||||
if(${target} STREQUAL "esp32s3")
|
||||
list(APPEND srcs "adc_common.c"
|
||||
"dac_common.c"
|
||||
"dedic_gpio.c"
|
||||
"gdma.c"
|
||||
"spi_slave_hd.c"
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "hal/adc_types.h"
|
||||
#include "hal/adc_hal.h"
|
||||
|
||||
#if SOC_DAC_PERIPH_NUM > 0
|
||||
#if SOC_DAC_SUPPORTED
|
||||
#include "driver/dac.h"
|
||||
#include "hal/dac_hal.h"
|
||||
#endif
|
||||
@@ -248,7 +248,9 @@ static void adc_rtc_chan_init(adc_unit_t adc_unit)
|
||||
if (adc_unit & ADC_UNIT_1) {
|
||||
/* Workaround: Disable the synchronization operation function of ADC1 and DAC.
|
||||
If enabled(default), ADC RTC controller sampling will cause the DAC channel output voltage. */
|
||||
#if SOC_DAC_SUPPORTED
|
||||
dac_hal_rtc_sync_by_adc(false);
|
||||
#endif
|
||||
adc_hal_rtc_output_invert(ADC_NUM_1, SOC_ADC1_DATA_INVERT_DEFAULT);
|
||||
adc_hal_set_sar_clk_div(ADC_NUM_1, SOC_ADC_SAR_CLK_DIV_DEFAULT(ADC_NUM_1));
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
@@ -532,6 +534,7 @@ static inline void adc2_init(void)
|
||||
|
||||
static inline void adc2_dac_disable( adc2_channel_t channel)
|
||||
{
|
||||
#if SOC_DAC_SUPPORTED
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
if ( channel == ADC2_CHANNEL_8 ) { // the same as DAC channel 1
|
||||
dac_output_disable(DAC_CHANNEL_1);
|
||||
@@ -545,6 +548,7 @@ static inline void adc2_dac_disable( adc2_channel_t channel)
|
||||
dac_output_disable(DAC_CHANNEL_2);
|
||||
}
|
||||
#endif
|
||||
#endif // SOC_DAC_SUPPORTED
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,80 +0,0 @@
|
||||
// Copyright 2019 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 "driver/dac_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*---------------------------------------------------------------
|
||||
Digital controller setting
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief DAC digital controller initialization.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_init(void);
|
||||
|
||||
/**
|
||||
* @brief DAC digital controller deinitialization.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Setting the DAC digital controller.
|
||||
*
|
||||
* @param cfg Pointer to digital controller paramter. See ``dac_digi_config_t``.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t dac_digi_controller_config(const dac_digi_config_t *cfg);
|
||||
|
||||
/**
|
||||
* @brief DAC digital controller start output voltage.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_start(void);
|
||||
|
||||
/**
|
||||
* @brief DAC digital controller stop output voltage.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_stop(void);
|
||||
|
||||
/**
|
||||
* @brief Reset DAC digital controller FIFO.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_fifo_reset(void);
|
||||
|
||||
/**
|
||||
* @brief Reset DAC digital controller.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t dac_digi_reset(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -12,8 +12,9 @@
|
||||
#include "nvs_flash.h"
|
||||
#include "test_utils.h"
|
||||
#include "driver/i2s.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if !DISABLED_FOR_TARGETS(ESP32C3) && !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
|
||||
#if SOC_DAC_SUPPORTED
|
||||
#include "driver/dac.h"
|
||||
#include "esp_adc_cal.h"
|
||||
|
||||
@@ -182,4 +183,4 @@ TEST_CASE("esp32s2 adc2-dac with adc2 calibration", "[adc-dac]")
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !DISABLED_FOR_TARGETS(ESP32C3) && !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
|
||||
#endif // SOC_DAC_SUPPORTED
|
||||
|
Reference in New Issue
Block a user