1 /*
2  * Copyright (c) 2006-2024 RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2022-03-28     shelton      first version
9  */
10 
11 #ifndef __ADC_CONFIG_H__
12 #define __ADC_CONFIG_H__
13 
14 #include <rtthread.h>
15 
16 #include "cyhal.h"
17 #include "cybsp.h"
18 
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif
23 
24 #if defined(BSP_USING_ADC1) || defined(BSP_USING_ADC2)
25 
26 cyhal_adc_t adc_obj;
27 cyhal_adc_channel_t adc_chan_obj;
28 
29 const cyhal_adc_config_t adc_config =
30 {
31     .continuous_scanning = false,   /* Continuous Scanning is disabled*/
32     .average_count = 1,             /* Average count disabled*/
33     .vref = CYHAL_ADC_REF_VDDA,     /* VREF for Single ended channel set to VDDA*/
34     .vneg = CYHAL_ADC_VNEG_VSSA,    /* VNEG for Single ended channel set to VSSA*/
35     .resolution = 12u,              /* 12-bit resolution*/
36     .ext_vref = NC,                 /* No connection*/
37     .bypass_pin = NC                /* No connection*/
38 };
39 
40 #ifndef ADC1_CONFIG
41 #define ADC1_CONFIG                 \
42     {                               \
43         .adc_ch = &adc_chan_obj,    \
44         .name = "adc1",             \
45     }
46 #endif /* ADC1_CONFIG */
47 
48 #endif
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* __ADC_CONFIG_H__ */
55