gr55xx_hal_i2c.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_hal_i2c.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of I2C HAL 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 HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_I2C I2C
47 * @brief I2C HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_I2C_H__
53 #define __GR55xx_HAL_I2C_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_i2c.h"
61 #include "gr55xx_hal_def.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_I2C_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_I2C_state HAL I2C state
69 * @{
70 */
71
72 /**
73 * @brief HAL I2C State Enumerations definition
74 * @note HAL I2C State value coding follow below described bitmap :\n
75 * @verbatim
76 b7-b6 Error information
77 00 : No Error
78 01 : Abort (Abort user request on going)
79 10 : Timeout
80 11 : Error
81 b5 IP initilisation status
82 0 : Reset (IP not initialized)
83 1 : init done (IP initialized and ready to use. HAL I2C init function called)
84 b4 (not used)
85 x : Should be set to 0
86 b3
87 0 : Ready or Busy (No Listen mode ongoing)
88 1 : Listen (IP in Address Listen Mode)
89 b2 Intrinsic process state
90 0 : Ready
91 1 : Busy (IP busy with some configuration or internal operations)
92 b1 Rx state
93 0 : Ready (no Rx operation ongoing)
94 1 : Busy (Rx operation ongoing)
95 b0 Tx state
96 0 : Ready (no Tx operation ongoing)
97 1 : Busy (Tx operation ongoing)
98 * @endverbatim
99 */
100 typedef enum
101 {
102 HAL_I2C_STATE_RESET = 0x00U, /**< Peripheral is not yet Initialized */
103 HAL_I2C_STATE_READY = 0x20U, /**< Peripheral Initialized and ready for use */
104 HAL_I2C_STATE_BUSY = 0x24U, /**< An internal process is ongoing */
105 HAL_I2C_STATE_BUSY_TX = 0x21U, /**< Data Transmission process is ongoing */
106 HAL_I2C_STATE_BUSY_RX = 0x22U, /**< Data Reception process is ongoing */
107 HAL_I2C_STATE_LISTEN = 0x28U, /**< Address Listen Mode is ongoing */
108 HAL_I2C_STATE_BUSY_TX_LISTEN = 0x29U, /**< Address Listen Mode and Data Transmission
109 process is ongoing */
110 HAL_I2C_STATE_BUSY_RX_LISTEN = 0x2AU, /**< Address Listen Mode and Data Reception
111 process is ongoing */
112 HAL_I2C_STATE_ABORT = 0x60U, /**< Abort user request ongoing */
113 HAL_I2C_STATE_TIMEOUT = 0xA0U, /**< Timeout state */
114 HAL_I2C_STATE_ERROR = 0xE0U /**< Error */
115
116 } hal_i2c_state_t;
117 /** @} */
118
119 /** @defgroup HAL_I2C_mode HAL I2C mode
120 * @{
121 */
122
123 /**
124 * @brief HAL I2C Mode Enumerations definition
125 * @note HAL I2C Mode value coding follow below described bitmap :\n
126 * @verbatim
127 b7 (not used)
128 x : Should be set to 0
129 b6
130 0 : None
131 1 : Memory (HAL I2C communication is in Memory Mode)
132 b5
133 0 : None
134 1 : Slave (HAL I2C communication is in Slave Mode)
135 b4
136 0 : None
137 1 : Master (HAL I2C communication is in Master Mode)
138 b3-b2-b1-b0 (not used)
139 xxxx : Should be set to 0000
140 * @endverbatim
141 */
142 typedef enum
143 {
144 HAL_I2C_MODE_NONE = 0x00U, /**< No I2C communication on going */
145 HAL_I2C_MODE_MASTER = 0x10U, /**< I2C communication is in Master Mode */
146 HAL_I2C_MODE_SLAVE = 0x20U, /**< I2C communication is in Slave Mode */
147 HAL_I2C_MODE_MEM = 0x40U /**< I2C communication is in Memory Mode */
148
149 } hal_i2c_mode_t;
150 /** @} */
151
152 /** @} */
153
154
155 /** @addtogroup HAL_I2C_STRUCTURES Structures
156 * @{
157 */
158
159 /** @defgroup I2C_Configuration I2C Configuration
160 * @{
161 */
162
163 /**
164 * @brief I2C Configuration Structure definition
165 */
166 typedef struct _i2c_init
167 {
168 uint32_t speed; /**< Specifies the I2C transfer speed.
169 This parameter can be a value of @ref I2C_Speed */
170
171 uint32_t own_address; /**< Specifies the device own address.
172 This parameter can be a 7-bit or 10-bit address. */
173
174 uint32_t addressing_mode; /**< Specifies if 7-bit or 10-bit addressing mode is selected.
175 This parameter can be a value of @ref I2C_Addressing_Mode */
176
177 uint32_t general_call_mode; /**< Specifies if general call mode is selected.
178 This parameter can be a value of @ref I2C_General_Call_Addressing_Mode */
179
180 } i2c_init_t;
181 /** @} */
182
183 /** @defgroup I2C_handle I2C handle
184 * @{
185 */
186
187 /**
188 * @brief I2C handle Structure definition
189 */
190 typedef struct _i2c_handle
191 {
192 i2c_regs_t *p_instance; /**< I2C registers base address */
193
194 i2c_init_t init; /**< I2C communication parameters */
195
196 uint8_t *p_buffer; /**< Pointer to I2C transfer buffer */
197
198 uint16_t xfer_size; /**< I2C transfer size */
199
200 __IO uint16_t xfer_count; /**< I2C transfer counter */
201
202 __IO uint16_t master_ack_count; /**< I2C master acknowledge counter in master receive progress */
203
204 __IO uint32_t xfer_options; /**< I2C sequantial transfer options, this parameter can
205 be a value of @ref I2C_XferOptions */
206
207 __IO uint32_t previous_state; /**< I2C communication Previous state */
208
209 hal_status_t(*xfer_isr)(struct _i2c_handle *p_i2c, uint32_t it_source, uint32_t abort_sources);
210 /**< I2C transfer IRQ handler function pointer */
211
212 dma_handle_t *p_dmatx; /**< I2C Tx DMA handle parameters */
213
214 dma_handle_t *p_dmarx; /**< I2C Rx DMA handle parameters */
215
216 hal_lock_t lock; /**< I2C locking object */
217
218 __IO hal_i2c_state_t state; /**< I2C communication state */
219
220 __IO hal_i2c_mode_t mode; /**< I2C communication mode */
221
222 __IO uint32_t error_code; /**< I2C Error code */
223
224 uint32_t retention[10]; /**< I2C important register information. */
225 } i2c_handle_t;
226 /** @} */
227
228 /** @} */
229
230 /** @addtogroup HAL_I2C_CALLBACK_STRUCTURES Callback Structures
231 * @{
232 */
233
234 /** @defgroup HAL_I2C_Callback Callback
235 * @{
236 */
237
238 /**
239 * @brief HAL_I2C Callback function definition
240 */
241
242 typedef struct _hal_i2c_callback
243 {
244 void (*i2c_msp_init)(i2c_handle_t *p_i2c); /**< I2C init MSP callback */
245 void (*i2c_msp_deinit)(i2c_handle_t *p_i2c); /**< I2C de-init MSP callback */
246 void (*i2c_master_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C master tx transfer completed callbac */
247 void (*i2c_master_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C master rx transfer completed callback */
248 void (*i2c_slave_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C slave tx transfer completed callback */
249 void (*i2c_slave_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C slave rx transfer completed callback */
250 void (*i2c_listen_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C listen Complete callback */
251 void (*i2c_mem_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C mem tx transfer completed callback */
252 void (*i2c_mem_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C mem rx transfer completed callback */
253 void (*i2c_error_callback)(i2c_handle_t *p_i2c); /**< I2C error callback */
254 void (*i2c_abort_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C abort completed callback */
255 } hal_i2c_callback_t;
256
257 /** @} */
258
259 /** @} */
260
261 /** @defgroup HAL_I2C_MACRO Defines
262 * @{
263 */
264
265 /* Exported constants --------------------------------------------------------*/
266 /** @defgroup I2C_Exported_Constants I2C Exported Constants
267 * @{
268 */
269
270 /** @defgroup I2C_Error_Code_definition I2C Error Code definition
271 * @{
272 */
273 #define HAL_I2C_ERROR_NONE (0x00000000U) /**< No error */
274 #define HAL_I2C_ERROR_ARB_LOST (0x00000002U) /**< Arbitration lost error */
275 #define HAL_I2C_ERROR_NOACK (0x00000004U) /**< No acknowledge error */
276 #define HAL_I2C_ERROR_OVER (0x00000008U) /**< RX_OVER error */
277 #define HAL_I2C_ERROR_DMA (0x00000010U) /**< DMA transfer error */
278 #define HAL_I2C_ERROR_TIMEOUT (0x00000020U) /**< Timeout error */
279 /** @} */
280
281 /** @defgroup I2C_Speed I2C Transfer Speed
282 * @{
283 */
284 #define I2C_SPEED_100K LL_I2C_SPEED_100K /**< Standard speed. */
285 #define I2C_SPEED_400K LL_I2C_SPEED_400K /**< Fast speed. */
286 #define I2C_SPEED_1000K LL_I2C_SPEED_1000K /**< Fast Plus speed. */
287 #define I2C_SPEED_2000K LL_I2C_SPEED_2000K /**< High speed. */
288 /** @} */
289
290 /** @defgroup I2C_Addressing_Mode I2C Addressing Mode
291 * @{
292 */
293 #define I2C_ADDRESSINGMODE_7BIT (0x00000001U) /**< 7-bit addressing mode. */
294 #define I2C_ADDRESSINGMODE_10BIT (0x00000002U) /**< 10-bit addressing mode. */
295 /** @} */
296
297 /** @defgroup I2C_General_Call_Addressing_Mode I2C General Call Addressing Mode
298 * @{
299 */
300 #define I2C_GENERALCALL_DISABLE (0x00000000U) /**< General call mode disable. */
301 #define I2C_GENERALCALL_ENABLE (0x00000001U) /**< General call mode enable. */
302 /** @} */
303
304 /** @defgroup I2C_Mmmeory_Address_Size I2C Memory Address Size
305 * @{
306 */
307 #define I2C_MEMADD_SIZE_8BIT (0x00000001U) /**< 8-bit memory address. */
308 #define I2C_MEMADD_SIZE_16BIT (0x00000002U) /**< 16-bit memory address. */
309 /** @} */
310
311 /** @defgroup I2C_XferOptions I2C Sequential Transfer Options
312 * @{
313 */
314 #define I2C_FIRST_FRAME (0x00000000U) /**< First transfer frame. */
315 #define I2C_FIRST_AND_NEXT_FRAME (0x00000001U) /**< First and next transfer frames. */
316 #define I2C_NEXT_FRAME (0x00000002U) /**< Next transfer frame. */
317 #define I2C_FIRST_AND_LAST_FRAME (0x00000003U) /**< First and last transfer frames. */
318 #define I2C_LAST_FRAME (0x00000004U) /**< Last transfer frame. */
319 /** @} */
320
321 /**
322 * @brief I2C InitStruct default configuartion
323 */
324 #define I2C_DEFAULT_CONFIG \
325 { \
326 .speed = I2C_SPEED_400K, \
327 .own_address = 0x55U, \
328 .addressing_mode = I2C_ADDRESSINGMODE_7BIT, \
329 .general_call_mode = I2C_GENERALCALL_DISABLE, \
330 }
331
332 /** @} */
333
334 /* Exported macros -----------------------------------------------------------*/
335 /** @defgroup I2C_Exported_Macros I2C Exported Macros
336 * @{
337 */
338
339 /** @brief Reset I2C handle state.
340 * @param __HANDLE__ Specifies the I2C Handle.
341 * @retval None
342 */
343 #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_I2C_STATE_RESET)
344 /** @} */
345
346 /* Private macros ------------------------------------------------------------*/
347 /** @defgroup I2C_Private_Macro I2C Private Macros
348 * @{
349 */
350
351 /**
352 * @brief Check if the I2C speed is valid.
353 * @param __SPEED__ I2C transfer speed.
354 * @retval SET (__SPEED__ is valid) or RESET (__SPEED__ is invalid)
355 */
356 #define IS_I2C_SPEED(__SPEED__) (((__SPEED__) == I2C_SPEED_100K) || \
357 ((__SPEED__) == I2C_SPEED_400K) || \
358 ((__SPEED__) == I2C_SPEED_1000K) || \
359 ((__SPEED__) == I2C_SPEED_2000K))
360
361 /**
362 * @brief Check if the I2C addressing mode is valid.
363 * @param __MODE__ I2C addressing mode.
364 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
365 */
366 #define IS_I2C_ADDRESSING_MODE(__MODE__) (((__MODE__) == I2C_ADDRESSINGMODE_7BIT) || \
367 ((__MODE__) == I2C_ADDRESSINGMODE_10BIT))
368
369 /**
370 * @brief Check if the I2C general call mode is valid.
371 * @param __CALL__ I2C general call mode.
372 * @retval SET (__CALL__ is valid) or RESET (__CALL__ is invalid)
373 */
374 #define IS_I2C_GENERAL_CALL(__CALL__) (((__CALL__) == I2C_GENERALCALL_DISABLE) || \
375 ((__CALL__) == I2C_GENERALCALL_ENABLE))
376
377 /**
378 * @brief Check if the I2C memory address size is valid.
379 * @param __SIZE__ I2C memory address size.
380 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
381 */
382 #define IS_I2C_MEMADD_SIZE(__SIZE__) (((__SIZE__) == I2C_MEMADD_SIZE_8BIT) || \
383 ((__SIZE__) == I2C_MEMADD_SIZE_16BIT))
384
385 /**
386 * @brief Check if the I2C transfer request command is valid.
387 * @param __REQUEST__ I2C transfer request command.
388 * @retval SET (__REQUEST__ is valid) or RESET (__REQUEST__ is invalid)
389 */
390 #define IS_TRANSFER_REQUEST(__REQUEST__) (((__REQUEST__) == I2C_CMD_SLV_NONE) || \
391 ((__REQUEST__) == I2C_CMD_MST_WRITE) || \
392 ((__REQUEST__) == I2C_CMD_MST_READ) || \
393 ((__REQUEST__) == I2C_CMD_MST_GEN_STOP) || \
394 ((__REQUEST__) == I2C_CMD_MST_GEN_RESTART))
395
396 /**
397 * @brief Check if the I2C transfer options request is valid.
398 * @param __REQUEST__ I2C transfer options request.
399 * @retval SET (__REQUEST__ is valid) or RESET (__REQUEST__ is invalid)
400 */
401 #define IS_I2C_TRANSFER_OPTIONS_REQUEST(__REQUEST__) (((__REQUEST__) == I2C_FIRST_FRAME) || \
402 ((__REQUEST__) == I2C_FIRST_AND_NEXT_FRAME) || \
403 ((__REQUEST__) == I2C_NEXT_FRAME) || \
404 ((__REQUEST__) == I2C_FIRST_AND_LAST_FRAME) || \
405 ((__REQUEST__) == I2C_LAST_FRAME))
406
407 /**
408 * @brief Check if the I2C slave address is valid.
409 * @param __ADDRESS__ I2C slave address.
410 * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
411 */
412 #define IS_I2C_SLV_ADDRESS(__ADDRESS__) ((__ADDRESS__) < 0x03FFU)
413
414 /**
415 * @brief Check if the I2C own address is valid.
416 * @param __ADDRESS__ I2C own address.
417 * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
418 */
419 #define IS_I2C_OWN_ADDRESS(__ADDRESS__) ((((__ADDRESS__) > 0x0007U) && ((__ADDRESS__) < 0x0078U)) || \
420 (((__ADDRESS__) > 0x007FU) && ((__ADDRESS__) < 0x03FFU)))
421
422 /**
423 * @brief Get the Most Significant 8 Bits of memory address.
424 * @param __ADDRESS__ Memory address.
425 * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
426 */
427 #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00U))) >> 8U)))
428
429 /**
430 * @brief Get the Least Significant 8 Bits of memory address.
431 * @param __ADDRESS__ Memory address.
432 * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid)
433 */
434 #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FFU))))
435
436 /** @} */
437
438 /** @} */
439
440 /* Exported functions --------------------------------------------------------*/
441 /** @addtogroup HAL_I2C_DRIVER_FUNCTIONS Functions
442 * @{
443 */
444
445 /** @addtogroup I2C_Exported_Functions_Group1 Initialization and de-initialization functions
446 * @brief Initialization and de-initialization functions
447 * @verbatim
448 ===============================================================================
449 ##### Initialization and de-initialization functions #####
450 ===============================================================================
451 [..] This subsection provides a set of functions allowing to initialize and
452 de-initialize the I2Cx peripheral:
453
454 (+) User must Implement hal_i2c_msp_init() function in which he configures
455 all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ).
456
457 (+) Call the function hal_i2c_init() to configure the selected device with
458 the selected configuration:
459 (++) Speed
460 (++) Own Address
461 (++) Addressing mode (Master, Slave)
462 (++) General call mode
463
464 (+) Call the function hal_i2c_deinit() to restore the default configuration
465 of the selected I2Cx peripheral.
466
467 @endverbatim
468 * @{
469 */
470
471 /**
472 ****************************************************************************************
473 * @brief Initializes the I2C according to the specified parameters
474 * in the i2c_init_t and initialize the associated handle.
475 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration
476 * information for the specified I2C.
477 * @retval ::HAL_OK: Operation is OK.
478 * @retval ::HAL_ERROR: Parameter error or operation not supported.
479 * @retval ::HAL_BUSY: Driver is busy.
480 * @retval ::HAL_TIMEOUT: Timeout occurred.
481 ****************************************************************************************
482 */
483 hal_status_t hal_i2c_init(i2c_handle_t *p_i2c);
484
485 /**
486 ****************************************************************************************
487 * @brief De-initialize the I2C peripheral.
488 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
489 * @retval ::HAL_OK: Operation is OK.
490 * @retval ::HAL_ERROR: Parameter error or operation not supported.
491 * @retval ::HAL_BUSY: Driver is busy.
492 * @retval ::HAL_TIMEOUT: Timeout occurred.
493 ****************************************************************************************
494 */
495 hal_status_t hal_i2c_deinit(i2c_handle_t *p_i2c);
496
497 /**
498 ****************************************************************************************
499 * @brief Initialize the I2C MSP.
500 * @note This function should not be modified. When the callback is needed,
501 * the hal_i2c_msp_init could be implemented in the user file.
502 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
503 ****************************************************************************************
504 */
505 void hal_i2c_msp_init(i2c_handle_t *p_i2c);
506
507 /**
508 ****************************************************************************************
509 * @brief De-initialize the I2C MSP.
510 * @note This function should not be modified. When the callback is needed,
511 * the hal_i2c_msp_deinit could be implemented in the user file.
512 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
513 ****************************************************************************************
514 */
515 void hal_i2c_msp_deinit(i2c_handle_t *p_i2c);
516
517 /** @} */
518
519 /** @addtogroup I2C_Exported_Functions_Group2 IO operation functions
520 * @brief Data transfers functions
521 *
522 @verbatim
523 ===============================================================================
524 ##### IO operation functions #####
525 ===============================================================================
526 [..]
527 This subsection provides a set of functions allowing to manage the I2C data
528 transfers.
529
530 (#) There are two modes of transfer:
531 (++) Blocking mode: The communication is performed in the polling mode.
532 The status of all data processing is returned by the same function
533 after finishing transfer.
534 (++) No-Blocking mode: The communication is performed using Interrupts
535 or DMA. These functions return the status of the transfer startup.
536 The end of the data processing will be indicated through the
537 dedicated I2C IRQ when using Interrupt mode or the DMA IRQ when
538 using DMA mode.
539
540 (#) Blocking mode functions are :
541 (++) hal_i2c_master_transmit()
542 (++) hal_i2c_master_receive()
543 (++) hal_i2c_slave_transmit()
544 (++) hal_i2c_slave_receive()
545 (++) hal_i2c_mem_write()
546 (++) hal_i2c_mem_read()
547 (++) hal_i2c_is_device_ready()
548
549 (#) No-Blocking mode functions with Interrupt are :
550 (++) hal_i2c_master_transmit_it()
551 (++) hal_i2c_master_receive_it()
552 (++) hal_i2c_slave_transmit_it()
553 (++) hal_i2c_slave_receive_it()
554 (++) hal_i2c_mem_write_it()
555 (++) hal_i2c_mem_read_it()
556
557 (#) No-Blocking mode functions with DMA are :
558 (++) hal_i2c_master_transmit_dma()
559 (++) hal_i2c_master_recevice_dma()
560 (++) hal_i2c_slave_transmit_dma()
561 (++) hal_i2c_slave_receive_dma()
562 (++) hal_i2c_mem_write_dma()
563 (++) hal_i2c_mem_read_dma()
564
565 (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
566 (++) hal_i2c_mem_tx_cplt_callback()
567 (++) hal_i2c_mem_rx_cplt_callback()
568 (++) hal_i2c_master_tx_cplt_callback()
569 (++) hal_i2c_master_rx_cplt_callback()
570 (++) hal_i2c_slave_tx_cplt_callback()
571 (++) hal_i2c_slave_rx_cplt_callback()()
572 (++) hal_i2c_error_callback()
573
574 @endverbatim
575 * @{
576 */
577
578 /******* Blocking mode: Polling */
579
580 /**
581 ****************************************************************************************
582 * @brief Transmits in master mode an amount of data in blocking mode.
583 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
584 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
585 * @param[in] p_data: Pointer to data buffer
586 * @param[in] size: Amount of data to be sent
587 * @param[in] timeout: Timeout duration
588 * @retval ::HAL_OK: Operation is OK.
589 * @retval ::HAL_ERROR: Parameter error or operation not supported.
590 * @retval ::HAL_BUSY: Driver is busy.
591 * @retval ::HAL_TIMEOUT: Timeout occurred.
592 ****************************************************************************************
593 */
594 hal_status_t hal_i2c_master_transmit(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout);
595
596 /**
597 ****************************************************************************************
598 * @brief Receives in master mode an amount of data in blocking mode.
599 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
600 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
601 * @param[in] p_data: Pointer to data buffer
602 * @param[in] size: Amount of data to be sent
603 * @param[in] timeout: Timeout duration
604 * @retval ::HAL_OK: Operation is OK.
605 * @retval ::HAL_ERROR: Parameter error or operation not supported.
606 * @retval ::HAL_BUSY: Driver is busy.
607 * @retval ::HAL_TIMEOUT: Timeout occurred.
608 * @note This function will return HAL_OK even if the length of data sent by slave is
609 * less than the expected Size.
610 ****************************************************************************************
611 */
612 hal_status_t hal_i2c_master_receive(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout);
613
614 /**
615 ****************************************************************************************
616 * @brief Transmits in slave mode an amount of data in blocking mode.
617 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
618 * @param[in] p_data: Pointer to data buffer
619 * @param[in] size: Amount of data to be sent
620 * @param[in] timeout: Timeout duration
621 * @retval ::HAL_OK: Operation is OK.
622 * @retval ::HAL_ERROR: Parameter error or operation not supported.
623 * @retval ::HAL_BUSY: Driver is busy.
624 * @retval ::HAL_TIMEOUT: Timeout occurred.
625 ****************************************************************************************
626 */
627 hal_status_t hal_i2c_slave_transmit(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout);
628
629 /**
630 ****************************************************************************************
631 * @brief Receive in slave mode an amount of data in blocking mode
632 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
633 * @param[in] p_data: Pointer to data buffer
634 * @param[in] size: Amount of data to be sent
635 * @param[in] timeout: Timeout duration
636 * @retval ::HAL_OK: Operation is OK.
637 * @retval ::HAL_ERROR: Parameter error or operation not supported.
638 * @retval ::HAL_BUSY: Driver is busy.
639 * @retval ::HAL_TIMEOUT: Timeout occurred.
640 ****************************************************************************************
641 */
642 hal_status_t hal_i2c_slave_receive(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout);
643
644 /**
645 ****************************************************************************************
646 * @brief Write an amount of data in blocking mode to a specific memory address
647 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
648 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
649 * @param[in] mem_address: Internal memory address
650 * @param[in] mem_addr_size: Size of internal memory address
651 * @param[in] p_data: Pointer to data buffer
652 * @param[in] size: Amount of data to be sent
653 * @param[in] timeout: Timeout duration
654 * @retval ::HAL_OK: Operation is OK.
655 * @retval ::HAL_ERROR: Parameter error or operation not supported.
656 * @retval ::HAL_BUSY: Driver is busy.
657 * @retval ::HAL_TIMEOUT: Timeout occurred.
658 ****************************************************************************************
659 */
660 hal_status_t hal_i2c_mem_write(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout);
661
662 /**
663 ****************************************************************************************
664 * @brief Read an amount of data in blocking mode from a specific memory address
665 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
666 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
667 * @param[in] mem_address: Internal memory address
668 * @param[in] mem_addr_size: Size of internal memory address
669 * @param[in] p_data: Pointer to data buffer
670 * @param[in] size: Amount of data to be sent
671 * @param[in] timeout: Timeout duration
672 * @retval ::HAL_OK: Operation is OK.
673 * @retval ::HAL_ERROR: Parameter error or operation not supported.
674 * @retval ::HAL_BUSY: Driver is busy.
675 * @retval ::HAL_TIMEOUT: Timeout occurred.
676 ****************************************************************************************
677 */
678 hal_status_t hal_i2c_mem_read(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout);
679
680 /******* Non-Blocking mode: Interrupt */
681
682 /**
683 ****************************************************************************************
684 * @brief Transmit in master mode an amount of data in non-blocking mode with Interrupt
685 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
686 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
687 * @param[in] p_data: Pointer to data buffer
688 * @param[in] size: Amount of data to be sent
689 * @retval ::HAL_OK: Operation is OK.
690 * @retval ::HAL_ERROR: Parameter error or operation not supported.
691 * @retval ::HAL_BUSY: Driver is busy.
692 * @retval ::HAL_TIMEOUT: Timeout occurred.
693 ****************************************************************************************
694 */
695 hal_status_t hal_i2c_master_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size);
696
697 /**
698 ****************************************************************************************
699 * @brief Receive in master mode an amount of data in non-blocking mode with Interrupt
700 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
701 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
702 * @param[in] p_data: Pointer to data buffer
703 * @param[in] size: Amount of data to be sent
704 * @retval ::HAL_OK: Operation is OK.
705 * @retval ::HAL_ERROR: Parameter error or operation not supported.
706 * @retval ::HAL_BUSY: Driver is busy.
707 * @retval ::HAL_TIMEOUT: Timeout occurred.
708 ****************************************************************************************
709 */
710 hal_status_t hal_i2c_master_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size);
711
712 /**
713 ****************************************************************************************
714 * @brief Transmit in slave mode an amount of data in non-blocking mode with Interrupt
715 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
716 * @param[in] p_data: Pointer to data buffer
717 * @param[in] size: Amount of data to be sent
718 * @retval ::HAL_OK: Operation is OK.
719 * @retval ::HAL_ERROR: Parameter error or operation not supported.
720 * @retval ::HAL_BUSY: Driver is busy.
721 * @retval ::HAL_TIMEOUT: Timeout occurred.
722 ****************************************************************************************
723 */
724 hal_status_t hal_i2c_slave_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
725
726 /**
727 ****************************************************************************************
728 * @brief Receive in slave mode an amount of data in non-blocking mode with Interrupt
729 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
730 * @param[in] p_data: Pointer to data buffer
731 * @param[in] size: Amount of data to be sent
732 * @retval ::HAL_OK: Operation is OK.
733 * @retval ::HAL_ERROR: Parameter error or operation not supported.
734 * @retval ::HAL_BUSY: Driver is busy.
735 * @retval ::HAL_TIMEOUT: Timeout occurred.
736 ****************************************************************************************
737 */
738 hal_status_t hal_i2c_slave_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
739
740 /**
741 ****************************************************************************************
742 * @brief Write an amount of data in non-blocking mode with Interrupt to a specific memory address
743 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
744 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
745 * @param[in] mem_address: Internal memory address
746 * @param[in] mem_addr_size: Size of internal memory address
747 * @param[in] p_data: Pointer to data buffer
748 * @param[in] size: Amount of data to be sent
749 * @retval ::HAL_OK: Operation is OK.
750 * @retval ::HAL_ERROR: Parameter error or operation not supported.
751 * @retval ::HAL_BUSY: Driver is busy.
752 * @retval ::HAL_TIMEOUT: Timeout occurred.
753 ****************************************************************************************
754 */
755 hal_status_t hal_i2c_mem_write_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
756
757 /**
758 ****************************************************************************************
759 * @brief Read an amount of data in non-blocking mode with Interrupt from a specific memory address
760 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
761 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
762 * @param[in] mem_address: Internal memory address
763 * @param[in] mem_addr_size: Size of internal memory address
764 * @param[in] p_data: Pointer to data buffer
765 * @param[in] size: Amount of data to be sent
766 * @retval ::HAL_OK: Operation is OK.
767 * @retval ::HAL_ERROR: Parameter error or operation not supported.
768 * @retval ::HAL_BUSY: Driver is busy.
769 * @retval ::HAL_TIMEOUT: Timeout occurred.
770 ****************************************************************************************
771 */
772 hal_status_t hal_i2c_mem_read_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
773
774 /**
775 ****************************************************************************************
776 * @brief Sequentially transmit in master I2C mode an amount of data in non-blocking mode with Interrupt.
777 * @note This interface allows to manage repeated start condition when a direction changes during transfer
778 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
779 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
780 * @param[in] p_data: Pointer to data buffer
781 * @param[in] size: Amount of data to be sent
782 * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions
783 * @retval ::HAL_OK: Operation is OK.
784 * @retval ::HAL_ERROR: Parameter error or operation not supported.
785 * @retval ::HAL_BUSY: Driver is busy.
786 * @retval ::HAL_TIMEOUT: Timeout occurred.
787 ****************************************************************************************
788 */
789 hal_status_t hal_i2c_master_sequential_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options);
790
791 /**
792 ****************************************************************************************
793 * @brief Sequentially receive in master I2C mode an amount of data in non-blocking mode with Interrupt
794 * @note This interface allows to manage repeated start condition when a direction changes during transfer
795 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
796 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
797 * @param[in] p_data: Pointer to data buffer
798 * @param[in] size: Amount of data to be sent
799 * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions
800 * @retval ::HAL_OK: Operation is OK.
801 * @retval ::HAL_ERROR: Parameter error or operation not supported.
802 * @retval ::HAL_BUSY: Driver is busy.
803 * @retval ::HAL_TIMEOUT: Timeout occurred.
804 ****************************************************************************************
805 */
806 hal_status_t hal_i2c_master_sequential_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options);
807
808 /**
809 ****************************************************************************************
810 * @brief Sequential transmit in slave/device I2C mode an amount of data in non-blocking mode with Interrupt
811 * @note This interface allow to manage repeated start condition when a direction change during transfer
812 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
813 * @param[in] p_data: Pointer to data buffer
814 * @param[in] size: Amount of data to be sent
815 * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions
816 * @retval ::HAL_OK: Operation is OK.
817 * @retval ::HAL_ERROR: Parameter error or operation not supported.
818 * @retval ::HAL_BUSY: Driver is busy.
819 * @retval ::HAL_TIMEOUT: Timeout occurred.
820 ****************************************************************************************
821 */
822 hal_status_t hal_i2c_slave_sequential_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options);
823
824 /**
825 ****************************************************************************************
826 * @brief Sequential receive in slave/device I2C mode an amount of data in non-blocking mode with Interrupt
827 * @note This interface allow to manage repeated start condition when a direction change during transfer
828 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
829 * @param[in] p_data: Pointer to data buffer
830 * @param[in] size: Amount of data to be sent
831 * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions
832 * @retval ::HAL_OK: Operation is OK.
833 * @retval ::HAL_ERROR: Parameter error or operation not supported.
834 * @retval ::HAL_BUSY: Driver is busy.
835 * @retval ::HAL_TIMEOUT: Timeout occurred.
836 ****************************************************************************************
837 */
838 hal_status_t hal_i2c_slave_sequential_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options);
839
840 /**
841 ****************************************************************************************
842 * @brief Enable the Master Read Request listen mode with Interrupt.
843 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
844 * @retval ::HAL_OK: Operation is OK.
845 * @retval ::HAL_ERROR: Parameter error or operation not supported.
846 * @retval ::HAL_BUSY: Driver is busy.
847 * @retval ::HAL_TIMEOUT: Timeout occurred.
848 ****************************************************************************************
849 */
850 hal_status_t hal_i2c_enable_listen_it(i2c_handle_t *p_i2c);
851
852 /**
853 ****************************************************************************************
854 * @brief Disable the Master Read Request listen mode with Interrupt.
855 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
856 * @retval ::HAL_OK: Operation is OK.
857 * @retval ::HAL_ERROR: Parameter error or operation not supported.
858 * @retval ::HAL_BUSY: Driver is busy.
859 * @retval ::HAL_TIMEOUT: Timeout occurred.
860 ****************************************************************************************
861 */
862 hal_status_t hal_i2c_disable_listen_it(i2c_handle_t *p_i2c);
863
864 /**
865 ****************************************************************************************
866 * @brief Abort a master I2C IT or DMA process communication with Interrupt.
867 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
868 * @retval ::HAL_OK: Operation is OK.
869 * @retval ::HAL_ERROR: Parameter error or operation not supported.
870 * @retval ::HAL_BUSY: Driver is busy.
871 * @retval ::HAL_TIMEOUT: Timeout occurred.
872 ****************************************************************************************
873 */
874 hal_status_t hal_i2c_master_abort_it(i2c_handle_t *p_i2c);
875
876 /******* Non-Blocking mode: DMA */
877
878 /**
879 ****************************************************************************************
880 * @brief Transmit in master mode an amount of data in non-blocking mode with DMA
881 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
882 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
883 * @param[in] p_data: Pointer to data buffer
884 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
885 * @retval ::HAL_OK: Operation is OK.
886 * @retval ::HAL_ERROR: Parameter error or operation not supported.
887 * @retval ::HAL_BUSY: Driver is busy.
888 * @retval ::HAL_TIMEOUT: Timeout occurred.
889 ****************************************************************************************
890 */
891 hal_status_t hal_i2c_master_transmit_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size);
892
893 /**
894 ****************************************************************************************
895 * @brief Receive in master mode an amount of data in non-blocking mode with DMA
896 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
897 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface.
898 * @param[in] p_data: Pointer to data buffer
899 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
900 * @retval ::HAL_OK: Operation is OK.
901 * @retval ::HAL_ERROR: Parameter error or operation not supported.
902 * @retval ::HAL_BUSY: Driver is busy.
903 * @retval ::HAL_TIMEOUT: Timeout occurred.
904 ****************************************************************************************
905 */
906 hal_status_t hal_i2c_master_receive_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size);
907
908 /**
909 ****************************************************************************************
910 * @brief Transmit in slave mode an amount of data in non-blocking mode with DMA
911 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
912 * @param[in] p_data: Pointer to data buffer
913 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
914 * @retval ::HAL_OK: Operation is OK.
915 * @retval ::HAL_ERROR: Parameter error or operation not supported.
916 * @retval ::HAL_BUSY: Driver is busy.
917 * @retval ::HAL_TIMEOUT: Timeout occurred.
918 ****************************************************************************************
919 */
920 hal_status_t hal_i2c_slave_transmit_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
921
922 /**
923 ****************************************************************************************
924 * @brief Receive in slave mode an amount of data in non-blocking mode with DMA
925 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
926 * @param[in] p_data: Pointer to data buffer
927 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
928 * @retval ::HAL_OK: Operation is OK.
929 * @retval ::HAL_ERROR: Parameter error or operation not supported.
930 * @retval ::HAL_BUSY: Driver is busy.
931 * @retval ::HAL_TIMEOUT: Timeout occurred.
932 ****************************************************************************************
933 */
934 hal_status_t hal_i2c_slave_receive_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
935
936 /**
937 ****************************************************************************************
938 * @brief Write an amount of data in non-blocking mode with DMA to a specific memory address
939 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
940 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
941 * @param[in] mem_address: Internal memory address
942 * @param[in] mem_addr_size: Size of internal memory address
943 * @param[in] p_data: Pointer to data buffer
944 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
945 * @retval ::HAL_OK: Operation is OK.
946 * @retval ::HAL_ERROR: Parameter error or operation not supported.
947 * @retval ::HAL_BUSY: Driver is busy.
948 * @retval ::HAL_TIMEOUT: Timeout occurred.
949 ****************************************************************************************
950 */
951 hal_status_t hal_i2c_mem_write_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
952
953 /**
954 ****************************************************************************************
955 * @brief Reads an amount of data in non-blocking mode with DMA from a specific memory address.
956 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
957 * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface
958 * @param[in] mem_address: Internal memory address
959 * @param[in] mem_addr_size: Size of internal memory address
960 * @param[in] p_data: Pointer to data buffer
961 * @param[in] size: Amount of data to be sent, ranging between 0 and 4095.
962 * @retval ::HAL_OK: Operation is OK.
963 * @retval ::HAL_ERROR: Parameter error or operation not supported.
964 * @retval ::HAL_BUSY: Driver is busy.
965 * @retval ::HAL_TIMEOUT: Timeout occurred.
966 ****************************************************************************************
967 */
968 hal_status_t hal_i2c_mem_read_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size);
969
970 /** @} */
971
972 /** @addtogroup I2C_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
973 * @brief IRQ Handler and Callbacks functions
974 * @{
975 */
976
977 /**
978 ****************************************************************************************
979 * @brief This function handles I2C event interrupt request.
980 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
981 ****************************************************************************************
982 */
983 void hal_i2c_irq_handler(i2c_handle_t *p_i2c);
984
985 /**
986 ****************************************************************************************
987 * @brief Master Tx Transfer completed callback.
988 * @note This function should not be modified. When the callback is needed,
989 * the hal_i2c_master_tx_cplt_callback can be implemented in the user file
990 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
991 ****************************************************************************************
992 */
993 void hal_i2c_master_tx_cplt_callback(i2c_handle_t *p_i2c);
994
995 /**
996 ****************************************************************************************
997 * @brief Master Rx Transfer completed callback.
998 * @note This function should not be modified. When the callback is needed,
999 * the hal_i2c_master_rx_cplt_callback can be implemented in the user file
1000 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1001 ****************************************************************************************
1002 */
1003 void hal_i2c_master_rx_cplt_callback(i2c_handle_t *p_i2c);
1004
1005 /**
1006 ****************************************************************************************
1007 * @brief Slave Tx Transfer completed callback.
1008 * @note This function should not be modified. When the callback is needed,
1009 * the hal_i2c_slave_tx_cplt_callback can be implemented in the user file
1010 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1011 ****************************************************************************************
1012 */
1013 void hal_i2c_slave_tx_cplt_callback(i2c_handle_t *p_i2c);
1014
1015 /**
1016 ****************************************************************************************
1017 * @brief Slave Rx Transfer completed callback.
1018 * @note This function should not be modified. When the callback is needed,
1019 * the hal_i2c_slave_rx_cplt_callback can be implemented in the user file
1020 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1021 ****************************************************************************************
1022 */
1023 void hal_i2c_slave_rx_cplt_callback(i2c_handle_t *p_i2c);
1024
1025 /**
1026 ****************************************************************************************
1027 * @brief Memory Tx Transfer completed callback.
1028 * @note This function should not be modified. When the callback is needed,
1029 * the hal_i2c_mem_tx_cplt_callback can be implemented in the user file
1030 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1031 ****************************************************************************************
1032 */
1033 void hal_i2c_mem_tx_cplt_callback(i2c_handle_t *p_i2c);
1034
1035 /**
1036 ****************************************************************************************
1037 * @brief Memory Rx Transfer completed callback.
1038 * @note This function should not be modified. When the callback is needed,
1039 * the hal_i2c_mem_rx_cplt_callback can be implemented in the user file
1040 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1041 ****************************************************************************************
1042 */
1043 void hal_i2c_mem_rx_cplt_callback(i2c_handle_t *p_i2c);
1044
1045 /**
1046 ****************************************************************************************
1047 * @brief Listen Complete callback.
1048 * @note This function should not be modified. When the callback is needed,
1049 * the hal_i2c_listen_cplt_callback can be implemented in the user file
1050 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1051 ****************************************************************************************
1052 */
1053 void hal_i2c_listen_cplt_callback(i2c_handle_t *p_i2c);
1054
1055 /**
1056 ****************************************************************************************
1057 * @brief I2C error callback.
1058 * @note This function should not be modified. When the callback is needed,
1059 * the hal_i2c_error_callback can be implemented in the user file
1060 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1061 ****************************************************************************************
1062 */
1063 void hal_i2c_error_callback(i2c_handle_t *p_i2c);
1064
1065 /**
1066 ****************************************************************************************
1067 * @brief I2C abort callback.
1068 * @note This function should not be modified. When the callback is needed,
1069 * the hal_i2c_abort_cplt_callback can be implemented in the user file
1070 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1071 ****************************************************************************************
1072 */
1073 void hal_i2c_abort_cplt_callback(i2c_handle_t *p_i2c);
1074
1075 /** @} */
1076
1077 /** @addtogroup I2C_Exported_Functions_Group3 Peripheral State, Mode and Error functions
1078 * @brief Peripheral State, Mode and Error functions
1079 *
1080 @verbatim
1081 ===============================================================================
1082 ##### Peripheral State, Mode and Error functions #####
1083 ===============================================================================
1084 [..]
1085 This subsection permit to get in run-time the status of the peripheral
1086 and the data flow.
1087
1088 @endverbatim
1089 * @{
1090 */
1091
1092 /**
1093 ****************************************************************************************
1094 * @brief Return the I2C handle state.
1095 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1096 * @retval ::HAL_I2C_STATE_RESET: Peripheral is not yet Initialized.
1097 * @retval ::HAL_I2C_STATE_READY: Peripheral Initialized and ready for use.
1098 * @retval ::HAL_I2C_STATE_BUSY: An internal process is ongoing.
1099 * @retval ::HAL_I2C_STATE_BUSY_TX: Data Transmission process is ongoing.
1100 * @retval ::HAL_I2C_STATE_BUSY_RX: Data Reception process is ongoing.
1101 * @retval ::HAL_I2C_STATE_LISTEN: Address Listen Mode is ongoing.
1102 * @retval ::HAL_I2C_STATE_BUSY_TX_LISTEN: Address Listen Mode and Data Transmission process is ongoing.
1103 * @retval ::HAL_I2C_STATE_BUSY_RX_LISTEN: Address Listen Mode and Data Reception process is ongoing.
1104 * @retval ::HAL_I2C_STATE_ABORT: Abort user request ongoing.
1105 * @retval ::HAL_I2C_STATE_TIMEOUT: Timeout state.
1106 * @retval ::HAL_I2C_STATE_ERROR: Error.
1107 ****************************************************************************************
1108 */
1109 hal_i2c_state_t hal_i2c_get_state(i2c_handle_t *p_i2c);
1110
1111 /**
1112 ****************************************************************************************
1113 * @brief Returns the I2C Master, Slave, Memory or no mode.
1114 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1115 * @retval ::HAL_I2C_MODE_NONE: No I2C communication on going.
1116 * @retval ::HAL_I2C_MODE_MASTER: I2C communication is in Master Mode.
1117 * @retval ::HAL_I2C_MODE_SLAVE: I2C communication is in Slave Mode.
1118 * @retval ::HAL_I2C_MODE_MEM: I2C communication is in Memory Mode.
1119 ****************************************************************************************
1120 */
1121 hal_i2c_mode_t hal_i2c_get_mode(i2c_handle_t *p_i2c);
1122
1123 /**
1124 ****************************************************************************************
1125 * @brief Return the I2C error code.
1126 * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C.
1127 * @return I2C Error Code
1128 ****************************************************************************************
1129 */
1130 uint32_t hal_i2c_get_error(i2c_handle_t *p_i2c);
1131
1132 /**
1133 ****************************************************************************************
1134 * @brief Suspend some registers related to I2C configuration before sleep.
1135 * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration
1136 * information for the specified I2C module.
1137 * @retval ::HAL_OK: Operation is OK.
1138 * @retval ::HAL_ERROR: Parameter error or operation not supported.
1139 * @retval ::HAL_BUSY: Driver is busy.
1140 * @retval ::HAL_TIMEOUT: Timeout occurred.
1141 ****************************************************************************************
1142 */
1143 hal_status_t hal_i2c_suspend_reg(i2c_handle_t *p_i2c);
1144
1145 /**
1146 ****************************************************************************************
1147 * @brief Restore some registers related to I2C configuration after sleep.
1148 * This function must be used in conjunction with the hal_i2c_suspend_reg().
1149 * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration
1150 * information for the specified I2C module.
1151 * @retval ::HAL_OK: Operation is OK.
1152 * @retval ::HAL_ERROR: Parameter error or operation not supported.
1153 * @retval ::HAL_BUSY: Driver is busy.
1154 * @retval ::HAL_TIMEOUT: Timeout occurred.
1155 ****************************************************************************************
1156 */
1157 hal_status_t hal_i2c_resume_reg(i2c_handle_t *p_i2c);
1158
1159
1160 /** @} */
1161
1162 /** @} */
1163
1164 #ifdef __cplusplus
1165 }
1166 #endif
1167
1168 #endif /* __GR55xx_HAL_I2C_H__ */
1169
1170 /** @} */
1171
1172 /** @} */
1173
1174 /** @} */
_hal_i2c_callback::i2c_mem_tx_cplt_callback
void(* i2c_mem_tx_cplt_callback)(i2c_handle_t *p_i2c)
I2C mem tx transfer completed callback
Definition: gr55xx_hal_i2c.h:251
hal_i2c_slave_sequential_receive_it
hal_status_t hal_i2c_slave_sequential_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options)
Sequential receive in slave/device I2C mode an amount of data in non-blocking mode with Interrupt.
_hal_i2c_callback::i2c_msp_init
void(* i2c_msp_init)(i2c_handle_t *p_i2c)
I2C init MSP callback
Definition: gr55xx_hal_i2c.h:244
_hal_i2c_callback::i2c_slave_tx_cplt_callback
void(* i2c_slave_tx_cplt_callback)(i2c_handle_t *p_i2c)
I2C slave tx transfer completed callback
Definition: gr55xx_hal_i2c.h:248
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
hal_i2c_mem_read_it
hal_status_t hal_i2c_mem_read_it(i2c_handle_t *p_i2c, 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 from a specific memory address.
gr55xx_ll_i2c.h
Header file containing functions prototypes of I2C LL library.
hal_i2c_deinit
hal_status_t hal_i2c_deinit(i2c_handle_t *p_i2c)
De-initialize the I2C peripheral.
hal_i2c_listen_cplt_callback
void hal_i2c_listen_cplt_callback(i2c_handle_t *p_i2c)
Listen Complete callback.
hal_i2c_master_sequential_receive_it
hal_status_t hal_i2c_master_sequential_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options)
Sequentially receive in master I2C mode an amount of data in non-blocking mode with Interrupt.
HAL_I2C_MODE_SLAVE
@ HAL_I2C_MODE_SLAVE
I2C communication is in Slave Mode
Definition: gr55xx_hal_i2c.h:146
hal_i2c_get_error
uint32_t hal_i2c_get_error(i2c_handle_t *p_i2c)
Return the I2C error code.
hal_i2c_master_receive_dma
hal_status_t hal_i2c_master_receive_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size)
Receive in master mode an amount of data in non-blocking mode with DMA.
HAL_I2C_MODE_MEM
@ HAL_I2C_MODE_MEM
I2C communication is in Memory Mode
Definition: gr55xx_hal_i2c.h:147
HAL_I2C_STATE_READY
@ HAL_I2C_STATE_READY
Peripheral Initialized and ready for use
Definition: gr55xx_hal_i2c.h:103
hal_i2c_init
hal_status_t hal_i2c_init(i2c_handle_t *p_i2c)
Initializes the I2C according to the specified parameters in the i2c_init_t and initialize the associ...
_i2c_handle::xfer_size
uint16_t xfer_size
I2C transfer size
Definition: gr55xx_hal_i2c.h:198
_i2c_handle::init
i2c_init_t init
I2C communication parameters
Definition: gr55xx_hal_i2c.h:194
_i2c_handle::xfer_isr
hal_status_t(* xfer_isr)(struct _i2c_handle *p_i2c, uint32_t it_source, uint32_t abort_sources)
I2C transfer IRQ handler function pointer
Definition: gr55xx_hal_i2c.h:209
hal_i2c_slave_receive_it
hal_status_t hal_i2c_slave_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size)
Receive in slave mode an amount of data in non-blocking mode with Interrupt.
hal_i2c_master_receive
hal_status_t hal_i2c_master_receive(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
Receives in master mode an amount of data in blocking mode.
HAL_I2C_STATE_RESET
@ HAL_I2C_STATE_RESET
Peripheral is not yet Initialized
Definition: gr55xx_hal_i2c.h:102
hal_i2c_master_tx_cplt_callback
void hal_i2c_master_tx_cplt_callback(i2c_handle_t *p_i2c)
Master Tx Transfer completed callback.
_i2c_init::own_address
uint32_t own_address
Specifies the device own address.
Definition: gr55xx_hal_i2c.h:171
_i2c_handle::p_dmarx
dma_handle_t * p_dmarx
I2C Rx DMA handle parameters
Definition: gr55xx_hal_i2c.h:214
_i2c_init
I2C Configuration Structure definition.
Definition: gr55xx_hal_i2c.h:167
HAL_I2C_STATE_BUSY_TX_LISTEN
@ HAL_I2C_STATE_BUSY_TX_LISTEN
Address Listen Mode and Data Transmission process is ongoing
Definition: gr55xx_hal_i2c.h:108
hal_i2c_callback_t
struct _hal_i2c_callback hal_i2c_callback_t
HAL_I2C Callback function definition.
HAL_I2C_STATE_BUSY_RX_LISTEN
@ HAL_I2C_STATE_BUSY_RX_LISTEN
Address Listen Mode and Data Reception process is ongoing
Definition: gr55xx_hal_i2c.h:110
_hal_i2c_callback::i2c_mem_rx_cplt_callback
void(* i2c_mem_rx_cplt_callback)(i2c_handle_t *p_i2c)
I2C mem rx transfer completed callback
Definition: gr55xx_hal_i2c.h:252
hal_i2c_slave_receive_dma
hal_status_t hal_i2c_slave_receive_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size)
Receive in slave mode an amount of data in non-blocking mode with DMA.
_i2c_handle
I2C handle Structure definition.
Definition: gr55xx_hal_i2c.h:191
_i2c_handle::previous_state
__IO uint32_t previous_state
I2C communication Previous state
Definition: gr55xx_hal_i2c.h:207
hal_i2c_mem_write_it
hal_status_t hal_i2c_mem_write_it(i2c_handle_t *p_i2c, 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 to a specific memory address.
hal_i2c_master_sequential_transmit_it
hal_status_t hal_i2c_master_sequential_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options)
Sequentially transmit in master I2C mode an amount of data in non-blocking mode with Interrupt.
_hal_i2c_callback
HAL_I2C Callback function definition.
Definition: gr55xx_hal_i2c.h:243
_hal_i2c_callback::i2c_listen_cplt_callback
void(* i2c_listen_cplt_callback)(i2c_handle_t *p_i2c)
I2C listen Complete callback
Definition: gr55xx_hal_i2c.h:250
hal_i2c_master_transmit_it
hal_status_t hal_i2c_master_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size)
Transmit in master mode an amount of data in non-blocking mode with Interrupt.
_hal_i2c_callback::i2c_error_callback
void(* i2c_error_callback)(i2c_handle_t *p_i2c)
I2C error callback
Definition: gr55xx_hal_i2c.h:253
hal_i2c_slave_transmit_dma
hal_status_t hal_i2c_slave_transmit_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size)
Transmit in slave mode an amount of data in non-blocking mode with DMA.
i2c_init_t
struct _i2c_init i2c_init_t
I2C Configuration Structure definition.
_hal_i2c_callback::i2c_abort_cplt_callback
void(* i2c_abort_cplt_callback)(i2c_handle_t *p_i2c)
I2C abort completed callback
Definition: gr55xx_hal_i2c.h:254
i2c_handle_t
struct _i2c_handle i2c_handle_t
I2C handle Structure definition.
_i2c_handle::retention
uint32_t retention[10]
I2C important register information.
Definition: gr55xx_hal_i2c.h:224
hal_i2c_master_transmit_dma
hal_status_t hal_i2c_master_transmit_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size)
Transmit in master mode an amount of data in non-blocking mode with DMA.
_hal_i2c_callback::i2c_slave_rx_cplt_callback
void(* i2c_slave_rx_cplt_callback)(i2c_handle_t *p_i2c)
I2C slave rx transfer completed callback
Definition: gr55xx_hal_i2c.h:249
_hal_i2c_callback::i2c_msp_deinit
void(* i2c_msp_deinit)(i2c_handle_t *p_i2c)
I2C de-init MSP callback
Definition: gr55xx_hal_i2c.h:245
HAL_I2C_MODE_MASTER
@ HAL_I2C_MODE_MASTER
I2C communication is in Master Mode
Definition: gr55xx_hal_i2c.h:145
_i2c_handle::error_code
__IO uint32_t error_code
I2C Error code
Definition: gr55xx_hal_i2c.h:222
hal_i2c_mem_read_dma
hal_status_t hal_i2c_mem_read_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size)
Reads an amount of data in non-blocking mode with DMA from a specific memory address.
hal_i2c_slave_rx_cplt_callback
void hal_i2c_slave_rx_cplt_callback(i2c_handle_t *p_i2c)
Slave Rx Transfer completed callback.
_i2c_handle::p_dmatx
dma_handle_t * p_dmatx
I2C Tx DMA handle parameters
Definition: gr55xx_hal_i2c.h:212
HAL_I2C_STATE_BUSY_RX
@ HAL_I2C_STATE_BUSY_RX
Data Reception process is ongoing
Definition: gr55xx_hal_i2c.h:106
hal_i2c_slave_sequential_transmit_it
hal_status_t hal_i2c_slave_sequential_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options)
Sequential transmit in slave/device I2C mode an amount of data in non-blocking mode with Interrupt.
_i2c_handle::mode
__IO hal_i2c_mode_t mode
I2C communication mode
Definition: gr55xx_hal_i2c.h:220
HAL_I2C_STATE_BUSY_TX
@ HAL_I2C_STATE_BUSY_TX
Data Transmission process is ongoing
Definition: gr55xx_hal_i2c.h:105
hal_i2c_state_t
hal_i2c_state_t
HAL I2C State Enumerations definition.
Definition: gr55xx_hal_i2c.h:101
_i2c_handle::state
__IO hal_i2c_state_t state
I2C communication state
Definition: gr55xx_hal_i2c.h:218
_i2c_init::general_call_mode
uint32_t general_call_mode
Specifies if general call mode is selected.
Definition: gr55xx_hal_i2c.h:177
hal_i2c_mem_rx_cplt_callback
void hal_i2c_mem_rx_cplt_callback(i2c_handle_t *p_i2c)
Memory Rx Transfer completed callback.
hal_i2c_suspend_reg
hal_status_t hal_i2c_suspend_reg(i2c_handle_t *p_i2c)
Suspend some registers related to I2C configuration before sleep.
hal_i2c_slave_transmit
hal_status_t hal_i2c_slave_transmit(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout)
Transmits in slave mode an amount of data in blocking mode.
hal_i2c_master_rx_cplt_callback
void hal_i2c_master_rx_cplt_callback(i2c_handle_t *p_i2c)
Master Rx Transfer completed callback.
hal_i2c_slave_receive
hal_status_t hal_i2c_slave_receive(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout)
Receive in slave mode an amount of data in blocking mode.
HAL_I2C_STATE_TIMEOUT
@ HAL_I2C_STATE_TIMEOUT
Timeout state
Definition: gr55xx_hal_i2c.h:113
hal_i2c_slave_transmit_it
hal_status_t hal_i2c_slave_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size)
Transmit in slave mode an amount of data in non-blocking mode with Interrupt.
hal_i2c_irq_handler
void hal_i2c_irq_handler(i2c_handle_t *p_i2c)
This function handles I2C event interrupt request.
_hal_i2c_callback::i2c_master_rx_cplt_callback
void(* i2c_master_rx_cplt_callback)(i2c_handle_t *p_i2c)
I2C master rx transfer completed callback
Definition: gr55xx_hal_i2c.h:247
_hal_i2c_callback::i2c_master_tx_cplt_callback
void(* i2c_master_tx_cplt_callback)(i2c_handle_t *p_i2c)
I2C master tx transfer completed callbac
Definition: gr55xx_hal_i2c.h:246
hal_i2c_mode_t
hal_i2c_mode_t
HAL I2C Mode Enumerations definition.
Definition: gr55xx_hal_i2c.h:143
hal_i2c_master_abort_it
hal_status_t hal_i2c_master_abort_it(i2c_handle_t *p_i2c)
Abort a master I2C IT or DMA process communication with Interrupt.
_i2c_init::speed
uint32_t speed
Specifies the I2C transfer speed.
Definition: gr55xx_hal_i2c.h:168
hal_i2c_mem_write_dma
hal_status_t hal_i2c_mem_write_dma(i2c_handle_t *p_i2c, 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 DMA to a specific memory address.
_i2c_init::addressing_mode
uint32_t addressing_mode
Specifies if 7-bit or 10-bit addressing mode is selected.
Definition: gr55xx_hal_i2c.h:174
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
hal_i2c_mem_write
hal_status_t hal_i2c_mem_write(i2c_handle_t *p_i2c, 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.
hal_i2c_mem_read
hal_status_t hal_i2c_mem_read(i2c_handle_t *p_i2c, 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.
hal_i2c_mem_tx_cplt_callback
void hal_i2c_mem_tx_cplt_callback(i2c_handle_t *p_i2c)
Memory Tx Transfer completed callback.
HAL_I2C_STATE_ABORT
@ HAL_I2C_STATE_ABORT
Abort user request ongoing
Definition: gr55xx_hal_i2c.h:112
hal_i2c_master_transmit
hal_status_t hal_i2c_master_transmit(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout)
Transmits in master mode an amount of data in blocking mode.
hal_i2c_msp_init
void hal_i2c_msp_init(i2c_handle_t *p_i2c)
Initialize the I2C MSP.
hal_i2c_get_mode
hal_i2c_mode_t hal_i2c_get_mode(i2c_handle_t *p_i2c)
Returns the I2C Master, Slave, Memory or no mode.
hal_i2c_error_callback
void hal_i2c_error_callback(i2c_handle_t *p_i2c)
I2C error callback.
hal_i2c_master_receive_it
hal_status_t hal_i2c_master_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size)
Receive in master mode an amount of data in non-blocking mode with Interrupt.
hal_i2c_get_state
hal_i2c_state_t hal_i2c_get_state(i2c_handle_t *p_i2c)
Return the I2C handle state.
hal_i2c_disable_listen_it
hal_status_t hal_i2c_disable_listen_it(i2c_handle_t *p_i2c)
Disable the Master Read Request listen mode with Interrupt.
HAL_I2C_STATE_ERROR
@ HAL_I2C_STATE_ERROR
Error
Definition: gr55xx_hal_i2c.h:114
hal_i2c_resume_reg
hal_status_t hal_i2c_resume_reg(i2c_handle_t *p_i2c)
Restore some registers related to I2C configuration after sleep.
hal_i2c_enable_listen_it
hal_status_t hal_i2c_enable_listen_it(i2c_handle_t *p_i2c)
Enable the Master Read Request listen mode with Interrupt.
_i2c_handle::p_instance
i2c_regs_t * p_instance
I2C registers base address
Definition: gr55xx_hal_i2c.h:192
hal_i2c_abort_cplt_callback
void hal_i2c_abort_cplt_callback(i2c_handle_t *p_i2c)
I2C abort callback.
_i2c_handle::xfer_options
__IO uint32_t xfer_options
I2C sequantial transfer options, this parameter can be a value of I2C Sequential Transfer Options
Definition: gr55xx_hal_i2c.h:204
hal_i2c_slave_tx_cplt_callback
void hal_i2c_slave_tx_cplt_callback(i2c_handle_t *p_i2c)
Slave Tx Transfer completed callback.
_i2c_handle::master_ack_count
__IO uint16_t master_ack_count
I2C master acknowledge counter in master receive progress.
Definition: gr55xx_hal_i2c.h:202
hal_i2c_msp_deinit
void hal_i2c_msp_deinit(i2c_handle_t *p_i2c)
De-initialize the I2C MSP.
_i2c_handle::p_buffer
uint8_t * p_buffer
Pointer to I2C transfer buffer
Definition: gr55xx_hal_i2c.h:196
HAL_I2C_STATE_LISTEN
@ HAL_I2C_STATE_LISTEN
Address Listen Mode is ongoing
Definition: gr55xx_hal_i2c.h:107
_dma_handle
DMA handle Structure definition.
Definition: gr55xx_hal_dma.h:179
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
HAL_I2C_MODE_NONE
@ HAL_I2C_MODE_NONE
No I2C communication on going
Definition: gr55xx_hal_i2c.h:144
_i2c_handle::lock
hal_lock_t lock
I2C locking object
Definition: gr55xx_hal_i2c.h:216
_i2c_handle::xfer_count
__IO uint16_t xfer_count
I2C transfer counter
Definition: gr55xx_hal_i2c.h:200
HAL_I2C_STATE_BUSY
@ HAL_I2C_STATE_BUSY
An internal process is ongoing
Definition: gr55xx_hal_i2c.h:104