app_i2c_dma.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file app_i2c_dma.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of I2C 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_IIC IIC
47 * @brief IIC APP module driver.
48 * @{
49 */
50
51
52 #ifndef _APP_I2C_DMA_H_
53 #define _APP_I2C_DMA_H_
54
55 #include "grx_hal.h"
56 #include "app_io.h"
57 #include "app_i2c.h"
58 #include "app_drv_error.h"
59 #include "app_drv_config.h"
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 #ifdef HAL_I2C_MODULE_ENABLED
66
67 /** @addtogroup APP_I2C_ENUM Enumerations
68 * @{
69 */
70
71
72 /** @} */
73
74 /* Exported functions --------------------------------------------------------*/
75 /** @addtogroup HAL_APP_I2C_DRIVER_FUNCTIONS Functions
76 * @{
77 */
78 /**
79 ****************************************************************************************
80 * @brief Initialize the APP I2C DRIVER according to the specified parameters
81 * in the app_i2c_params_t and app_i2c_evt_handler_t.
82 * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode
83 * is set, you can't use interrupt mode.
84 *
85 * @param[in] p_params: Pointer to app_i2c_params_t parameter which contains the
86 * configuration information for the specified I2C module.
87 *
88 * @return Result of initialization.
89 ****************************************************************************************
90 */
91 uint16_t app_i2c_dma_init(app_i2c_params_t *p_params);
92
93 /**
94 ****************************************************************************************
95 * @brief De-initialize the APP I2C DRIVER peripheral.
96 *
97 * @param[in] id: De-initialize for a specific ID.
98 *
99 * @return Result of De-initialization.
100 ****************************************************************************************
101 */
102 uint16_t app_i2c_dma_deinit(app_i2c_id_t id);
103
104 /**
105 ****************************************************************************************
106 * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
107 *
108 * @param[in] id: which I2C module want to receive.
109 * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
110 must be shifted at right before call interface.
111 * @param[in] p_data: Pointer to data buffer
112 * @param[in] size: Amount of data to be sent
113 *
114 * @return Result of operation.
115 ****************************************************************************************
116 */
117 uint16_t app_i2c_dma_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size);
118
119 /**
120 ****************************************************************************************
121 * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
122 *
123 * @param[in] id: which I2C module want to transmit.
124 * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
125 must be shifted at right before call interface.
126 * @param[in] p_data: Pointer to data buffer
127 * @param[in] size: Amount of data to be sent
128 *
129 * @return Result of operation.
130 ****************************************************************************************
131 */
132 uint16_t app_i2c_dma_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size);
133
134 /**
135 ****************************************************************************************
136 * @brief Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address
137 *
138 * @param[in] id: which I2C module want to read.
139 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
140 * @param[in] mem_address: Internal memory address
141 * @param[in] mem_addr_size: Size of internal memory address
142 * @param[in] p_data: Pointer to data buffer
143 * @param[in] size: Amount of data to be sent
144 *
145 * @return Result of operation.
146 ****************************************************************************************
147 */
148 uint16_t app_i2c_dma_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
149
150 /**
151 ****************************************************************************************
152 * @brief Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address
153 *
154 * @param[in] id: which I2C module want to write.
155 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
156 * @param[in] mem_address: Internal memory address
157 * @param[in] mem_addr_size: Size of internal memory address
158 * @param[in] p_data: Pointer to data buffer
159 * @param[in] size: Amount of data to be sent
160 *
161 * @return Result of operation.
162 ****************************************************************************************
163 */
164 uint16_t app_i2c_dma_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
165
166 /** @} */
167 #endif
168
169 #ifdef __cplusplus
170 }
171 #endif
172
173 #endif
174 /** @} */
175
176 /** @} */
177
178 /** @} */
179
app_i2c_dma_mem_write_async
uint16_t app_i2c_dma_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size)
Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address.
app_i2c_dma_init
uint16_t app_i2c_dma_init(app_i2c_params_t *p_params)
Initialize the APP I2C DRIVER according to the specified parameters in the app_i2c_params_t and app_i...
app_i2c_dma_transmit_async
uint16_t app_i2c_dma_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size)
Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
app_i2c_dma_mem_read_async
uint16_t app_i2c_dma_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size)
Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address.
app_io.h
Header file containing functions prototypes of GPIO app library.
app_i2c.h
Header file containing functions prototypes of I2C app library.
app_i2c_id_t
app_i2c_id_t
I2C module Enumerations definition.
Definition: app_i2c.h:78
grx_hal.h
This file contains all the functions prototypes for the HAL module driver.
app_i2c_dma_receive_async
uint16_t app_i2c_dma_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size)
Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
app_i2c_dma_deinit
uint16_t app_i2c_dma_deinit(app_i2c_id_t id)
De-initialize the APP I2C DRIVER peripheral.
app_i2c_params_t
I2C parameters structure definition.
Definition: app_i2c.h:207
app_drv_error.h
Header file of app driver error code.
app_drv_config.h
Header file of app driver config code.