1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2018-01-05     zylx         first version
9  * 2019-01-08     SummerGift   clean up the code
10  */
11 
12 #ifndef __ADC_CONFIG_H__
13 #define __ADC_CONFIG_H__
14 
15 #include <rtthread.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #ifdef BSP_USING_ADC1
22 #ifndef ADC1_CONFIG
23 #define ADC1_CONFIG                                                 \
24     {                                                               \
25        .Instance                   = ADC1,                          \
26        .Init.ClockPrescaler        = ADC_CLOCK_ASYNC_DIV1,          \
27        .Init.Resolution            = ADC_RESOLUTION_12B,            \
28        .Init.DataAlign             = ADC_DATAALIGN_RIGHT,           \
29        .Init.ScanConvMode          = ADC_SCAN_DIRECTION_FORWARD,    \
30        .Init.EOCSelection          = ADC_EOC_SINGLE_CONV,           \
31        .Init.LowPowerAutoWait      = DISABLE,                       \
32        .Init.LowPowerAutoPowerOff  = DISABLE,                       \
33        .Init.ContinuousConvMode    = DISABLE,                       \
34        .Init.DiscontinuousConvMode = ENABLE,                        \
35        .Init.ExternalTrigConv      = ADC_SOFTWARE_START,            \
36        .Init.ExternalTrigConvEdge  = ADC_EXTERNALTRIGCONVEDGE_NONE, \
37        .Init.DMAContinuousRequests = ENABLE,                        \
38        .Init.Overrun               = ADC_OVR_DATA_OVERWRITTEN,      \
39     }
40 #endif /* ADC1_CONFIG */
41 #endif /* BSP_USING_ADC1 */
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif /* __ADC_CONFIG_H__ */
48