STM32L486xx HAL User Manual
Functions
Data_Management
I2C Exported Functions

Functions

__STATIC_INLINE void LL_I2C_EnableAutoEndMode (I2C_TypeDef *I2Cx)
 Enable automatic STOP condition generation (master mode).
__STATIC_INLINE void LL_I2C_DisableAutoEndMode (I2C_TypeDef *I2Cx)
 Disable automatic STOP condition generation (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledAutoEndMode (I2C_TypeDef *I2Cx)
 Check if automatic STOP condition is enabled or disabled.
__STATIC_INLINE void LL_I2C_EnableReloadMode (I2C_TypeDef *I2Cx)
 Enable reload mode (master mode).
__STATIC_INLINE void LL_I2C_DisableReloadMode (I2C_TypeDef *I2Cx)
 Disable reload mode (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledReloadMode (I2C_TypeDef *I2Cx)
 Check if reload mode is enabled or disabled.
__STATIC_INLINE void LL_I2C_SetTransferSize (I2C_TypeDef *I2Cx, uint32_t TransferSize)
 Configure the number of bytes for transfer.
__STATIC_INLINE uint32_t LL_I2C_GetTransferSize (I2C_TypeDef *I2Cx)
 Get the number of bytes configured for transfer.
__STATIC_INLINE void LL_I2C_AcknowledgeNextData (I2C_TypeDef *I2Cx, uint32_t TypeAcknowledge)
 Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.
__STATIC_INLINE void LL_I2C_GenerateStartCondition (I2C_TypeDef *I2Cx)
 Generate a START or RESTART condition.
__STATIC_INLINE void LL_I2C_GenerateStopCondition (I2C_TypeDef *I2Cx)
 Generate a STOP condition after the current byte transfer (master mode).
__STATIC_INLINE void LL_I2C_EnableAuto10BitRead (I2C_TypeDef *I2Cx)
 Enable automatic RESTART Read request condition for 10bit address header (master mode).
__STATIC_INLINE void LL_I2C_DisableAuto10BitRead (I2C_TypeDef *I2Cx)
 Disable automatic RESTART Read request condition for 10bit address header (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledAuto10BitRead (I2C_TypeDef *I2Cx)
 Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled.
__STATIC_INLINE void LL_I2C_SetTransferRequest (I2C_TypeDef *I2Cx, uint32_t TransferRequest)
 Configure the transfer direction (master mode).
__STATIC_INLINE uint32_t LL_I2C_GetTransferRequest (I2C_TypeDef *I2Cx)
 Get the transfer direction requested (master mode).
__STATIC_INLINE void LL_I2C_SetSlaveAddr (I2C_TypeDef *I2Cx, uint32_t SlaveAddr)
 Configure the slave address for transfer (master mode).
__STATIC_INLINE uint32_t LL_I2C_GetSlaveAddr (I2C_TypeDef *I2Cx)
 Get the slave address programmed for transfer.
__STATIC_INLINE void LL_I2C_HandleTransfer (I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize, uint32_t TransferSize, uint32_t EndMode, uint32_t Request)
 Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).
__STATIC_INLINE uint32_t LL_I2C_GetTransferDirection (I2C_TypeDef *I2Cx)
 Indicate the value of transfer direction (slave mode).
__STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode (I2C_TypeDef *I2Cx)
 Return the slave matched address.
__STATIC_INLINE void LL_I2C_EnableSMBusPECCompare (I2C_TypeDef *I2Cx)
 Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare (I2C_TypeDef *I2Cx)
 Check if the SMBus Packet Error byte internal comparison is requested or not.
__STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC (I2C_TypeDef *I2Cx)
 Get the SMBus Packet Error byte calculated.
__STATIC_INLINE uint8_t LL_I2C_ReceiveData8 (I2C_TypeDef *I2Cx)
 Read Receive Data register.
__STATIC_INLINE void LL_I2C_TransmitData8 (I2C_TypeDef *I2Cx, uint8_t Data)
 Write in Transmit Data Register .

Function Documentation

__STATIC_INLINE void LL_I2C_AcknowledgeNextData ( I2C_TypeDef *  I2Cx,
uint32_t  TypeAcknowledge 
)

Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.

Note:
Usage in Slave mode only.
Reference Manual to LL API cross reference:
CR2 NACK LL_I2C_AcknowledgeNextData
Parameters:
I2CxI2C Instance.
TypeAcknowledgeThis parameter can be one of the following values:
Return values:
None

Definition at line 1951 of file stm32l4xx_ll_i2c.h.

Referenced by LL_I2C_Init().

__STATIC_INLINE void LL_I2C_DisableAuto10BitRead ( I2C_TypeDef *  I2Cx)

Disable automatic RESTART Read request condition for 10bit address header (master mode).

Note:
The master only sends the first 7 bits of 10bit address in Read direction.
Reference Manual to LL API cross reference:
CR2 HEAD10R LL_I2C_DisableAuto10BitRead
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 2000 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_DisableAutoEndMode ( I2C_TypeDef *  I2Cx)

Disable automatic STOP condition generation (master mode).

Note:
Software end mode : TC flag is set when NBYTES data are transferre, stretching SCL low.
Reference Manual to LL API cross reference:
CR2 AUTOEND LL_I2C_DisableAutoEndMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1866 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_DisableReloadMode ( I2C_TypeDef *  I2Cx)

Disable reload mode (master mode).

Note:
The transfer is completed after the NBYTES data transfer(STOP or RESTART will follow).
Reference Manual to LL API cross reference:
CR2 RELOAD LL_I2C_DisableReloadMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1901 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableAuto10BitRead ( I2C_TypeDef *  I2Cx)

Enable automatic RESTART Read request condition for 10bit address header (master mode).

Note:
The master sends the complete 10bit slave address read sequence : Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address in Read direction.
Reference Manual to LL API cross reference:
CR2 HEAD10R LL_I2C_EnableAuto10BitRead
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1988 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableAutoEndMode ( I2C_TypeDef *  I2Cx)

Enable automatic STOP condition generation (master mode).

Note:
Automatic end mode : a STOP condition is automatically sent when NBYTES data are transferred. This bit has no effect in slave mode or when RELOAD bit is set.
Reference Manual to LL API cross reference:
CR2 AUTOEND LL_I2C_EnableAutoEndMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1854 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableReloadMode ( I2C_TypeDef *  I2Cx)

Enable reload mode (master mode).

Note:
The transfer is not completed after the NBYTES data transfer, NBYTES will be reloaded when TCR flag is set.
Reference Manual to LL API cross reference:
CR2 RELOAD LL_I2C_EnableReloadMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1889 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableSMBusPECCompare ( I2C_TypeDef *  I2Cx)

Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode).

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition or an Address Matched is received. This bit has no effect when RELOAD bit is set. This bit has no effect in device mode when SBC bit is not set.
Reference Manual to LL API cross reference:
CR2 PECBYTE LL_I2C_EnableSMBusPECCompare
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 2151 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_GenerateStartCondition ( I2C_TypeDef *  I2Cx)

Generate a START or RESTART condition.

Note:
The START bit can be set even if bus is BUSY or I2C is in slave mode. This action has no effect when RELOAD is set.
Reference Manual to LL API cross reference:
CR2 START LL_I2C_GenerateStartCondition
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1964 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_GenerateStopCondition ( I2C_TypeDef *  I2Cx)

Generate a STOP condition after the current byte transfer (master mode).

Reference Manual to LL API cross reference:
CR2 STOP LL_I2C_GenerateStopCondition
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1975 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode ( I2C_TypeDef *  I2Cx)

Return the slave matched address.

Reference Manual to LL API cross reference:
ISR ADDCODE LL_I2C_GetAddressMatchCode
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0x3F

Definition at line 2135 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetSlaveAddr ( I2C_TypeDef *  I2Cx)

Get the slave address programmed for transfer.

Reference Manual to LL API cross reference:
CR2 SADD LL_I2C_GetSlaveAddr
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x0 and Max_Data=0x3F

Definition at line 2063 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC ( I2C_TypeDef *  I2Cx)

Get the SMBus Packet Error byte calculated.

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
Reference Manual to LL API cross reference:
PECR PEC LL_I2C_GetSMBusPEC
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 2177 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferDirection ( I2C_TypeDef *  I2Cx)

Indicate the value of transfer direction (slave mode).

Note:
RESET: Write transfer, Slave enters in receiver mode. SET: Read transfer, Slave enters in transmitter mode.
Reference Manual to LL API cross reference:
ISR DIR LL_I2C_GetTransferDirection
Parameters:
I2CxI2C Instance.
Return values:
Returnedvalue can be one of the following values:

Definition at line 2124 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferRequest ( I2C_TypeDef *  I2Cx)

Get the transfer direction requested (master mode).

Reference Manual to LL API cross reference:
CR2 RD_WRN LL_I2C_GetTransferRequest
Parameters:
I2CxI2C Instance.
Return values:
Returnedvalue can be one of the following values:

Definition at line 2039 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferSize ( I2C_TypeDef *  I2Cx)

Get the number of bytes configured for transfer.

Reference Manual to LL API cross reference:
CR2 NBYTES LL_I2C_GetTransferSize
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x0 and Max_Data=0xFF

Definition at line 1936 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_HandleTransfer ( I2C_TypeDef *  I2Cx,
uint32_t  SlaveAddr,
uint32_t  SlaveAddrSize,
uint32_t  TransferSize,
uint32_t  EndMode,
uint32_t  Request 
)

Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).

