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