STM32F439xx HAL User Manual
Functions
IO operation functions
I2C Exported Functions

Data transfers functions. More...

Functions

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.
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.
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.
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.
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.
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.
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in master mode an amount of data in non-blocking mode with Interrupt.
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT (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 Interrupt.
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.
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.
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_IT (I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
 Sequential transmit in slave mode an amount of data in no-blocking mode with Interrupt.
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_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.
HAL_StatusTypeDef HAL_I2C_EnableListen_IT (I2C_HandleTypeDef *hi2c)
 Enable the Address listen mode with Interrupt.
HAL_StatusTypeDef HAL_I2C_DisableListen_IT (I2C_HandleTypeDef *hi2c)
 Disable the Address listen mode with Interrupt.
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.
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.
HAL_StatusTypeDef HAL_I2C_Master_Abort_IT (I2C_HandleTypeDef *hi2c, uint16_t DevAddress)
 Abort a master I2C process communication with Interrupt.
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.
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.
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.
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.
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.
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.
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.
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.
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.
void HAL_I2C_EV_IRQHandler (I2C_HandleTypeDef *hi2c)
 This function handles I2C event interrupt request.
void HAL_I2C_ER_IRQHandler (I2C_HandleTypeDef *hi2c)
 This function handles I2C error interrupt request.
__weak void HAL_I2C_MasterTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Master Tx Transfer completed callback.
__weak void HAL_I2C_MasterRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Master Rx Transfer completed callback.
__weak void HAL_I2C_SlaveTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Slave Tx Transfer completed callback.
__weak void HAL_I2C_SlaveRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Slave Rx Transfer completed callback.
__weak void HAL_I2C_AddrCallback (I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
 Slave Address Match callback.
__weak void HAL_I2C_ListenCpltCallback (I2C_HandleTypeDef *hi2c)
 Listen Complete callback.
__weak void HAL_I2C_MemTxCpltCallback (I2C_HandleTypeDef *hi2c)
 Memory Tx Transfer completed callback.
__weak void HAL_I2C_MemRxCpltCallback (I2C_HandleTypeDef *hi2c)
 Memory Rx Transfer completed callback.
__weak void HAL_I2C_ErrorCallback (I2C_HandleTypeDef *hi2c)
 I2C error callback.
__weak void HAL_I2C_AbortCpltCallback (I2C_HandleTypeDef *hi2c)
 I2C abort callback.

Detailed Description

Data transfers functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the I2C data
    transfers.

    (#) There are two modes of transfer:
       (++) Blocking mode : The communication is performed in the polling mode.
            The status of all data processing is returned by the same function
            after finishing transfer.
       (++) No-Blocking mode : The communication is performed using Interrupts
            or DMA. These functions return the status of the transfer startup.
            The end of the data processing will be indicated through the
            dedicated I2C IRQ when using Interrupt mode or the DMA IRQ when
            using DMA mode.

    (#) Blocking mode functions are :
        (++) HAL_I2C_Master_Transmit()
        (++) HAL_I2C_Master_Receive()
        (++) HAL_I2C_Slave_Transmit()
        (++) HAL_I2C_Slave_Receive()
        (++) HAL_I2C_Mem_Write()
        (++) HAL_I2C_Mem_Read()
        (++) HAL_I2C_IsDeviceReady()

    (#) No-Blocking mode functions with Interrupt are :
        (++) HAL_I2C_Master_Transmit_IT()
        (++) HAL_I2C_Master_Receive_IT()
        (++) HAL_I2C_Slave_Transmit_IT()
        (++) HAL_I2C_Slave_Receive_IT()
        (++) HAL_I2C_Master_Sequential_Transmit_IT()
        (++) HAL_I2C_Master_Sequential_Receive_IT()
        (++) HAL_I2C_Slave_Sequential_Transmit_IT()
        (++) HAL_I2C_Slave_Sequential_Receive_IT()
        (++) HAL_I2C_Mem_Write_IT()
        (++) HAL_I2C_Mem_Read_IT()

    (#) No-Blocking mode functions with DMA are :
        (++) HAL_I2C_Master_Transmit_DMA()
        (++) HAL_I2C_Master_Receive_DMA()
        (++) HAL_I2C_Slave_Transmit_DMA()
        (++) HAL_I2C_Slave_Receive_DMA()
        (++) HAL_I2C_Mem_Write_DMA()
        (++) HAL_I2C_Mem_Read_DMA()

    (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
        (++) HAL_I2C_MemTxCpltCallback()
        (++) HAL_I2C_MemRxCpltCallback()
        (++) HAL_I2C_MasterTxCpltCallback()
        (++) HAL_I2C_MasterRxCpltCallback()
        (++) HAL_I2C_SlaveTxCpltCallback()
        (++) HAL_I2C_SlaveRxCpltCallback()
        (++) HAL_I2C_ErrorCallback()
        (++) HAL_I2C_AbortCpltCallback()


Function Documentation

I2C abort callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3678 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_DMAAbort(), and I2C_ITError().

void HAL_I2C_AddrCallback ( I2C_HandleTypeDef hi2c,
uint8_t  TransferDirection,
uint16_t  AddrMatchCode 
)

Slave Address Match callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
TransferDirectionMaster request Transfer Direction (Write/Read), value of I2C XferOptions definition
AddrMatchCodeAddress Match Code
Return values:
None

Definition at line 3596 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_Slave_ADDR().

HAL_StatusTypeDef HAL_I2C_DisableListen_IT ( I2C_HandleTypeDef hi2c)

Disable the Address listen mode with Interrupt.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
HALstatus

Definition at line 1881 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_DISABLE_IT, HAL_I2C_MODE_NONE, HAL_I2C_STATE_LISTEN, HAL_I2C_STATE_READY, I2C_IT_ERR, I2C_IT_EVT, I2C_STATE_MSK, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::PreviousState, and I2C_HandleTypeDef::State.

HAL_StatusTypeDef HAL_I2C_EnableListen_IT ( I2C_HandleTypeDef hi2c)

Enable the Address listen mode with Interrupt.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
HALstatus

Definition at line 1848 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, HAL_I2C_STATE_LISTEN, HAL_I2C_STATE_READY, I2C_IT_ERR, I2C_IT_EVT, I2C_HandleTypeDef::Instance, and I2C_HandleTypeDef::State.

I2C error callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3662 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_DMAAbort(), I2C_DMAError(), I2C_DMAXferCplt(), and I2C_ITError().

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.

Note:
This function is used with Memory devices
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address
TrialsNumber of trials
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 3228 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_CLEAR_FLAG, __HAL_I2C_ENABLE, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_I2C_ERROR_NONE, HAL_I2C_STATE_BUSY, HAL_I2C_STATE_READY, HAL_I2C_STATE_TIMEOUT, I2C_7BIT_ADD_WRITE, I2C_FLAG_ADDR, I2C_FLAG_AF, I2C_FLAG_BUSY, I2C_FLAG_SB, I2C_NO_OPTION_FRAME, I2C_TIMEOUT_BUSY_FLAG, I2C_WaitOnFlagUntilTimeout(), I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::State, and I2C_HandleTypeDef::XferOptions.

Listen Complete callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3614 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_ITError(), I2C_Slave_AF(), and I2C_Slave_STOPF().

HAL_StatusTypeDef HAL_I2C_Master_Abort_IT ( I2C_HandleTypeDef hi2c,
uint16_t  DevAddress 
)

Abort a master I2C process communication with Interrupt.

Note:
This abort can be called only if state is ready
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
Return values:
HALstatus

Definition at line 2157 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_DISABLE_IT, HAL_I2C_MODE_MASTER, HAL_I2C_STATE_ABORT, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_ITError(), I2C_STATE_NONE, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, and I2C_HandleTypeDef::XferCount.

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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 707 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_ENABLE, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_I2C_ERROR_AF, HAL_I2C_ERROR_NONE, HAL_I2C_ERROR_TIMEOUT, HAL_I2C_MODE_MASTER, HAL_I2C_MODE_NONE, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FLAG_BTF, I2C_FLAG_BUSY, I2C_MasterRequestRead(), I2C_NO_OPTION_FRAME, I2C_TIMEOUT_BUSY_FLAG, I2C_WaitOnFlagUntilTimeout(), I2C_WaitOnRXNEFlagUntilTimeout(), I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA ( I2C_HandleTypeDef hi2c,
uint16_t  DevAddress,
uint8_t *  pData,
uint16_t  Size 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 1271 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MASTER, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT ( 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 Interrupt.

Note:
This interface allow to manage repeated start condition when a direction change during transfer
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
XferOptionsOptions of Transfer, value of I2C XferOptions definition
Return values:
HALstatus

Definition at line 1457 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MASTER, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FIRST_AND_LAST_FRAME, I2C_FIRST_FRAME, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_MASTER_BUSY_TX, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, IS_I2C_TRANSFER_OPTIONS_REQUEST, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT ( I2C_HandleTypeDef hi2c,
uint16_t  DevAddress,
uint8_t *  pData,
uint16_t  Size,
uint32_t  XferOptions 
)

Sequential transmit in master mode an amount of data in non-blocking mode with Interrupt.

Note:
This interface allow to manage repeated start condition when a direction change during transfer
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
XferOptionsOptions of Transfer, value of I2C XferOptions definition
Return values:
HALstatus

Definition at line 1354 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MASTER, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FIRST_AND_LAST_FRAME, I2C_FIRST_FRAME, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_STATE_MASTER_BUSY_RX, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, IS_I2C_TRANSFER_OPTIONS_REQUEST, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 575 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_ENABLE, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_I2C_ERROR_AF, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MASTER, HAL_I2C_MODE_NONE, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FLAG_BTF, I2C_FLAG_BUSY, I2C_MasterRequestWrite(), I2C_NO_OPTION_FRAME, I2C_TIMEOUT_BUSY_FLAG, I2C_WaitOnBTFFlagUntilTimeout(), I2C_WaitOnFlagUntilTimeout(), I2C_WaitOnTXEFlagUntilTimeout(), I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA ( I2C_HandleTypeDef hi2c,
uint16_t  DevAddress,
uint8_t *  pData,
uint16_t  Size 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address The device 7 bits address value in datasheet must be shifted to the left before calling the interface
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 1194 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MASTER, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

Master Rx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3547 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_DMAXferCplt(), I2C_MasterReceive_BTF(), and I2C_MasterReceive_RXNE().

Master Tx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3531 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_MasterTransmit_BTF(), and I2C_MasterTransmit_TXE().

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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address
MemAddressInternal memory address
MemAddSizeSize of internal memory address
pDataPointer to data buffer
SizeAmount of data to be sent
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 2536 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_ENABLE, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_I2C_ERROR_AF, HAL_I2C_ERROR_NONE, HAL_I2C_ERROR_TIMEOUT, HAL_I2C_MODE_MEM, HAL_I2C_MODE_NONE, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FLAG_BTF, I2C_FLAG_BUSY, I2C_NO_OPTION_FRAME, I2C_RequestMemoryRead(), I2C_TIMEOUT_BUSY_FLAG, I2C_WaitOnFlagUntilTimeout(), I2C_WaitOnRXNEFlagUntilTimeout(), I2C_HandleTypeDef::Instance, IS_I2C_MEMADD_SIZE, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

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 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address
MemAddressInternal memory address
MemAddSizeSize of internal memory address
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 2854 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, I2C_HandleTypeDef::EventCount, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MEM, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, IS_I2C_MEMADD_SIZE, I2C_HandleTypeDef::Memaddress, I2C_HandleTypeDef::MemaddSize, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address
MemAddressInternal memory address
MemAddSizeSize of internal memory address
pDataPointer to data buffer
SizeAmount of data to be sent
TimeoutTimeout duration
Return values:
HALstatus

Definition at line 2403 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::ErrorCode, HAL_GetTick(), HAL_I2C_ERROR_AF, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MEM, HAL_I2C_MODE_NONE, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FLAG_BTF, I2C_FLAG_BUSY, I2C_NO_OPTION_FRAME, I2C_RequestMemoryWrite(), I2C_TIMEOUT_BUSY_FLAG, I2C_WaitOnBTFFlagUntilTimeout(), I2C_WaitOnFlagUntilTimeout(), I2C_WaitOnTXEFlagUntilTimeout(), I2C_HandleTypeDef::Instance, IS_I2C_MEMADD_SIZE, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

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 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
DevAddressTarget device address
MemAddressInternal memory address
MemAddSizeSize of internal memory address
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 2769 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, assert_param, I2C_HandleTypeDef::Devaddress, I2C_HandleTypeDef::ErrorCode, I2C_HandleTypeDef::EventCount, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_MEM, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, IS_I2C_MEMADD_SIZE, I2C_HandleTypeDef::Memaddress, I2C_HandleTypeDef::MemaddSize, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

Memory Rx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3646 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_DMAXferCplt(), I2C_MasterReceive_BTF(), and I2C_MasterReceive_RXNE().

Memory Tx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3630 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_MasterTransmit_BTF(), and I2C_MasterTransmit_TXE().

HAL_StatusTypeDef HAL_I2C_Slave_Receive ( I2C_HandleTypeDef hi2c,
uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)
HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA ( I2C_HandleTypeDef hi2c,
uint8_t *  pData,
uint16_t  Size 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 1638 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_SLAVE, HAL_I2C_STATE_BUSY_RX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Slave_Sequential_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.

Note:
This interface allow to manage repeated start condition when a direction change during transfer
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
pDataPointer to data buffer
SizeAmount of data to be sent
XferOptionsOptions of Transfer, value of I2C XferOptions definition
Return values:
HALstatus

Definition at line 1786 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, assert_param, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_SLAVE, HAL_I2C_STATE_BUSY_RX_LISTEN, HAL_I2C_STATE_LISTEN, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_HandleTypeDef::Instance, IS_I2C_TRANSFER_OPTIONS_REQUEST, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_IT ( I2C_HandleTypeDef hi2c,
uint8_t *  pData,
uint16_t  Size,
uint32_t  XferOptions 
)

Sequential transmit in slave mode an amount of data in no-blocking mode with Interrupt.

Note:
This interface allow to manage repeated start condition when a direction change during transfer
Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for I2C module
pDataPointer to data buffer
SizeAmount of data to be sent
XferOptionsOptions of Transfer, value of I2C XferOptions definition
Return values:
HALstatus

Definition at line 1720 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_CLEAR_ADDRFLAG, __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, assert_param, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_SLAVE, HAL_I2C_STATE_BUSY_TX_LISTEN, HAL_I2C_STATE_LISTEN, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_HandleTypeDef::Instance, IS_I2C_TRANSFER_OPTIONS_REQUEST, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

HAL_StatusTypeDef HAL_I2C_Slave_Transmit ( I2C_HandleTypeDef hi2c,
uint8_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA ( I2C_HandleTypeDef hi2c,
uint8_t *  pData,
uint16_t  Size 
)
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.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
pDataPointer to data buffer
SizeAmount of data to be sent
Return values:
HALstatus

Definition at line 1558 of file stm32f4xx_hal_i2c.c.

References __HAL_I2C_ENABLE, __HAL_I2C_ENABLE_IT, __HAL_I2C_GET_FLAG, I2C_HandleTypeDef::ErrorCode, HAL_I2C_ERROR_NONE, HAL_I2C_MODE_SLAVE, HAL_I2C_STATE_BUSY_TX, HAL_I2C_STATE_READY, I2C_FLAG_BUSY, I2C_IT_BUF, I2C_IT_ERR, I2C_IT_EVT, I2C_NO_OPTION_FRAME, I2C_STATE_NONE, I2C_TIMEOUT_BUSY_FLAG, I2C_HandleTypeDef::Instance, I2C_HandleTypeDef::Mode, I2C_HandleTypeDef::pBuffPtr, I2C_HandleTypeDef::PreviousState, I2C_HandleTypeDef::State, I2C_HandleTypeDef::XferCount, I2C_HandleTypeDef::XferOptions, and I2C_HandleTypeDef::XferSize.

Slave Rx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3578 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_Slave_STOPF(), and I2C_SlaveReceive_RXNE().

Slave Tx Transfer completed callback.

Parameters:
hi2cPointer to a I2C_HandleTypeDef structure that contains the configuration information for the specified I2C.
Return values:
None

Definition at line 3562 of file stm32f4xx_hal_i2c.c.

Referenced by I2C_Slave_AF(), and I2C_SlaveTransmit_TXE().