Reference Manual to LL API cross reference:
CR2 SADD LL_I2C_HandleTransfer
CR2 ADD10 LL_I2C_HandleTransfer
CR2 RD_WRN LL_I2C_HandleTransfer
CR2 START LL_I2C_HandleTransfer
CR2 STOP LL_I2C_HandleTransfer
CR2 RELOAD LL_I2C_HandleTransfer
CR2 NBYTES LL_I2C_HandleTransfer
CR2 AUTOEND LL_I2C_HandleTransfer
CR2 HEAD10R LL_I2C_HandleTransfer
Parameters:
I2CxI2C Instance.
SlaveAddrSpecifies the slave address to be programmed.
SlaveAddrSizeThis parameter can be one of the following values:
TransferSizeSpecifies the number of bytes to be programmed. This parameter must be a value between Min_Data=0 and Max_Data=255.
EndModeThis parameter can be one of the following values:
RequestThis parameter can be one of the following values:
Return values:
None

Definition at line 2106 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledAuto10BitRead ( I2C_TypeDef *  I2Cx)

Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled.

Reference Manual to LL API cross reference:
CR2 HEAD10R LL_I2C_IsEnabledAuto10BitRead
Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 2011 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledAutoEndMode ( I2C_TypeDef *  I2Cx)

Check if automatic STOP condition is enabled or disabled.

