drv_dac.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef __DRV_DAC_H__
  11. #define __DRV_DAC_H__
  12. /*******************************************************************************
  13. * Include files
  14. ******************************************************************************/
  15. /* C binding of definitions if building with C++ compiler */
  16. #ifdef __cplusplus
  17. extern "C"
  18. {
  19. #endif
  20. /*******************************************************************************
  21. * Global type definitions ('typedef')
  22. ******************************************************************************/
  23. struct dac_dev_init_params
  24. {
  25. char name[8];
  26. uint16_t vref; /*!< Specifies the ADC reference voltage, unit is mv */
  27. uint16_t data_align; /*!<Specify the data alignment.
  28. This parameter can be a value of @ref DAC_DATAREG_ALIGN_PATTERN */
  29. rt_bool_t dac_adp_enable;
  30. uint16_t dac_adp_sel; /*!<Specify the ADCx priority to be enabled.
  31. This parameter can be a value of @ref DAC_ADP_SELECT */
  32. rt_bool_t ch1_output_enable;
  33. rt_bool_t ch2_output_enable;
  34. #if defined (HC32F4A0) || defined (HC32F448) || defined (HC32F4A8)
  35. uint16_t ch1_data_src;
  36. uint16_t ch2_data_src;
  37. #endif
  38. rt_bool_t ch1_amp_enable;
  39. rt_bool_t ch2_amp_enable;
  40. #if defined (HC32F472)
  41. uint16_t ch1_amp_gain;
  42. uint16_t ch2_amp_gain;
  43. #endif
  44. };
  45. /*******************************************************************************
  46. * Global pre-processor symbols/macros ('#define')
  47. ******************************************************************************/
  48. /*******************************************************************************
  49. * Global variable definitions ('extern')
  50. ******************************************************************************/
  51. /*******************************************************************************
  52. * Global function prototypes (definition in C source)
  53. ******************************************************************************/
  54. int rt_hw_dac_init(void);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif /* __DRV_DAC_H__ */
  59. /*******************************************************************************
  60. * EOF (not truncated)
  61. ******************************************************************************/