1 // Copyright 2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 /******************************************************************************* 16 * NOTICE 17 * The hal is not public api, don't use in application code. 18 * See readme.md in hal/include/hal/readme.md 19 ******************************************************************************/ 20 21 #pragma once 22 23 #include "hal/dac_ll.h" 24 #include "hal/hal_defs.h" 25 #include <esp_err.h> 26 27 /** 28 * Power on dac module and start output voltage. 29 * 30 * @note Before powering up, make sure the DAC PAD is set to RTC PAD and floating status. 31 * @param channel DAC channel num. 32 */ 33 #define dac_hal_power_on(channel) dac_ll_power_on(channel) 34 35 /** 36 * Power done dac module and stop output voltage. 37 * 38 * @param channel DAC channel num. 39 */ 40 #define dac_hal_power_down(channel) dac_ll_power_down(channel) 41 42 /** 43 * Enable/disable the synchronization operation function of ADC1 and DAC. 44 * 45 * @note If enabled(default), ADC RTC controller sampling will cause the DAC channel output voltage. 46 * 47 * @param enable Enable or disable adc and dac synchronization function. 48 */ 49 #define dac_hal_rtc_sync_by_adc(enable) dac_ll_rtc_sync_by_adc(enable) 50 51 /** 52 * Output voltage with value (8 bit). 53 * 54 * @param channel DAC channel num. 55 * @param value Output value. Value range: 0 ~ 255. 56 * The corresponding range of voltage is 0v ~ VDD3P3_RTC. 57 */ 58 #define dac_hal_update_output_value(channel, value) dac_ll_update_output_value(channel, value) 59 60 /** 61 * Enable cosine wave generator output. 62 */ 63 #define dac_hal_cw_generator_enable() dac_ll_cw_generator_enable() 64 65 /** 66 * Disable cosine wave generator output. 67 */ 68 #define dac_hal_cw_generator_disable() dac_ll_cw_generator_disable() 69 70 /** 71 * Config the cosine wave generator function in DAC module. 72 * 73 * @param cw Configuration. 74 */ 75 void dac_hal_cw_generator_config(dac_cw_config_t *cw); 76 77 /** 78 * Enable/disable DAC output data from DMA. 79 */ 80 #define dac_hal_digi_enable_dma(enable) dac_ll_digi_enable_dma(enable) 81