1 /* 2 * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 // The HAL layer for ADC (esp32s2 specific part) 8 9 #include "hal/dac_hal.h" 10 #include "hal/adc_ll.h" 11 #include "hal/dac_types.h" 12 13 /*--------------------------------------------------------------- 14 Digital controller setting 15 ---------------------------------------------------------------*/ 16 dac_hal_digi_init(void)17void dac_hal_digi_init(void) 18 { 19 dac_ll_digi_clk_inv(true); 20 } 21 dac_hal_digi_deinit(void)22void dac_hal_digi_deinit(void) 23 { 24 dac_ll_digi_trigger_output(false); 25 dac_ll_digi_enable_dma(false); 26 dac_ll_digi_fifo_reset(); 27 dac_ll_digi_reset(); 28 } 29 dac_hal_digi_controller_config(const dac_digi_config_t * cfg)30void dac_hal_digi_controller_config(const dac_digi_config_t *cfg) 31 { 32 dac_ll_digi_set_convert_mode(cfg->mode); 33 dac_ll_digi_set_trigger_interval(cfg->interval); 34 adc_ll_digi_controller_clk_div(cfg->dig_clk.div_num, cfg->dig_clk.div_b, cfg->dig_clk.div_a); 35 adc_ll_digi_clk_sel(cfg->dig_clk.use_apll); 36 } 37 dac_hal_digi_start(void)38void dac_hal_digi_start(void) 39 { 40 dac_ll_digi_enable_dma(true); 41 dac_ll_digi_trigger_output(true); 42 } 43 dac_hal_digi_stop(void)44void dac_hal_digi_stop(void) 45 { 46 dac_ll_digi_trigger_output(false); 47 dac_ll_digi_enable_dma(false); 48 } 49