gr55xx_hal_i2c.h
Go to the documentation of this file.
1
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 ------------------------------------------------------------*/
100 typedef enum
101 {
102 HAL_I2C_STATE_RESET = 0x00U,
103 HAL_I2C_STATE_READY = 0x20U,
104 HAL_I2C_STATE_BUSY = 0x24U,
105 HAL_I2C_STATE_BUSY_TX = 0x21U,
106 HAL_I2C_STATE_BUSY_RX = 0x22U,
107 HAL_I2C_STATE_LISTEN = 0x28U,
108 HAL_I2C_STATE_BUSY_TX_LISTEN = 0x29U,
110 HAL_I2C_STATE_BUSY_RX_LISTEN = 0x2AU,
112 HAL_I2C_STATE_ABORT = 0x60U,
113 HAL_I2C_STATE_TIMEOUT = 0xA0U,
114 HAL_I2C_STATE_ERROR = 0xE0U
116 } hal_i2c_state_t;
142 typedef enum
143 {
144 HAL_I2C_MODE_NONE = 0x00U,
145 HAL_I2C_MODE_MASTER = 0x10U,
146 HAL_I2C_MODE_SLAVE = 0x20U,
147 HAL_I2C_MODE_MEM = 0x40U
149 } hal_i2c_mode_t;
166 typedef struct _i2c_init
167 {
168 uint32_t speed;
171 uint32_t own_address;
174 uint32_t addressing_mode;
177 uint32_t general_call_mode;
180 } i2c_init_t;
190 typedef struct _i2c_handle
191 {
192 i2c_regs_t *p_instance;
194 i2c_init_t init;
196 uint8_t *p_buffer;
198 uint16_t xfer_size;
200 __IO uint16_t xfer_count;
202 __IO uint16_t master_ack_count;
204 __IO uint32_t xfer_options;
207 __IO uint32_t previous_state;
209 hal_status_t(*xfer_isr)(struct _i2c_handle *p_i2c, uint32_t it_source, uint32_t abort_sources);
212 dma_handle_t *p_dmatx;
214 dma_handle_t *p_dmarx;
216 hal_lock_t lock;
218 __IO hal_i2c_state_t state;
220 __IO hal_i2c_mode_t mode;
222 __IO uint32_t error_code;
224 uint32_t retention[10];
225 } i2c_handle_t;
242 typedef struct _hal_i2c_callback
243 {
244 void (*i2c_msp_init)(i2c_handle_t *p_i2c);
245 void (*i2c_msp_deinit)(i2c_handle_t *p_i2c);
246 void (*i2c_master_tx_cplt_callback)(i2c_handle_t *p_i2c);
247 void (*i2c_master_rx_cplt_callback)(i2c_handle_t *p_i2c);
248 void (*i2c_slave_tx_cplt_callback)(i2c_handle_t *p_i2c);
249 void (*i2c_slave_rx_cplt_callback)(i2c_handle_t *p_i2c);
250 void (*i2c_listen_cplt_callback)(i2c_handle_t *p_i2c);
251 void (*i2c_mem_tx_cplt_callback)(i2c_handle_t *p_i2c);
252 void (*i2c_mem_rx_cplt_callback)(i2c_handle_t *p_i2c);
253 void (*i2c_error_callback)(i2c_handle_t *p_i2c);
254 void (*i2c_abort_cplt_callback)(i2c_handle_t *p_i2c);
255 } hal_i2c_callback_t;
256
265 /* Exported constants --------------------------------------------------------*/
273 #define HAL_I2C_ERROR_NONE (0x00000000U)
274 #define HAL_I2C_ERROR_ARB_LOST (0x00000002U)
275 #define HAL_I2C_ERROR_NOACK (0x00000004U)
276 #define HAL_I2C_ERROR_OVER (0x00000008U)
277 #define HAL_I2C_ERROR_DMA (0x00000010U)
278 #define HAL_I2C_ERROR_TIMEOUT (0x00000020U)
284 #define I2C_SPEED_100K LL_I2C_SPEED_100K
285 #define I2C_SPEED_400K LL_I2C_SPEED_400K
286 #define I2C_SPEED_1000K LL_I2C_SPEED_1000K
287 #define I2C_SPEED_2000K LL_I2C_SPEED_2000K
293 #define I2C_ADDRESSINGMODE_7BIT (0x00000001U)
294 #define I2C_ADDRESSINGMODE_10BIT (0x00000002U)
300 #define I2C_GENERALCALL_DISABLE (0x00000000U)
301 #define I2C_GENERALCALL_ENABLE (0x00000001U)
307 #define I2C_MEMADD_SIZE_8BIT (0x00000001U)
308 #define I2C_MEMADD_SIZE_16BIT (0x00000002U)
314 #define I2C_FIRST_FRAME (0x00000000U)
315 #define I2C_FIRST_AND_NEXT_FRAME (0x00000001U)
316 #define I2C_NEXT_FRAME (0x00000002U)
317 #define I2C_FIRST_AND_LAST_FRAME (0x00000003U)
318 #define I2C_LAST_FRAME (0x00000004U)
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
334 /* Exported macros -----------------------------------------------------------*/
343 #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_I2C_STATE_RESET)
344
346 /* Private macros ------------------------------------------------------------*/
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
366 #define IS_I2C_ADDRESSING_MODE(__MODE__) (((__MODE__) == I2C_ADDRESSINGMODE_7BIT) || \
367 ((__MODE__) == I2C_ADDRESSINGMODE_10BIT))
368
374 #define IS_I2C_GENERAL_CALL(__CALL__) (((__CALL__) == I2C_GENERALCALL_DISABLE) || \
375 ((__CALL__) == I2C_GENERALCALL_ENABLE))
376
382 #define IS_I2C_MEMADD_SIZE(__SIZE__) (((__SIZE__) == I2C_MEMADD_SIZE_8BIT) || \
383 ((__SIZE__) == I2C_MEMADD_SIZE_16BIT))
384
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
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
412 #define IS_I2C_SLV_ADDRESS(__ADDRESS__) ((__ADDRESS__) < 0x03FFU)
413
419 #define IS_I2C_OWN_ADDRESS(__ADDRESS__) ((((__ADDRESS__) > 0x0007U) && ((__ADDRESS__) < 0x0078U)) || \
420 (((__ADDRESS__) > 0x007FU) && ((__ADDRESS__) < 0x03FFU)))
421
427 #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00U))) >> 8U)))
428
434 #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FFU))))
435
440 /* Exported functions --------------------------------------------------------*/
483 hal_status_t hal_i2c_init(i2c_handle_t *p_i2c);
484
495 hal_status_t hal_i2c_deinit(i2c_handle_t *p_i2c);
496
505 void hal_i2c_msp_init(i2c_handle_t *p_i2c);
506
515 void hal_i2c_msp_deinit(i2c_handle_t *p_i2c);
516
578 /******* Blocking mode: Polling */
579
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
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
627 hal_status_t hal_i2c_slave_transmit(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout);
628
642 hal_status_t hal_i2c_slave_receive(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout);
643
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
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
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
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
724 hal_status_t hal_i2c_slave_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
725
738 hal_status_t hal_i2c_slave_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
739
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
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
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
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
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
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
850 hal_status_t hal_i2c_enable_listen_it(i2c_handle_t *p_i2c);
851
862 hal_status_t hal_i2c_disable_listen_it(i2c_handle_t *p_i2c);
863
874 hal_status_t hal_i2c_master_abort_it(i2c_handle_t *p_i2c);
875
876 /******* Non-Blocking mode: DMA */
877
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
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
920 hal_status_t hal_i2c_slave_transmit_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
921
934 hal_status_t hal_i2c_slave_receive_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size);
935
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
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
983 void hal_i2c_irq_handler(i2c_handle_t *p_i2c);
984
993 void hal_i2c_master_tx_cplt_callback(i2c_handle_t *p_i2c);
994
1003 void hal_i2c_master_rx_cplt_callback(i2c_handle_t *p_i2c);
1004
1013 void hal_i2c_slave_tx_cplt_callback(i2c_handle_t *p_i2c);
1014
1023 void hal_i2c_slave_rx_cplt_callback(i2c_handle_t *p_i2c);
1024
1033 void hal_i2c_mem_tx_cplt_callback(i2c_handle_t *p_i2c);
1034
1043 void hal_i2c_mem_rx_cplt_callback(i2c_handle_t *p_i2c);
1044
1053 void hal_i2c_listen_cplt_callback(i2c_handle_t *p_i2c);
1054
1063 void hal_i2c_error_callback(i2c_handle_t *p_i2c);
1064
1073 void hal_i2c_abort_cplt_callback(i2c_handle_t *p_i2c);
1074
1109 hal_i2c_state_t hal_i2c_get_state(i2c_handle_t *p_i2c);
1110
1121 hal_i2c_mode_t hal_i2c_get_mode(i2c_handle_t *p_i2c);
1122
1130 uint32_t hal_i2c_get_error(i2c_handle_t *p_i2c);
1131
1143 hal_status_t hal_i2c_suspend_reg(i2c_handle_t *p_i2c);
1144
1157 hal_status_t hal_i2c_resume_reg(i2c_handle_t *p_i2c);
1158
1159
1164 #ifdef __cplusplus
1165 }
1166 #endif
1167
1168 #endif /* __GR55xx_HAL_I2C_H__ */
1169
_hal_i2c_callback::i2c_mem_tx_cplt_callback
void(* i2c_mem_tx_cplt_callback)(i2c_handle_t *p_i2c)
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)
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)
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
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
Definition: gr55xx_hal_i2c.h:147
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:198
_i2c_handle::init
i2c_init_t init
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)
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
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:171
_i2c_handle::p_dmarx
dma_handle_t * p_dmarx
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
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
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)
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
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)
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)
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)
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]
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)
Definition: gr55xx_hal_i2c.h:249
_hal_i2c_callback::i2c_msp_deinit
void(* i2c_msp_deinit)(i2c_handle_t *p_i2c)
Definition: gr55xx_hal_i2c.h:245
HAL_I2C_MODE_MASTER
@ HAL_I2C_MODE_MASTER
Definition: gr55xx_hal_i2c.h:145
_i2c_handle::error_code
__IO uint32_t 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
Definition: gr55xx_hal_i2c.h:212
HAL_I2C_STATE_BUSY_RX
@ HAL_I2C_STATE_BUSY_RX
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
Definition: gr55xx_hal_i2c.h:220
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:218
_i2c_init::general_call_mode
uint32_t general_call_mode
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
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)
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)
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
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
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
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
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. This function must be used in conjun...
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
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
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
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
Definition: gr55xx_hal_i2c.h:196
HAL_I2C_STATE_LISTEN
@ HAL_I2C_STATE_LISTEN
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
Definition: gr55xx_hal_i2c.h:144
_i2c_handle::lock
hal_lock_t lock
Definition: gr55xx_hal_i2c.h:216
_i2c_handle::xfer_count
__IO uint16_t xfer_count
Definition: gr55xx_hal_i2c.h:200
HAL_I2C_STATE_BUSY
@ HAL_I2C_STATE_BUSY
Definition: gr55xx_hal_i2c.h:104