Reference Manual to LL API cross reference:
CR2 AUTOEND LL_I2C_IsEnabledAutoEndMode
Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 1877 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledReloadMode ( I2C_TypeDef *  I2Cx)

Check if reload mode is enabled or disabled.

Reference Manual to LL API cross reference:
CR2 RELOAD LL_I2C_IsEnabledReloadMode
Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 1912 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare ( I2C_TypeDef *  I2Cx)

Check if the SMBus Packet Error byte internal comparison is requested or not.

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
Reference Manual to LL API cross reference:
CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare
Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 2164 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint8_t LL_I2C_ReceiveData8 ( I2C_TypeDef *  I2Cx)

Read Receive Data register.

Reference Manual to LL API cross reference:
RXDR RXDATA LL_I2C_ReceiveData8
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 2188 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetSlaveAddr ( I2C_TypeDef *  I2Cx,
uint32_t  SlaveAddr 
)

Configure the slave address for transfer (master mode).

Note:
Changing these bits when START bit is set is not allowed.
Reference Manual to LL API cross reference:
CR2 SADD LL_I2C_SetSlaveAddr
Parameters:
I2CxI2C Instance.
SlaveAddrThis parameter must be a value between Min_Data=0x00 and Max_Data=0x3F.
Return values:
None

Definition at line 2052 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetTransferRequest ( I2C_TypeDef *  I2Cx,
uint32_t  TransferRequest 
)

Configure the transfer direction (master mode).

Note:
Changing these bits when START bit is set is not allowed.
Reference Manual to LL API cross reference:
CR2 RD_WRN LL_I2C_SetTransferRequest
Parameters:
I2CxI2C Instance.
TransferRequestThis parameter can be one of the following values:
Return values:
None

Definition at line 2026 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetTransferSize ( I2C_TypeDef *  I2Cx,
uint32_t  TransferSize 
)

Configure the number of bytes for transfer.

Note:
Changing these bits when START bit is set is not allowed.
Reference Manual to LL API cross reference:
CR2 NBYTES LL_I2C_SetTransferSize
Parameters:
I2CxI2C Instance.
TransferSizeThis parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
Return values:
None

Definition at line 1925 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_TransmitData8 ( I2C_TypeDef *  I2Cx,
uint8_t  Data 
)

Write in Transmit Data Register .

Reference Manual to LL API cross reference:
TXDR TXDATA LL_I2C_TransmitData8
Parameters:
I2CxI2C Instance.
DataValue between Min_Data=0x00 and Max_Data=0xFF
Return values:
None

Definition at line 2200 of file stm32l4xx_ll_i2c.h.