1 /* 2 * Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2023-05-12 CDT first version 9 */ 10 11 12 #ifndef __DRV_DAC_H__ 13 #define __DRV_DAC_H__ 14 15 /******************************************************************************* 16 * Include files 17 ******************************************************************************/ 18 19 /* C binding of definitions if building with C++ compiler */ 20 #ifdef __cplusplus 21 extern "C" 22 { 23 #endif 24 25 /******************************************************************************* 26 * Global type definitions ('typedef') 27 ******************************************************************************/ 28 struct dac_dev_init_params 29 { 30 char name[8]; 31 uint16_t vref; /*!< Specifies the ADC reference voltage, unit is mv */ 32 uint16_t data_align; /*!<Specify the data alignment. 33 This parameter can be a value of @ref DAC_DATAREG_ALIGN_PATTERN */ 34 rt_bool_t dac_adp_enable; 35 uint16_t dac_adp_sel; /*!<Specify the ADCx priority to be enabled. 36 This parameter can be a value of @ref DAC_ADP_SELECT */ 37 rt_bool_t ch1_output_enable; 38 rt_bool_t ch2_output_enable; 39 #if defined (HC32F4A0) || defined (HC32F448) || defined (HC32F4A8) 40 uint16_t ch1_data_src; 41 uint16_t ch2_data_src; 42 #endif 43 rt_bool_t ch1_amp_enable; 44 rt_bool_t ch2_amp_enable; 45 #if defined (HC32F472) 46 uint16_t ch1_amp_gain; 47 uint16_t ch2_amp_gain; 48 #endif 49 }; 50 51 /******************************************************************************* 52 * Global pre-processor symbols/macros ('#define') 53 ******************************************************************************/ 54 55 /******************************************************************************* 56 * Global variable definitions ('extern') 57 ******************************************************************************/ 58 59 /******************************************************************************* 60 * Global function prototypes (definition in C source) 61 ******************************************************************************/ 62 int rt_hw_dac_init(void); 63 64 #ifdef __cplusplus 65 } 66 #endif 67 68 #endif /* __DRV_DAC_H__ */ 69 70 /******************************************************************************* 71 * EOF (not truncated) 72 ******************************************************************************/ 73