summaryrefslogtreecommitdiff
path: root/bsp/hc32/libraries/hc32_drivers/drv_adc.h
blob: c6bf742ce861841f525f50eb2908f8453270f2f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 * Copyright (c) 2022, Xiaohua Semiconductor Co., Ltd.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-04-28     CDT          first version
 */


#ifndef __DRV_ADC_H__
#define __DRV_ADC_H__

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include <rtthread.h>
#include "rtdevice.h"

#include "hc32_ll.h"

/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C"
{
#endif


/*******************************************************************************
 * Global type definitions ('typedef')
 ******************************************************************************/
struct adc_dev_init_params
{
    char name[8];
    uint16_t resolution;                /*!< Specifies the ADC resolution.
                                             This parameter can be a value of @ref ADC_Resolution */
    uint16_t data_align;                /*!< Specifies ADC data alignment.
                                             This parameter can be a value of @ref ADC_Data_Align */
    rt_bool_t hard_trig_enable;

    uint32_t hard_trig_src;             /*a value of @ref ADC_Hard_Trigger_Sel */
    rt_bool_t internal_trig0_comtrg0_enable;
    rt_bool_t internal_trig0_comtrg1_enable;
    en_event_src_t internal_trig0_sel;         /*@ref en_event_src_t in details */
    rt_bool_t internal_trig1_comtrg0_enable;
    rt_bool_t internal_trig1_comtrg1_enable;
    en_event_src_t internal_trig1_sel;         /*@ref en_event_src_t in details */

    rt_bool_t continue_conv_mode_enable;
    rt_bool_t data_reg_auto_clear;
    uint32_t eoc_poll_time_max;
};

/*******************************************************************************
 * Global pre-processor symbols/macros ('#define')
 ******************************************************************************/

/*******************************************************************************
 * Global variable definitions ('extern')
 ******************************************************************************/

/*******************************************************************************
 * Global function prototypes (definition in C source)
 ******************************************************************************/
int rt_hw_uart_init(void);


#ifdef __cplusplus
}
#endif

#endif /* __DRV_USART_H__ */

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/