app_i2c.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file app_i2c.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_H_
53 #define _APP_I2C_H_
54 
55 #include "grx_hal.h"
56 #include "app_io.h"
57 #include "app_dma.h"
58 #include "app_drv_error.h"
59 #include "app_drv_config.h"
60 #include <stdint.h>
61 #include <stdbool.h>
62 #include <stdio.h>
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 #ifdef HAL_I2C_MODULE_ENABLED
69 
70 /** @addtogroup APP_I2C_ENUM Enumerations
71  * @{
72  */
73 
74 /**
75  * @brief I2C module Enumerations definition
76  */
77 typedef enum
78 {
79  APP_I2C_ID_0, /**< I2C module 0. */
80 #if (I2C_INSTANCE_MAX > 1)
81  APP_I2C_ID_1, /**< I2C module 1. */
82 #endif
83 #if (I2C_INSTANCE_MAX > 2)
84  APP_I2C_ID_2, /**< I2C module 2. */
85 #endif
86 #if (I2C_INSTANCE_MAX > 3)
87  APP_I2C_ID_3, /**< I2C module 3. */
88 #endif
89 #if (I2C_INSTANCE_MAX > 4)
90  APP_I2C_ID_4, /**< I2C module 4. */
91 #endif
92 #if (I2C_INSTANCE_MAX > 5)
93  APP_I2C_ID_5, /**< I2C module 5. */
94 #endif
95  APP_I2C_ID_MAX /**< Only for check parameter, not used as input parameters. */
97 
98 /**
99  * @brief I2C role Enumerations definition
100  */
101 typedef enum
102 {
103  APP_I2C_ROLE_MASTER, /**< I2C master device. */
104  APP_I2C_ROLE_SLAVE, /**< I2C slave device. */
105  APP_I2C_ROLE_MAX, /**< Only for check parameter, not used as input parameters. */
107 
108 /**
109  * @brief I2C event Enumerations definition
110  */
111 typedef enum
112 {
113  APP_I2C_EVT_ERROR, /**< Error reported by I2C peripheral. */
114  APP_I2C_EVT_TX_CPLT, /**< Requested TX transfer completed. */
115  APP_I2C_EVT_RX_DATA, /**< Requested RX transfer completed. */
116  APP_I2C_ABORT, /**< abort reported by I2C peripheral. */
118 /** @} */
119 
120 /** @addtogroup APP_I2C_STRUCTURES Structures
121  * @{
122  */
123 /**
124  * @brief I2C pins Structures
125  */
126 typedef struct
127 {
128  app_io_type_t type; /**< Specifies the type of SPI IO. */
129  app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */
130  uint32_t pin; /**< Specifies the IO pins to be configured.
131  This parameter can be any value of @ref GR5xxx_pins. */
132  app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */
133 } app_i2c_pin_t;
134 
135 /**
136  * @brief I2C pins config Structures
137  */
138 typedef struct
139 {
140  app_i2c_pin_t scl; /**< Set the configuration of I2C SCL pin. */
141  app_i2c_pin_t sda; /**< Set the configuration of I2C SDA pin. */
143 
144 /**
145  * @brief I2C operate mode Enumerations definition
146  */
147 typedef struct
148 {
149  dma_regs_t *tx_dma_instance;/**< Specifies the TX DMA instance.*/
150  dma_regs_t *rx_dma_instance;/**< Specifies the RX DMA instance.*/
151  dma_channel_t tx_dma_channel; /**< Specifies the dma channel of I2C TX. */
152  dma_channel_t rx_dma_channel; /**< Specifies the dma channel of I2C RX. */
154 
155 /**
156  * @brief I2C event structure definition
157  */
158 typedef struct
159 {
160  app_i2c_evt_type_t type; /**< Type of event. */
161  union
162  {
163  uint32_t error_code; /**< I2C Error code. */
164  uint16_t size; /**< I2C transmitted/received counter. */
165  } data; /**< Data of event. */
166  uint16_t slave_addr; /**< I2C slave address. */
167 } app_i2c_evt_t;
168 
169 /** @} */
170 
171 /** @addtogroup APP_I2C_ENUM Enumerations
172  * @{
173  */
174 /**@brief App i2c state types. */
175 typedef enum
176 {
179 #ifdef APP_DRIVER_WAKEUP_CALL_FUN
180  APP_I2C_SLEEP,
181 #endif
183 
184 /**@brief App i2c dma state types. */
185 typedef enum
186 {
190 
191 /** @} */
192 
193 /** @addtogroup APP_I2C_TYPEDEFS Type definitions
194  * @{
195  */
196 /**
197  * @brief I2C event callback definition
198  */
199 typedef void (*app_i2c_evt_handler_t)(app_i2c_evt_t *p_evt);
200 
201 /** @} */
202 
203 /** @addtogroup APP_I2C_STRUCTURES Structures
204  * @{
205  */
206 /**
207  * @brief I2C device structure definition
208  */
209 typedef struct
210 {
211  app_i2c_evt_handler_t evt_handler; /**< I2C event callback definition. */
212  i2c_handle_t handle; /**< I2C handle definition. */
213  app_i2c_role_t role; /**< I2C role Enumerations definition. */
214  app_i2c_pin_cfg_t *p_pin_cfg; /**< I2C pins config Structures. */
215  dma_id_t dma_id[2]; /**< DMA id definition. */
216  app_i2c_state_t i2c_state; /**< I2C state types. */
217  app_i2c_dma_state_t i2c_dma_state; /**< I2C dma state types. */
218  volatile bool start_flag; /**< Start flag definition. */
219  uint16_t slv_dev_addr; /**< I2C Slave address. */
220 } i2c_env_t;
221 
222 /**
223  * @brief I2C parameters structure definition
224  */
225 typedef struct
226 {
227  app_i2c_id_t id; /**< specified I2C module ID. */
228  app_i2c_role_t role; /**< specified the role of I2C. */
229  app_i2c_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified I2C module. */
230  app_i2c_dma_cfg_t dma_cfg; /**< I2C operate mode. */
231  i2c_init_t init; /**< I2C communication parameters. */
232  i2c_env_t i2c_dev; /**< I2C device structure definition. */
234 
235 /** @} */
236 
237 /* Exported functions --------------------------------------------------------*/
238 /** @addtogroup HAL_APP_I2C_DRIVER_FUNCTIONS Functions
239  * @{
240  */
241 /**
242  ****************************************************************************************
243  * @brief Initialize the APP I2C DRIVER according to the specified parameters
244  * in the app_i2c_params_t and app_i2c_evt_handler_t.
245  * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode
246  * is set, you can't use interrupt mode.
247  *
248  * @param[in] p_params: Pointer to app_i2c_params_t parameter which contains the
249  * configuration information for the specified I2C module.
250  * @param[in] evt_handler: I2C user callback function.
251  *
252  * @return Result of initialization.
253  ****************************************************************************************
254  */
255 uint16_t app_i2c_init(app_i2c_params_t *p_params, app_i2c_evt_handler_t evt_handler);
256 
257 /**
258  ****************************************************************************************
259  * @brief De-initialize the APP I2C DRIVER peripheral.
260  *
261  * @param[in] id: De-initialize for a specific ID.
262  *
263  * @return Result of De-initialization.
264  ****************************************************************************************
265  */
267 
268 /**
269  ****************************************************************************************
270  * @brief Receive in master or slave mode an amount of data in blocking mode.
271  *
272  * @param[in] id: which I2C module want to receive.
273  * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
274  must be shifted at right before call interface.
275  * @param[in] p_data: Pointer to data buffer
276  * @param[in] size: Amount of data to be sent
277  * @param[in] timeout: Timeout duration
278  *
279  * @return Result of operation.
280  ****************************************************************************************
281  */
282 uint16_t app_i2c_receive_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout);
283 
284 /**
285  ****************************************************************************************
286  * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
287  *
288  * @param[in] id: which I2C module want to receive.
289  * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
290  must be shifted at right before call interface.
291  * @param[in] p_data: Pointer to data buffer
292  * @param[in] size: Amount of data to be sent
293  *
294  * @return Result of operation.
295  ****************************************************************************************
296  */
297 uint16_t app_i2c_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size);
298 
299 /**
300  ****************************************************************************************
301  * @brief Transmits in master or slave mode an amount of data in blocking mode.
302  *
303  * @param[in] id: which I2C module want to transmit.
304  * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
305  must be shifted at right before call interface.
306  * @param[in] p_data: Pointer to data buffer
307  * @param[in] size: Amount of data to be sent
308  * @param[in] timeout: Timeout duration
309  *
310  * @return Result of operation.
311  ****************************************************************************************
312  */
313 uint16_t app_i2c_transmit_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout);
314 
315 /**
316  ****************************************************************************************
317  * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA.
318  *
319  * @param[in] id: which I2C module want to transmit.
320  * @param[in] target_address: Target device address: The device 7 bits address value in datasheet
321  must be shifted at right before call interface.
322  * @param[in] p_data: Pointer to data buffer
323  * @param[in] size: Amount of data to be sent
324  *
325  * @return Result of operation.
326  ****************************************************************************************
327  */
328 uint16_t app_i2c_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size);
329 
330 /**
331  ****************************************************************************************
332  * @brief Read an amount of data in blocking mode from a specific memory address
333  *
334  * @param[in] id: which I2C module want to read.
335  * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
336  * @param[in] mem_address: Internal memory address
337  * @param[in] mem_addr_size: Size of internal memory address
338  * @param[in] p_data: Pointer to data buffer
339  * @param[in] size: Amount of data to be sent
340  * @param[in] timeout: Timeout duration
341  *
342  * @return Result of operation.
343  ****************************************************************************************
344  */
345 uint16_t app_i2c_mem_read_sync(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, uint32_t timeout);
346 
347 /**
348  ****************************************************************************************
349  * @brief Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address
350  *
351  * @param[in] id: which I2C module want to read.
352  * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
353  * @param[in] mem_address: Internal memory address
354  * @param[in] mem_addr_size: Size of internal memory address
355  * @param[in] p_data: Pointer to data buffer
356  * @param[in] size: Amount of data to be sent
357  *
358  * @return Result of operation.
359  ****************************************************************************************
360  */
361 uint16_t app_i2c_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);
362 
363 /**
364  ****************************************************************************************
365  * @brief Write an amount of data in blocking mode to a specific memory address
366  *
367  * @param[in] id: which I2C module want to write.
368  * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
369  * @param[in] mem_address: Internal memory address
370  * @param[in] mem_addr_size: Size of internal memory address
371  * @param[in] p_data: Pointer to data buffer
372  * @param[in] size: Amount of data to be sent
373  * @param[in] timeout: Timeout duration
374  *
375  * @return Result of operation.
376  ****************************************************************************************
377  */
378 uint16_t app_i2c_mem_write_sync(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, uint32_t timeout);
379 
380 /**
381  ****************************************************************************************
382  * @brief Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address
383  *
384  * @param[in] id: which I2C module want to write.
385  * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
386  * @param[in] mem_address: Internal memory address
387  * @param[in] mem_addr_size: Size of internal memory address
388  * @param[in] p_data: Pointer to data buffer
389  * @param[in] size: Amount of data to be sent
390  *
391  * @return Result of operation.
392  ****************************************************************************************
393  */
394 uint16_t app_i2c_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);
395 
396 /**
397  ****************************************************************************************
398  * @brief Return the I2C handle.
399  *
400  * @param[in] id: I2C Channel ID.
401  *
402  * @return Pointer to the specified ID's I2C handle.
403  ****************************************************************************************
404  */
406 
407 /**
408  ****************************************************************************************
409  * @brief Abort a master I2C IT or DMA process communication with Interrupt
410  *
411  * @param[in] id: I2C Channel ID.
412  *
413  * @return Result of operation.
414  ****************************************************************************************
415  */
417 
418 #ifdef APP_I2C_TIMING_API_ENABLE
419 /**
420  ****************************************************************************************
421  * @brief Adjust I2C timing value to adapt to real load.
422  *
423  * @param[in] id: I2C Channel ID.
424  * @param[in] timing_type: Timing type. See I2C_Timing_type.
425  * @param[in] delta: timing change value(unit: I2C work clock cycles).
426  *
427  * @return Result of operation.
428  ****************************************************************************************
429  */
430 uint16_t app_i2c_timing_adjust(app_i2c_id_t id, uint32_t timing_type, int32_t delta);
431 
432 /**
433  ****************************************************************************************
434  * @brief Get I2C timing value.
435  *
436  * @param[in] id: I2C Channel ID.
437  * @param[in] timing_type: Timing type. See I2C_Timing_type.
438  * @param[in] p_timing_value: Pointer of I2C timing value(unit: I2C work clock cycles).
439  *
440  * @return Result of operation.
441  ****************************************************************************************
442  */
443 uint16_t app_i2c_timing_get(app_i2c_id_t id, uint32_t timing_type, uint32_t *p_timing_value);
444 #endif
445 
446 #ifdef APP_I2C_TX_RX_ARBITRARY
447 /**
448  ****************************************************************************************
449  * @brief Transmits than receives in master mode or receives than transmits in slave mode with only one stop bit.
450  *
451  * @param[in] id: which I2C module want to transmit.
452  * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet
453  must be shifted at right before call interface.
454  * @param[in] p_tdata: Pointer to transmit data buffer
455  * @param[in] tsize: Amount of data to be sent
456  * @param[in] p_rdata: Pointer to received data buffer
457  * @param[in] rsize: Amount of data to be receive
458  * @param[in] timeout: Timeout duration
459  *
460  * @return Result of operation.
461  ****************************************************************************************
462  */
463 uint16_t app_i2c_transmit_receive_sync(app_i2c_id_t id, uint16_t dev_address, uint8_t *p_tdata, uint16_t tsize, uint8_t *p_rdata, uint16_t rsize, uint32_t timeout);
464 #endif
465 
466 /** @} */
467 #endif
468 
469 #ifdef __cplusplus
470 }
471 #endif
472 
473 #endif
474 
475 /** @} */
476 
477 /** @} */
478 
479 /** @} */
480 
APP_I2C_DMA_ACTIVITY
@ APP_I2C_DMA_ACTIVITY
Definition: app_i2c.h:188
app_i2c_pin_cfg_t
I2C pins config Structures.
Definition: app_i2c.h:139
app_i2c_pin_cfg_t::sda
app_i2c_pin_t sda
Definition: app_i2c.h:141
app_i2c_state_t
app_i2c_state_t
App i2c state types.
Definition: app_i2c.h:176
app_i2c_pin_t::pin
uint32_t pin
Definition: app_i2c.h:130
APP_I2C_EVT_ERROR
@ APP_I2C_EVT_ERROR
Definition: app_i2c.h:113
app_i2c_evt_t::error_code
uint32_t error_code
Definition: app_i2c.h:163
app_i2c_params_t::dma_cfg
app_i2c_dma_cfg_t dma_cfg
Definition: app_i2c.h:230
app_i2c_receive_async
uint16_t app_i2c_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.
_i2c_init
I2C Configuration Structure definition.
Definition: hal_i2c.h:162
app_i2c_params_t::i2c_dev
i2c_env_t i2c_dev
Definition: app_i2c.h:232
APP_I2C_ROLE_MASTER
@ APP_I2C_ROLE_MASTER
Definition: app_i2c.h:103
i2c_env_t::i2c_state
app_i2c_state_t i2c_state
Definition: app_i2c.h:216
_i2c_handle
I2C handle Structure definition.
Definition: hal_i2c.h:189
app_io_pull_t
app_io_pull_t
GPIO pull Enumerations definition.
Definition: app_io.h:176
app_io_type_t
app_io_type_t
GPIO type Enumerations definition.
Definition: app_io.h:142
app_i2c_transmit_sync
uint16_t app_i2c_transmit_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
Transmits in master or slave mode an amount of data in blocking mode.
APP_I2C_INVALID
@ APP_I2C_INVALID
Definition: app_i2c.h:177
app_i2c_dma_cfg_t::rx_dma_instance
dma_regs_t * rx_dma_instance
Definition: app_i2c.h:150
app_i2c_master_abort_it
uint16_t app_i2c_master_abort_it(app_i2c_id_t id)
Abort a master I2C IT or DMA process communication with Interrupt.
app_i2c_evt_t::size
uint16_t size
Definition: app_i2c.h:164
app_i2c_deinit
uint16_t app_i2c_deinit(app_i2c_id_t id)
De-initialize the APP I2C DRIVER peripheral.
i2c_env_t
I2C device structure definition.
Definition: app_i2c.h:210
i2c_env_t::handle
i2c_handle_t handle
Definition: app_i2c.h:212
APP_I2C_DMA_INVALID
@ APP_I2C_DMA_INVALID
Definition: app_i2c.h:187
app_i2c_dma_cfg_t::rx_dma_channel
dma_channel_t rx_dma_channel
Definition: app_i2c.h:152
app_i2c_pin_t::mux
app_io_mux_t mux
Definition: app_i2c.h:129
app_i2c_dma_cfg_t::tx_dma_instance
dma_regs_t * tx_dma_instance
Definition: app_i2c.h:149
app_i2c_pin_t::type
app_io_type_t type
Definition: app_i2c.h:128
app_io.h
Header file containing functions prototypes of GPIO app library.
APP_I2C_ROLE_MAX
@ APP_I2C_ROLE_MAX
Definition: app_i2c.h:105
i2c_env_t::start_flag
volatile bool start_flag
Definition: app_i2c.h:218
app_i2c_role_t
app_i2c_role_t
I2C role Enumerations definition.
Definition: app_i2c.h:102
app_i2c_mem_read_sync
uint16_t app_i2c_mem_read_sync(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, uint32_t timeout)
Read an amount of data in blocking mode from a specific memory address.
app_i2c_params_t::id
app_i2c_id_t id
Definition: app_i2c.h:227
app_i2c_id_t
app_i2c_id_t
I2C module Enumerations definition.
Definition: app_i2c.h:78
app_i2c_pin_t
I2C pins Structures.
Definition: app_i2c.h:127
app_i2c_evt_handler_t
void(* app_i2c_evt_handler_t)(app_i2c_evt_t *p_evt)
I2C event callback definition.
Definition: app_i2c.h:199
app_i2c_dma_cfg_t
I2C operate mode Enumerations definition.
Definition: app_i2c.h:148
i2c_env_t::slv_dev_addr
uint16_t slv_dev_addr
Definition: app_i2c.h:219
app_i2c_params_t::pin_cfg
app_i2c_pin_cfg_t pin_cfg
Definition: app_i2c.h:229
app_i2c_params_t::role
app_i2c_role_t role
Definition: app_i2c.h:228
i2c_env_t::role
app_i2c_role_t role
Definition: app_i2c.h:213
app_i2c_mem_read_async
uint16_t app_i2c_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_i2c_receive_sync
uint16_t app_i2c_receive_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
Receive in master or slave mode an amount of data in blocking mode.
grx_hal.h
This file contains all the functions prototypes for the HAL module driver.
app_i2c_evt_type_t
app_i2c_evt_type_t
I2C event Enumerations definition.
Definition: app_i2c.h:112
APP_I2C_ABORT
@ APP_I2C_ABORT
Definition: app_i2c.h:116
app_i2c_evt_t
I2C event structure definition.
Definition: app_i2c.h:159
app_i2c_pin_cfg_t::scl
app_i2c_pin_t scl
Definition: app_i2c.h:140
i2c_env_t::p_pin_cfg
app_i2c_pin_cfg_t * p_pin_cfg
Definition: app_i2c.h:214
i2c_env_t::i2c_dma_state
app_i2c_dma_state_t i2c_dma_state
Definition: app_i2c.h:217
app_i2c_get_handle
i2c_handle_t * app_i2c_get_handle(app_i2c_id_t id)
Return the I2C handle.
app_dma.h
Header file containing functions prototypes of DMA app library.
app_i2c_transmit_async
uint16_t app_i2c_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_ACTIVITY
@ APP_I2C_ACTIVITY
Definition: app_i2c.h:178
app_i2c_pin_t::pull
app_io_pull_t pull
Definition: app_i2c.h:132
APP_I2C_EVT_TX_CPLT
@ APP_I2C_EVT_TX_CPLT
Definition: app_i2c.h:114
app_i2c_init
uint16_t app_i2c_init(app_i2c_params_t *p_params, app_i2c_evt_handler_t evt_handler)
Initialize the APP I2C DRIVER according to the specified parameters in the app_i2c_params_t and app_i...
app_io_mux_t
app_io_mux_t
GPIO mux Enumerations definition.
Definition: app_io.h:248
app_i2c_evt_t::slave_addr
uint16_t slave_addr
Definition: app_i2c.h:166
app_i2c_dma_cfg_t::tx_dma_channel
dma_channel_t tx_dma_channel
Definition: app_i2c.h:151
APP_I2C_EVT_RX_DATA
@ APP_I2C_EVT_RX_DATA
Definition: app_i2c.h:115
app_i2c_evt_t::type
app_i2c_evt_type_t type
Definition: app_i2c.h:160
app_i2c_params_t
I2C parameters structure definition.
Definition: app_i2c.h:226
app_drv_error.h
Header file of app driver error code.
app_drv_config.h
Header file of app driver config code.
app_i2c_params_t::init
i2c_init_t init
Definition: app_i2c.h:231
app_i2c_mem_write_sync
uint16_t app_i2c_mem_write_sync(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, uint32_t timeout)
Write an amount of data in blocking mode to a specific memory address.
app_i2c_dma_state_t
app_i2c_dma_state_t
App i2c dma state types.
Definition: app_i2c.h:186
APP_I2C_ID_0
@ APP_I2C_ID_0
Definition: app_i2c.h:79
dma_id_t
int16_t dma_id_t
DMA id definition.
Definition: app_dma.h:98
i2c_env_t::evt_handler
app_i2c_evt_handler_t evt_handler
Definition: app_i2c.h:211
app_i2c_mem_write_async
uint16_t app_i2c_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_ID_MAX
@ APP_I2C_ID_MAX
Definition: app_i2c.h:95
dma_channel_t
dma_channel_t
HAL DMA Channel Enumerations definition.
Definition: hal_dma.h:95
APP_I2C_ROLE_SLAVE
@ APP_I2C_ROLE_SLAVE
Definition: app_i2c.h:104