app_adc_dma.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file app_adc_dma.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of ADC app library.
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  ****************************************************************************************
36  */
37 
38 /** @addtogroup PERIPHERAL Peripheral Driver
39  * @{
40  */
41 
42 /** @addtogroup APP_DRIVER APP DRIVER
43  * @{
44  */
45 
46 /** @defgroup APP_ADC ADC
47  * @brief ADC APP module driver.
48  * @{
49  */
50 
51 
52 #ifndef _APP_ADC_DMA_H_
53 #define _APP_ADC_DMA_H_
54 
55 #include "grx_hal.h"
56 #include "app_io.h"
57 #include "app_drv_error.h"
58 #include "app_drv_config.h"
59 #include "app_adc.h"
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 #ifdef HAL_ADC_MODULE_ENABLED
66 
67 #ifdef APP_ADC_SNSADC_ENABLE
68 /** @addtogroup APP_ADC_DRIVER_MACRO Defines
69  * @{
70  */
71  /**
72 * @brief DMA for conversion.
73 */
74 #define app_adc_dma_conversion_async app_adc_conversion_async
75 /**
76 * @brief DMA for multi channel conversion.
77 */
78 #define app_adc_dma_multi_channel_conversion_async app_adc_multi_channel_conversion_async
79 /** @} */
80 #endif
81 
82 /* Exported functions --------------------------------------------------------*/
83 /** @addtogroup APP_ADC_DRIVER_FUNCTIONS Functions
84  * @{
85  */
86 
87 /**
88  ****************************************************************************************
89  * @brief Initialize the APP ADC DRIVER according to the specified parameters
90  * in the app_adc_params_t and app_adc_evt_handler_t.
91  * @note If DMA mode is set, you can use blocking mode. Conversely, if blocking mode
92  * is set, you can't use DMA mode.
93  *
94  * @param[in] p_params: Pointer to app_adc_params_t parameter which contains the
95  * configuration information for the specified ADC module.
96  *
97  * @return Result of initialization.
98  ****************************************************************************************
99  */
100 uint16_t app_adc_dma_init(app_adc_params_t *p_params);
101 
102 /**
103  ****************************************************************************************
104  * @brief De-initialize the APP ADC DRIVER peripheral.
105  *
106  * @return Result of De-initialization.
107  ****************************************************************************************
108  */
109 uint16_t app_adc_dma_deinit(void);
110 
111 #ifdef APP_ADC_GPADC_ENABLE
112 
113 /**
114  ****************************************************************************************
115  * @brief DMA for conversion.
116  *
117  * @param[in] p_data: Pointer to data buffer which to storage ADC conversion results.
118  * @param[in] length: Length of data buffer, range between 0 and 4095.
119  * Note: Length must be aligned on a four-byte boundary.
120  *
121  * @return Result of operation.
122  ****************************************************************************************
123  */
124 uint16_t app_adc_dma_conversion_async(uint16_t *p_data, uint32_t length);
125 
126 /**
127  ****************************************************************************************
128  * @brief DMA for multi channels conversion; evt_handler in app_adc_init will callback when all channels finish.
129  *
130  * @param[in] p_begin_node: Pointer to the multi sample channels list node.
131  * @param[in] total_nodes: total sample channels.
132  *
133  * @return Result of operation.
134  ****************************************************************************************
135  */
136 uint16_t app_adc_dma_multi_channel_conversion_async(app_adc_sample_node_t *p_begin_node, uint32_t total_nodes);
137 
138 #endif
139 
140 /** @} */
141 
142 #endif
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif
149 /** @} */
150 /** @} */
151 /** @} */
app_adc_params_t
ADC parameters structure definition.
Definition: app_adc.h:190
app_io.h
Header file containing functions prototypes of GPIO app library.
app_adc_dma_deinit
uint16_t app_adc_dma_deinit(void)
De-initialize the APP ADC DRIVER peripheral.
grx_hal.h
This file contains all the functions prototypes for the HAL module driver.
app_adc.h
Header file containing functions prototypes of ADC app library.
app_adc_dma_init
uint16_t app_adc_dma_init(app_adc_params_t *p_params)
Initialize the APP ADC DRIVER according to the specified parameters in the app_adc_params_t and app_a...
app_drv_error.h
Header file of app driver error code.
app_drv_config.h
Header file of app driver config code.