drv_adc.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. * Copyright (c) 2022, Xiaohua Semiconductor Co., Ltd.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2022-04-28 CDT first version
  10. */
  11. #ifndef __DRV_ADC_H__
  12. #define __DRV_ADC_H__
  13. /*******************************************************************************
  14. * Include files
  15. ******************************************************************************/
  16. #include <rtthread.h>
  17. #include "rtdevice.h"
  18. #include "hc32_ll.h"
  19. /* C binding of definitions if building with C++ compiler */
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /*******************************************************************************
  25. * Global type definitions ('typedef')
  26. ******************************************************************************/
  27. struct adc_dev_init_params
  28. {
  29. char name[8];
  30. uint16_t resolution; /*!< Specifies the ADC resolution.
  31. This parameter can be a value of @ref ADC_Resolution */
  32. uint16_t data_align; /*!< Specifies ADC data alignment.
  33. This parameter can be a value of @ref ADC_Data_Align */
  34. rt_bool_t hard_trig_enable;
  35. uint32_t hard_trig_src; /*a value of @ref ADC_Hard_Trigger_Sel */
  36. rt_bool_t internal_trig0_comtrg0_enable;
  37. rt_bool_t internal_trig0_comtrg1_enable;
  38. en_event_src_t internal_trig0_sel; /*@ref en_event_src_t in details */
  39. rt_bool_t internal_trig1_comtrg0_enable;
  40. rt_bool_t internal_trig1_comtrg1_enable;
  41. en_event_src_t internal_trig1_sel; /*@ref en_event_src_t in details */
  42. rt_bool_t continue_conv_mode_enable;
  43. rt_bool_t data_reg_auto_clear;
  44. uint32_t eoc_poll_time_max;
  45. };
  46. /*******************************************************************************
  47. * Global pre-processor symbols/macros ('#define')
  48. ******************************************************************************/
  49. /*******************************************************************************
  50. * Global variable definitions ('extern')
  51. ******************************************************************************/
  52. /*******************************************************************************
  53. * Global function prototypes (definition in C source)
  54. ******************************************************************************/
  55. int rt_hw_uart_init(void);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* __DRV_USART_H__ */
  60. /*******************************************************************************
  61. * EOF (not truncated)
  62. ******************************************************************************/