STM32F4xx_HAL_Driver  1.8.3
stm32f4xx_hal_i2c.h File Reference

Header file of I2C HAL module. More...

Go to the source code of this file.

Data Structures

struct  I2C_InitTypeDef
 
struct  endif
 ADC handle Structure definition. More...
 

Typedefs

typedef struct __I2C_HandleTypeDef else typedef struct endif I2C_HandleTypeDef
 
typedef void(* pI2C_CallbackTypeDef) (I2C_HandleTypeDef *hi2c)
 HAL I2C Callback pointer definition. More...
 
typedef void(* pI2C_AddrCallbackTypeDef) (I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
 

Enumerations

enum  HAL_I2C_StateTypeDef {
  HAL_I2C_STATE_RESET = 0x00U , HAL_I2C_STATE_READY = 0x20U , HAL_I2C_STATE_BUSY = 0x24U , HAL_I2C_STATE_BUSY_TX = 0x21U ,
  HAL_I2C_STATE_BUSY_RX = 0x22U , HAL_I2C_STATE_LISTEN = 0x28U , HAL_I2C_STATE_BUSY_TX_LISTEN = 0x29U , HAL_I2C_STATE_BUSY_RX_LISTEN = 0x2AU ,
  HAL_I2C_STATE_ABORT = 0x60U , HAL_I2C_STATE_TIMEOUT = 0xA0U , HAL_I2C_STATE_ERROR = 0xE0U
}
 
enum  HAL_I2C_ModeTypeDef { HAL_I2C_MODE_NONE = 0x00U , HAL_I2C_MODE_MASTER = 0x10U , HAL_I2C_MODE_SLAVE = 0x20U , HAL_I2C_MODE_MEM = 0x40U }
 
enum  HAL_I2C_CallbackIDTypeDef {
  HAL_I2C_MASTER_TX_COMPLETE_CB_ID = 0x00U , HAL_I2C_MASTER_RX_COMPLETE_CB_ID = 0x01U , HAL_I2C_SLAVE_TX_COMPLETE_CB_ID = 0x02U , HAL_I2C_SLAVE_RX_COMPLETE_CB_ID = 0x03U ,
  HAL_I2C_LISTEN_COMPLETE_CB_ID = 0x04U , HAL_I2C_MEM_TX_COMPLETE_CB_ID = 0x05U , HAL_I2C_MEM_RX_COMPLETE_CB_ID = 0x06U , HAL_I2C_ERROR_CB_ID = 0x07U ,
  HAL_I2C_ABORT_CB_ID = 0x08U , HAL_I2C_MSPINIT_CB_ID = 0x09U , HAL_I2C_MSPDEINIT_CB_ID = 0x0AU
}
 HAL I2C Callback ID enumeration definition. More...
 

Functions

HAL_StatusTypeDef HAL_I2C_Init (I2C_HandleTypeDef *hi2c)
 Initializes the I2C according to the specified parameters in the I2C_InitTypeDef and initialize the associated handle. More...
 
HAL_StatusTypeDef HAL_I2C_DeInit (I2C_HandleTypeDef *hi2c)
 DeInitialize the I2C peripheral. More...
 
void HAL_I2C_MspInit (I2C_HandleTypeDef *hi2c)
 Initialize the I2C MSP. More...
 
void HAL_I2C_MspDeInit (I2C_HandleTypeDef *hi2c)
 DeInitialize the I2C MSP. More...
 
HAL_StatusTypeDef HAL_I2C_RegisterCallback (I2C_HandleTypeDef *hi2c, HAL_I2C_CallbackIDTypeDef CallbackID, pI2C_CallbackTypeDef pCallback)
 Register a User I2C Callback To be used instead of the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_I2C_UnRegisterCallback (I2C_HandleTypeDef *hi2c, HAL_I2C_CallbackIDTypeDef CallbackID)
 Unregister an I2C Callback I2C callback is redirected to the weak predefined callback. More...
 
HAL_StatusTypeDef HAL_I2C_RegisterAddrCallback (I2C_HandleTypeDef *hi2c, pI2C_AddrCallbackTypeDef pCallback)
 Register the Slave Address Match I2C Callback To be used instead of the weak HAL_I2C_AddrCallback() predefined callback. More...
 
HAL_StatusTypeDef HAL_I2C_UnRegisterAddrCallback (I2C_HandleTypeDef *hi2c)
 UnRegister the Slave Address Match I2C Callback Info Ready I2C Callback is redirected to the weak HAL_I2C_AddrCallback() predefined callback. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Transmit (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Transmits in master mode an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Receive (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Receives in master mode an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Transmit (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Transmits in slave mode an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Receive (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Receive in slave mode an amount of data in blocking mode. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Write (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Write an amount of data in blocking mode to a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Read (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 Read an amount of data in blocking mode from a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_IsDeviceReady (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
 Checks if target device is ready for communication. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
 Transmit in master mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Receive_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
 Receive in master mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
 Transmit in slave mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
 Receive in slave mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Write_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
 Write an amount of data in non-blocking mode with Interrupt to a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Read_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
 Read an amount of data in non-blocking mode with Interrupt from a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in master I2C mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential receive in master I2C mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Seq_Transmit_IT (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in slave mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Seq_Receive_IT (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential receive in slave mode an amount of data in non-blocking mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_EnableListen_IT (I2C_HandleTypeDef *hi2c)
 Enable the Address listen mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_DisableListen_IT (I2C_HandleTypeDef *hi2c)
 Disable the Address listen mode with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Abort_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress)
 Abort a master or memory I2C IT or DMA process communication with Interrupt. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
 Transmit in master mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
 Receive in master mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
 Transmit in slave mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
 Receive in slave mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
 Write an amount of data in non-blocking mode with DMA to a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
 Reads an amount of data in non-blocking mode with DMA from a specific memory address. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in master I2C mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_DMA (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential receive in master mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Seq_Transmit_DMA (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in slave mode an amount of data in non-blocking mode with DMA. More...
 
HAL_StatusTypeDef HAL_I2C_Slave_Seq_Receive_DMA (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential receive in slave mode an amount of data in non-blocking mode with DMA. More...
 
void HAL_I2C_EV_IRQHandler (I2C_HandleTypeDef *hi2c)
 This function handles I2C event interrupt request. More...
 
void HAL_I2C_ER_IRQHandler (I2C_HandleTypeDef *hi2c)
 This function handles I2C error interrupt request. More...
 
void HAL_I2C_MasterTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Master Tx Transfer completed callback. More...
 
void HAL_I2C_MasterRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Master Rx Transfer completed callback. More...
 
void HAL_I2C_SlaveTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Slave Tx Transfer completed callback. More...
 
void HAL_I2C_SlaveRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Slave Rx Transfer completed callback. More...
 
void HAL_I2C_AddrCallback (I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
 Slave Address Match callback. More...
 
void HAL_I2C_ListenCpltCallback (I2C_HandleTypeDef *hi2c)
 Listen Complete callback. More...
 
void HAL_I2C_MemTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Memory Tx Transfer completed callback. More...
 
void HAL_I2C_MemRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Memory Rx Transfer completed callback. More...
 
void HAL_I2C_ErrorCallback (I2C_HandleTypeDef *hi2c)
 I2C error callback. More...
 
void HAL_I2C_AbortCpltCallback (I2C_HandleTypeDef *hi2c)
 I2C abort callback. More...
 
HAL_I2C_StateTypeDef HAL_I2C_GetState (I2C_HandleTypeDef *hi2c)
 Return the I2C handle state. More...
 
HAL_I2C_ModeTypeDef HAL_I2C_GetMode (I2C_HandleTypeDef *hi2c)
 Returns the I2C Master, Slave, Memory or no mode. More...
 
uint32_t HAL_I2C_GetError (I2C_HandleTypeDef *hi2c)
 Return the I2C error code. More...
 

Detailed Description

Header file of I2C HAL module.

Author
MCD Application Team
Attention

Copyright (c) 2016 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file stm32f4xx_hal_i2c.h.