LL I2C Functions

Configuration

group I2C_LL_EF_Configuration

Functions

void LL_I2C_Enable ( I2C_TypeDef * p_i2c )

Enable I2C peripheral (PE = 1).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PE LL_I2C_Enable

Parameters :

p_i2c – I2C instance.

void LL_I2C_Disable ( I2C_TypeDef * p_i2c )

Disable I2C peripheral (PE = 0).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PE LL_I2C_Disable

Note

When PE = 0, the I2C SCL and SDA lines are released. Internal state machines and status bits are put back to their reset value. When cleared, PE must be kept low for at least 3 APB clock cycles.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabled ( const I2C_TypeDef * p_i2c )

Check if the I2C peripheral is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PE LL_I2C_IsEnabled

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_ConfigFilters ( I2C_TypeDef * p_i2c , uint32_t analog_filter , uint32_t digital_filter )

Configure Noise Filters (Analog and Digital).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ANFOFF LL_I2C_ConfigFilters

CR1 DNF LL_I2C_ConfigFilters

Note

If the analog filter is also enabled, the digital filter is added to analog filter. The filters can only be programmed when the I2C is disabled (PE = 0).

Parameters :
  • p_i2c – I2C instance.

  • analog_filter – This parameter can be one of the following values:

  • digital_filter – This parameter must be a value between Min_Data=0x00 (Digital filter disabled) and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). This parameter is used to configure the digital noise filter on SDA and SCL input. The digital filter filters spikes with a length of up to DNF[3:0]*ti2cclk.

void LL_I2C_SetDigitalFilter ( I2C_TypeDef * p_i2c , uint32_t digital_filter )

Configure Digital Noise Filter.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 DNF LL_I2C_SetDigitalFilter

Note

If the analog filter is also enabled, the digital filter is added to analog filter. This filter can only be programmed when the I2C is disabled (PE = 0).

Parameters :
  • p_i2c – I2C instance.

  • digital_filter – This parameter must be a value between Min_Data=0x00 (Digital filter disabled) and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). This parameter is used to configure the digital noise filter on SDA and SCL input. The digital filter filters spikes with a length of up to DNF[3:0]*ti2cclk.

uint32_t LL_I2C_GetDigitalFilter ( const I2C_TypeDef * p_i2c )

Get the current Digital Noise Filter configuration.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 DNF LL_I2C_GetDigitalFilter

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0xF

void LL_I2C_EnableAnalogFilter ( I2C_TypeDef * p_i2c )

Enable Analog Noise Filter.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ANFOFF LL_I2C_EnableAnalogFilter

Note

This filter can only be programmed when the I2C is disabled (PE = 0).

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableAnalogFilter ( I2C_TypeDef * p_i2c )

Disable Analog Noise Filter.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ANFOFF LL_I2C_DisableAnalogFilter

Note

This filter can only be programmed when the I2C is disabled (PE = 0).

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledAnalogFilter ( const I2C_TypeDef * p_i2c )

Check if Analog Noise Filter is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ANFOFF LL_I2C_IsEnabledAnalogFilter

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableDMAReq_TX ( I2C_TypeDef * p_i2c )

Enable DMA transmission requests.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXDMAEN LL_I2C_EnableDMAReq_TX

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableDMAReq_TX ( I2C_TypeDef * p_i2c )

Disable DMA transmission requests.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXDMAEN LL_I2C_DisableDMAReq_TX

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledDMAReq_TX ( const I2C_TypeDef * p_i2c )

Check if DMA transmission requests are enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXDMAEN LL_I2C_IsEnabledDMAReq_TX

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableDMAReq_RX ( I2C_TypeDef * p_i2c )

Enable DMA reception requests.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXDMAEN LL_I2C_EnableDMAReq_RX

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableDMAReq_RX ( I2C_TypeDef * p_i2c )

Disable DMA reception requests.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXDMAEN LL_I2C_DisableDMAReq_RX

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledDMAReq_RX ( const I2C_TypeDef * p_i2c )

Check if DMA reception requests are enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXDMAEN LL_I2C_IsEnabledDMAReq_RX

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_DMA_GetRegAddr ( const I2C_TypeDef * p_i2c , uint32_t direction )

Get the data register address used for DMA transfer.

Reference Manual to LL API cross reference (Register Field Functions)

TXDR TXDATA LL_I2C_DMA_GetRegAddr

RXDR RXDATA LL_I2C_DMA_GetRegAddr

Parameters :
Return values :

Address – of data register

uint32_t LL_I2C_DMA_GetRegAddrTx ( const I2C_TypeDef * p_i2c )

Get the tx data register address used for DMA transfer.

Reference Manual to LL API cross reference (Register Field Functions)

TXDR TXDATA LL_I2C_DMA_GetRegAddrTx

Parameters :

p_i2c – I2C instance

Return values :

Address – of data register

uint32_t LL_I2C_DMA_GetRegAddrRx ( const I2C_TypeDef * p_i2c )

Get the rx data register address used for DMA transfer.

Reference Manual to LL API cross reference (Register Field Functions)

RXDR RXDATA LL_I2C_DMA_GetRegAddrRx

Parameters :

p_i2c – I2C instance

Return values :

Address – of data register

void LL_I2C_EnableClockStretching ( I2C_TypeDef * p_i2c )

Enable Clock stretching.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NOSTRETCH LL_I2C_EnableClockStretching

Note

This bit can only be programmed when the I2C is disabled (PE = 0).

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableClockStretching ( I2C_TypeDef * p_i2c )

Disable Clock stretching.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NOSTRETCH LL_I2C_DisableClockStretching

Note

This bit can only be programmed when the I2C is disabled (PE = 0).

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledClockStretching ( const I2C_TypeDef * p_i2c )

Check if Clock stretching is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NOSTRETCH LL_I2C_IsEnabledClockStretching

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableSlaveByteControl ( I2C_TypeDef * p_i2c )

Enable hardware byte control in slave mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 SBC LL_I2C_EnableSlaveByteControl

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableSlaveByteControl ( I2C_TypeDef * p_i2c )

Disable hardware byte control in slave mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 SBC LL_I2C_DisableSlaveByteControl

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledSlaveByteControl ( const I2C_TypeDef * p_i2c )

Check if hardware byte control in slave mode is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 SBC LL_I2C_IsEnabledSlaveByteControl

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableWakeUpFromStop ( I2C_TypeDef * p_i2c )

Enable Wakeup from STOP.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 WUPEN LL_I2C_EnableWakeUpFromStop

Note

The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(p_i2c) can be used to check whether or not WakeUpFromStop feature is supported by the p_i2c instance.

Note

This bit can only be programmed when Digital Filter is disabled.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableWakeUpFromStop ( I2C_TypeDef * p_i2c )

Disable Wakeup from STOP.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 WUPEN LL_I2C_DisableWakeUpFromStop

Note

The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(p_i2c) can be used to check whether or not WakeUpFromStop feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledWakeUpFromStop ( const I2C_TypeDef * p_i2c )

Check if Wakeup from STOP is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 WUPEN LL_I2C_IsEnabledWakeUpFromStop

Note

The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(p_i2c) can be used to check whether or not WakeUpFromStop feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableGeneralCall ( I2C_TypeDef * p_i2c )

Enable General Call.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 GCEN LL_I2C_EnableGeneralCall

Note

When enabled the Address 0x00 is ACKed.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableGeneralCall ( I2C_TypeDef * p_i2c )

Disable General Call.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 GCEN LL_I2C_DisableGeneralCall

Note

When disabled the Address 0x00 is NACKed.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledGeneralCall ( const I2C_TypeDef * p_i2c )

Check if General Call is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 GCEN LL_I2C_IsEnabledGeneralCall

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableFastModePlus ( I2C_TypeDef * p_i2c )

Enable I2C Fast Mode Plus (FMP = 1).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 FMP LL_I2C_EnableFastModePlus

Note

20mA I/O drive enable

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableFastModePlus ( I2C_TypeDef * p_i2c )

Disable I2C Fast Mode Plus (FMP = 0).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 FMP LL_I2C_DisableFastModePlus

Note

20mA I/O drive disable

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledFastModePlus ( const I2C_TypeDef * p_i2c )

Check if the I2C Fast Mode Plus is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 FMP LL_I2C_IsEnabledFastModePlus

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableAutoClearFlag_ADDR ( I2C_TypeDef * p_i2c )

Enable automatic clear of ADDR flag.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRACLR LL_I2C_EnableAutoClearFlag_ADDR

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableAutoClearFlag_ADDR ( I2C_TypeDef * p_i2c )

Disable automatic clear of ADDR flag.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRACLR LL_I2C_DisableAutoClearFlag_ADDR

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledAutoClearFlag_ADDR ( const I2C_TypeDef * p_i2c )

Check if the automatic clear of ADDR flag is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRACLR LL_I2C_IsEnabledAutoClearFlag_ADDR

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableAutoClearFlag_STOP ( I2C_TypeDef * p_i2c )

Enable automatic clear of STOP flag.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPFACLR LL_I2C_EnableAutoClearFlag_STOP

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableAutoClearFlag_STOP ( I2C_TypeDef * p_i2c )

Disable automatic clear of STOP flag.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPFACLR LL_I2C_DisableAutoClearFlag_STOP

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledAutoClearFlag_STOP ( const I2C_TypeDef * p_i2c )

Check if the automatic clear of STOP flag is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPFACLR LL_I2C_IsEnabledAutoClearFlag_STOP

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_SetMasterAddressingMode ( I2C_TypeDef * p_i2c , uint32_t addressing_mode )

Configure the Master to operate in 7-bit or 10-bit addressing mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 ADD10 LL_I2C_SetMasterAddressingMode

Note

Changing this bit is not allowed, when the START bit is set.

Parameters :
uint32_t LL_I2C_GetMasterAddressingMode ( const I2C_TypeDef * p_i2c )

Get the Master addressing mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 ADD10 LL_I2C_GetMasterAddressingMode

Parameters :

p_i2c – I2C instance.

Return values :

Returned – value can be one of the following values:

void LL_I2C_SetOwnAddress1 ( I2C_TypeDef * p_i2c , uint32_t own_address1 , uint32_t own_addr_size )

Set the Own Address1.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1 LL_I2C_SetOwnAddress1

OAR1 OA1MODE LL_I2C_SetOwnAddress1

Parameters :
uint32_t LL_I2C_GetOwnAddress1 ( const I2C_TypeDef * p_i2c )

Get the Own Address1.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1 LL_I2C_SetOwnAddress1

Parameters :

p_i2c – I2C instance.

Return values :

Own – Address1.

void LL_I2C_EnableOwnAddress1 ( I2C_TypeDef * p_i2c )

Enable acknowledge on Own Address1 match address.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1EN LL_I2C_EnableOwnAddress1

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableOwnAddress1 ( I2C_TypeDef * p_i2c )

Disable acknowledge on Own Address1 match address.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1EN LL_I2C_DisableOwnAddress1

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableOwnAddress1AndMode ( I2C_TypeDef * p_i2c )

Disable acknowledge on Own Address1 match address and mode.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1EN LL_I2C_DisableOwnAddress1

OAR1 OA1MODE LL_I2C_DisableOwnAddress1

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledOwnAddress1 ( const I2C_TypeDef * p_i2c )

Check if Own Address1 acknowledge is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1EN LL_I2C_IsEnabledOwnAddress1

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_ConfigOwnAddress1 ( I2C_TypeDef * p_i2c , uint32_t own_address1 , uint32_t own_addr_size )

config the Own Address1 and enable it.

Reference Manual to LL API cross reference (Register Field Functions)

OAR1 OA1 LL_I2C_ConfigOwnAddress1

OAR1 OA1MODE LL_I2C_ConfigOwnAddress1

OAR1 OA1EN LL_I2C_ConfigOwnAddress1

Parameters :
void LL_I2C_SetOwnAddress2 ( I2C_TypeDef * p_i2c , uint32_t own_address2 , uint32_t own_addr_mask )

Set the 7bits Own Address2.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2 LL_I2C_SetOwnAddress2

OAR2 OA2MSK LL_I2C_SetOwnAddress2

Note

This action has no effect if own address2 is enabled.

Parameters :
uint32_t LL_I2C_GetOwnAddress2 ( const I2C_TypeDef * p_i2c )

Get the Own Address2.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2 LL_I2C_GetOwnAddress2

Parameters :

p_i2c – I2C instance.

Return values :

Own – Address2 value

uint32_t LL_I2C_GetOwnAddress2Mask ( const I2C_TypeDef * p_i2c )

Get the Own Address2 mask.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2MSK LL_I2C_GetOwnAddress2Mask

Parameters :

p_i2c – I2C instance.

Return values :

Own – Address2 mask

void LL_I2C_EnableOwnAddress2 ( I2C_TypeDef * p_i2c )

Enable acknowledge on Own Address2 match address.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2EN LL_I2C_EnableOwnAddress2

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableOwnAddress2 ( I2C_TypeDef * p_i2c )

Disable acknowledge on Own Address2 match address.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2EN LL_I2C_DisableOwnAddress2

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledOwnAddress2 ( const I2C_TypeDef * p_i2c )

Check if Own Address1 acknowledge is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

OAR2 OA2EN LL_I2C_IsEnabledOwnAddress2

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_SetTiming ( I2C_TypeDef * p_i2c , uint32_t timing )

Configure the SDA setup, hold time and the SCL high, low period.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR TIMINGR LL_I2C_SetTiming

Note

This bit can only be programmed when the I2C is disabled (PE = 0).

Parameters :
  • p_i2c – I2C instance.

  • timing – This parameter must be a value between Min_Data=0 and Max_Data=0xF0FFFFFFU. This parameter is computed with the STM32CubeMX Tool. Bit 24 to 27 are reserved.

uint32_t LL_I2C_GetTiming ( const I2C_TypeDef * p_i2c )

Get the SDA setup, hold time and the SCL high, low period.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR TIMINGR LL_I2C_GetTiming

Note

This parameter can be computed with the STM32CubeMX Tool.

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0 and Max_Data=0xFFFFFFFF.

uint32_t LL_I2C_GetTimingPrescaler ( const I2C_TypeDef * p_i2c )

Get the timing Prescaler setting.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR PRESC LL_I2C_GetTimingPrescaler

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0xF

uint32_t LL_I2C_GetClockLowPeriod ( const I2C_TypeDef * p_i2c )

Get the SCL low period setting.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR SCLL LL_I2C_GetClockLowPeriod

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x00 and Max_Data=0xFF

uint32_t LL_I2C_GetClockHighPeriod ( const I2C_TypeDef * p_i2c )

Get the SCL high period setting.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR SCLH LL_I2C_GetClockHighPeriod

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x00 and Max_Data=0xFF

uint32_t LL_I2C_GetDataHoldTime ( const I2C_TypeDef * p_i2c )

Get the SDA hold time.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR SDADEL LL_I2C_GetDataHoldTime

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0xF

uint32_t LL_I2C_GetDataSetupTime ( const I2C_TypeDef * p_i2c )

Get the SDA setup time.

Reference Manual to LL API cross reference (Register Field Functions)

TIMINGR SCLDEL LL_I2C_GetDataSetupTime

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0xF

void LL_I2C_SetMode ( I2C_TypeDef * p_i2c , uint32_t peripheral_mode )

Configure peripheral mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 SMBHEN LL_I2C_SetMode

CR1 SMBDEN LL_I2C_SetMode

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :
uint32_t LL_I2C_GetMode ( const I2C_TypeDef * p_i2c )

Get peripheral mode.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 SMBHEN LL_I2C_GetMode

CR1 SMBDEN LL_I2C_GetMode

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

Returned – value can be one of the following values:

void LL_I2C_EnableSMBusAlert ( I2C_TypeDef * p_i2c )

Enable SMBus alert (Host or Device mode)

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ALERTEN LL_I2C_EnableSMBusAlert

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

SMBus Device mode:

  • SMBus Alert pin is drived low and Alert Response Address Header acknowledge is enabled. SMBus Host mode:

  • SMBus Alert pin management is supported.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableSMBusAlert ( I2C_TypeDef * p_i2c )

Disable SMBus alert (Host or Device mode)

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ALERTEN LL_I2C_DisableSMBusAlert

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

SMBus Device mode:

  • SMBus Alert pin is not drived (can be used as a standard GPIO) and Alert Response Address Header acknowledge is disabled. SMBus Host mode:

  • SMBus Alert pin management is not supported.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledSMBusAlert ( const I2C_TypeDef * p_i2c )

Check if SMBus alert (Host or Device mode) is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ALERTEN LL_I2C_IsEnabledSMBusAlert

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableSMBusPEC ( I2C_TypeDef * p_i2c )

Enable SMBus Packet Error Calculation (PEC).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PECEN LL_I2C_EnableSMBusPEC

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableSMBusPEC ( I2C_TypeDef * p_i2c )

Disable SMBus Packet Error Calculation (PEC).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PECEN LL_I2C_DisableSMBusPEC

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledSMBusPEC ( const I2C_TypeDef * p_i2c )

Check if SMBus Packet Error Calculation (PEC) is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 PECEN LL_I2C_IsEnabledSMBusPEC

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_ConfigSMBusTimeout ( I2C_TypeDef * p_i2c , uint32_t timeout_a , uint32_t timeout_a_mode , uint32_t timeout_b )

Configure the SMBus Clock Timeout.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMEOUTA LL_I2C_ConfigSMBusTimeout

TIMEOUTR TIDLE LL_I2C_ConfigSMBusTimeout

TIMEOUTR TIMEOUTB LL_I2C_ConfigSMBusTimeout

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

This configuration can only be programmed when associated Timeout is disabled (timeout_a and/or timeout_b).

Parameters :
void LL_I2C_SetSMBusTimeoutA ( I2C_TypeDef * p_i2c , uint32_t timeout_a )

Configure the SMBus Clock timeout_a (SCL low timeout or SCL and SDA high timeout depends on timeout_a mode).

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMEOUTA LL_I2C_SetSMBusTimeoutA

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

These bits can only be programmed when timeout_a is disabled.

Parameters :
  • p_i2c – I2C instance.

  • timeout_a – This parameter must be a value between Min_Data=0 and Max_Data=0xFFF.

uint32_t LL_I2C_GetSMBusTimeoutA ( const I2C_TypeDef * p_i2c )

Get the SMBus Clock timeout_a setting.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMEOUTA LL_I2C_GetSMBusTimeoutA

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0 and Max_Data=0xFFF

void LL_I2C_SetSMBusTimeoutAMode ( I2C_TypeDef * p_i2c , uint32_t timeout_a_mode )

Set the SMBus Clock timeout_a mode.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIDLE LL_I2C_SetSMBusTimeoutAMode

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

This bit can only be programmed when timeout_a is disabled.

Parameters :
uint32_t LL_I2C_GetSMBusTimeoutAMode ( const I2C_TypeDef * p_i2c )

Get the SMBus Clock timeout_a mode.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIDLE LL_I2C_GetSMBusTimeoutAMode

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

Returned – value can be one of the following values:

void LL_I2C_SetSMBusTimeoutB ( I2C_TypeDef * p_i2c , uint32_t timeout_b )

Configure the SMBus Extended Cumulative Clock timeout_b (Master or Slave mode).

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMEOUTB LL_I2C_SetSMBusTimeoutB

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

These bits can only be programmed when timeout_b is disabled.

Parameters :
  • p_i2c – I2C instance.

  • timeout_b – This parameter must be a value between Min_Data=0 and Max_Data=0xFFF.

uint32_t LL_I2C_GetSMBusTimeoutB ( const I2C_TypeDef * p_i2c )

Get the SMBus Extended Cumulative Clock timeout_b setting.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMEOUTB LL_I2C_GetSMBusTimeoutB

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0 and Max_Data=0xFFF

void LL_I2C_EnableSMBusTimeout ( I2C_TypeDef * p_i2c , uint32_t clock_timeout )

Enable the SMBus Clock Timeout.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMOUTEN LL_I2C_EnableSMBusTimeout

TIMEOUTR TEXTEN LL_I2C_EnableSMBusTimeout

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :
void LL_I2C_DisableSMBusTimeout ( I2C_TypeDef * p_i2c , uint32_t clock_timeout )

Disable the SMBus Clock Timeout.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMOUTEN LL_I2C_DisableSMBusTimeout

TIMEOUTR TEXTEN LL_I2C_DisableSMBusTimeout

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :
uint32_t LL_I2C_IsEnabledSMBusTimeout ( const I2C_TypeDef * p_i2c , uint32_t clock_timeout )

Check if the SMBus Clock Timeout is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

TIMEOUTR TIMOUTEN LL_I2C_IsEnabledSMBusTimeout

TIMEOUTR TEXTEN LL_I2C_IsEnabledSMBusTimeout

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :
Return values :

State – of bit (1 or 0).

IT_Management

group I2C_LL_EF_IT_Management

Functions

void LL_I2C_EnableIT_TX ( I2C_TypeDef * p_i2c )

Enable TXIS interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_EnableIT_TX

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_TX ( I2C_TypeDef * p_i2c )

Disable TXIS interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_DisableIT_TX

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_TX ( const I2C_TypeDef * p_i2c )

Check if the TXIS Interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_IsEnabledIT_TX

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_RX ( I2C_TypeDef * p_i2c )

Enable RXNE interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXIE LL_I2C_EnableIT_RX

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_RX ( I2C_TypeDef * p_i2c )

Disable RXNE interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXIE LL_I2C_DisableIT_RX

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_RX ( const I2C_TypeDef * p_i2c )

Check if the RXNE Interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 RXIE LL_I2C_IsEnabledIT_RX

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_ADDR ( I2C_TypeDef * p_i2c )

Enable Address match interrupt (slave mode only).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRIE LL_I2C_EnableIT_ADDR

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_ADDR ( I2C_TypeDef * p_i2c )

Disable Address match interrupt (slave mode only).

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRIE LL_I2C_DisableIT_ADDR

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_ADDR ( const I2C_TypeDef * p_i2c )

Check if Address match interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ADDRIE LL_I2C_IsEnabledIT_ADDR

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_NACK ( I2C_TypeDef * p_i2c )

Enable Not acknowledge received interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NACKIE LL_I2C_EnableIT_NACK

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_NACK ( I2C_TypeDef * p_i2c )

Disable Not acknowledge received interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NACKIE LL_I2C_DisableIT_NACK

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_NACK ( const I2C_TypeDef * p_i2c )

Check if Not acknowledge received interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 NACKIE LL_I2C_IsEnabledIT_NACK

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_STOP ( I2C_TypeDef * p_i2c )

Enable STOP detection interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPIE LL_I2C_EnableIT_STOP

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_STOP ( I2C_TypeDef * p_i2c )

Disable STOP detection interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPIE LL_I2C_DisableIT_STOP

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_STOP ( const I2C_TypeDef * p_i2c )

Check if STOP detection interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 STOPIE LL_I2C_IsEnabledIT_STOP

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_TC ( I2C_TypeDef * p_i2c )

Enable Transfer Complete interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TCIE LL_I2C_EnableIT_TC

Note

Any of these events generates interrupt : Transfer Complete (TC) Transfer Complete Reload (TCR)

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_TC ( I2C_TypeDef * p_i2c )

Disable Transfer Complete interrupt.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TCIE LL_I2C_DisableIT_TC

Note

Any of these events generates interrupt : Transfer Complete (TC) Transfer Complete Reload (TCR)

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_TC ( const I2C_TypeDef * p_i2c )

Check if Transfer Complete interrupt is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TCIE LL_I2C_IsEnabledIT_TC

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT_ERR ( I2C_TypeDef * p_i2c )

Enable Error interrupts.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ERRIE LL_I2C_EnableIT_ERR

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

Any of these errors generates interrupt : Arbitration Loss (ARLO) Bus Error detection (BERR) Overrun/Underrun (OVR) SMBus Timeout detection (TIMEOUT) SMBus PEC error detection (PECERR) SMBus Alert pin event detection (ALERT)

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableIT_ERR ( I2C_TypeDef * p_i2c )

Disable Error interrupts.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ERRIE LL_I2C_DisableIT_ERR

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

Any of these errors generates interrupt : Arbitration Loss (ARLO) Bus Error detection (BERR) Overrun/Underrun (OVR) SMBus Timeout detection (TIMEOUT) SMBus PEC error detection (PECERR) SMBus Alert pin event detection (ALERT)

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledIT_ERR ( const I2C_TypeDef * p_i2c )

Check if Error interrupts are enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 ERRIE LL_I2C_IsEnabledIT_ERR

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableIT ( I2C_TypeDef * p_i2c , uint32_t mask )

Enable the specified I2C interrupts.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_EnableIT

CR1 RXIE LL_I2C_EnableIT

CR1 ADDRIE LL_I2C_EnableIT

CR1 NACKIE LL_I2C_EnableIT

CR1 STOPIE LL_I2C_EnableIT

CR1 TCIE LL_I2C_EnableIT

CR1 ERRIE LL_I2C_EnableIT

Parameters :
void LL_I2C_DisableIT ( I2C_TypeDef * p_i2c , uint32_t mask )

Disable the specified I2C interrupts.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_DisableIT

CR1 RXIE LL_I2C_DisableIT

CR1 ADDRIE LL_I2C_DisableIT

CR1 NACKIE LL_I2C_DisableIT

CR1 STOPIE LL_I2C_DisableIT

CR1 TCIE LL_I2C_DisableIT

CR1 ERRIE LL_I2C_DisableIT

Parameters :
uint32_t LL_I2C_IsEnabledIT ( const I2C_TypeDef * p_i2c , uint32_t mask )

Check whether the specified I2C interrupts sources are enabled or not.

Reference Manual to LL API cross reference (Register Field Functions)

CR1 TXIE LL_I2C_GetITSource

CR1 RXIE LL_I2C_GetITSource

CR1 ADDRIE LL_I2C_GetITSource

CR1 NACKIE LL_I2C_GetITSource

CR1 STOPIE LL_I2C_GetITSource

CR1 TCIE LL_I2C_GetITSource

CR1 ERRIE LL_I2C_GetITSource

Parameters :
Return values :

State – of interrupts sources (1 or 0).

FLAG_management

group I2C_LL_EF_FLAG_management

Functions

uint32_t LL_I2C_IsActiveFlag ( const I2C_TypeDef * p_i2c , uint32_t mask )

Indicate the status of a mask of flags.

Reference Manual to LL API cross reference (Register Field Functions)

ISR I2C_ISR_TXE LL_I2C_IsActiveFlag

ISR I2C_ISR_TXIS LL_I2C_IsActiveFlag

ISR I2C_ISR_RXNE LL_I2C_IsActiveFlag

ISR I2C_ISR_ADDR LL_I2C_IsActiveFlag

ISR I2C_ISR_NACKF LL_I2C_IsActiveFlag

ISR I2C_ISR_STOPF LL_I2C_IsActiveFlag

ISR I2C_ISR_TC LL_I2C_IsActiveFlag

ISR I2C_ISR_TCR LL_I2C_IsActiveFlag

ISR I2C_ISR_BERR LL_I2C_IsActiveFlag

ISR I2C_ISR_ARLO LL_I2C_IsActiveFlag

ISR I2C_ISR_OVR LL_I2C_IsActiveFlag

ISR I2C_ISR_PECERR LL_I2C_IsActiveFlag

ISR I2C_ISR_TIMEOUT LL_I2C_IsActiveFlag

ISR I2C_ISR_ALERT LL_I2C_IsActiveFlag

ISR I2C_ISR_BUSY LL_I2C_IsActiveFlag

ISR I2C_ISR_DIR LL_I2C_IsActiveFlag

Parameters :
Return values :

State – of interrupts sources (1 or 0).

uint32_t LL_I2C_IsActiveFlag_TXE ( const I2C_TypeDef * p_i2c )

Indicate the status of Transmit data register empty flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR TXE LL_I2C_IsActiveFlag_TXE

Note

RESET: When next data is written in Transmit data register. SET: When Transmit data register is empty.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_TXIS ( const I2C_TypeDef * p_i2c )

Indicate the status of Transmit interrupt flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR TXIS LL_I2C_IsActiveFlag_TXIS

Note

RESET: When next data is written in Transmit data register. SET: When Transmit data register is empty.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_RXNE ( const I2C_TypeDef * p_i2c )

Indicate the status of Receive data register not empty flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR RXNE LL_I2C_IsActiveFlag_RXNE

Note

RESET: When Receive data register is read. SET: When the received data is copied in Receive data register.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_ADDR ( const I2C_TypeDef * p_i2c )

Indicate the status of Address matched flag (slave mode).

Reference Manual to LL API cross reference (Register Field Functions)

ISR ADDR LL_I2C_IsActiveFlag_ADDR

Note

RESET: Clear default value. SET: When the received slave address matched with one of the enabled slave address.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_NACK ( const I2C_TypeDef * p_i2c )

Indicate the status of Not Acknowledge received flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR NACKF LL_I2C_IsActiveFlag_NACK

Note

RESET: Clear default value. SET: When a NACK is received after a byte transmission.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_STOP ( const I2C_TypeDef * p_i2c )

Indicate the status of Stop detection flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR STOPF LL_I2C_IsActiveFlag_STOP

Note

RESET: Clear default value. SET: When a Stop condition is detected.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_TC ( const I2C_TypeDef * p_i2c )

Indicate the status of Transfer complete flag (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

ISR TC LL_I2C_IsActiveFlag_TC

Note

RESET: Clear default value. SET: When RELOAD=0, AUTOEND=0 and NBYTES date have been transferred.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_TCR ( const I2C_TypeDef * p_i2c )

Indicate the status of Transfer complete flag (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

ISR TCR LL_I2C_IsActiveFlag_TCR

Note

RESET: Clear default value. SET: When RELOAD=1 and NBYTES date have been transferred.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_BERR ( const I2C_TypeDef * p_i2c )

Indicate the status of Bus error flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR BERR LL_I2C_IsActiveFlag_BERR

Note

RESET: Clear default value. SET: When a misplaced Start or Stop condition is detected.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_ARLO ( const I2C_TypeDef * p_i2c )

Indicate the status of Arbitration lost flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR ARLO LL_I2C_IsActiveFlag_ARLO

Note

RESET: Clear default value. SET: When arbitration lost.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_OVR ( const I2C_TypeDef * p_i2c )

Indicate the status of Overrun/Underrun flag (slave mode).

Reference Manual to LL API cross reference (Register Field Functions)

ISR OVR LL_I2C_IsActiveFlag_OVR

Note

RESET: Clear default value. SET: When an overrun/underrun error occurs (Clock Stretching Disabled).

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveSMBusFlag_PECERR ( const I2C_TypeDef * p_i2c )

Indicate the status of SMBus PEC error flag in reception.

Reference Manual to LL API cross reference (Register Field Functions)

ISR PECERR LL_I2C_IsActiveSMBusFlag_PECERR

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

RESET: Clear default value. SET: When the received PEC does not match with the PEC register content.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveSMBusFlag_TIMEOUT ( const I2C_TypeDef * p_i2c )

Indicate the status of SMBus Timeout detection flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR TIMEOUT LL_I2C_IsActiveSMBusFlag_TIMEOUT

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

RESET: Clear default value. SET: When a timeout or extended clock timeout occurs.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveSMBusFlag_ALERT ( const I2C_TypeDef * p_i2c )

Indicate the status of SMBus alert flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR ALERT LL_I2C_IsActiveSMBusFlag_ALERT

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

RESET: Clear default value. SET: When SMBus host configuration, SMBus alert enabled and a falling edge event occurs on SMBA pin.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_IsActiveFlag_BUSY ( const I2C_TypeDef * p_i2c )

Indicate the status of Bus Busy flag.

Reference Manual to LL API cross reference (Register Field Functions)

ISR BUSY LL_I2C_IsActiveFlag_BUSY

Note

RESET: Clear default value. SET: When a Start condition is detected.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_ClearFlag_ADDR ( I2C_TypeDef * p_i2c )

Clear Address Matched flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR ADDRCF LL_I2C_ClearFlag_ADDR

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_NACK ( I2C_TypeDef * p_i2c )

Clear Not Acknowledge flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR NACKCF LL_I2C_ClearFlag_NACK

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_STOP ( I2C_TypeDef * p_i2c )

Clear Stop detection flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR STOPCF LL_I2C_ClearFlag_STOP

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_TXE ( I2C_TypeDef * p_i2c )

Clear Transmit data register empty flag (TXE).

Reference Manual to LL API cross reference (Register Field Functions)

ISR TXE LL_I2C_ClearFlag_TXE

Note

This bit can be clear by software in order to flush the transmit data register (TXDR).

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_BERR ( I2C_TypeDef * p_i2c )

Clear Bus error flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR BERRCF LL_I2C_ClearFlag_BERR

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_ARLO ( I2C_TypeDef * p_i2c )

Clear Arbitration lost flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR ARLOCF LL_I2C_ClearFlag_ARLO

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearFlag_OVR ( I2C_TypeDef * p_i2c )

Clear Overrun/Underrun flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR OVRCF LL_I2C_ClearFlag_OVR

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearSMBusFlag_PECERR ( I2C_TypeDef * p_i2c )

Clear SMBus PEC error flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR PECCF LL_I2C_ClearSMBusFlag_PECERR

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearSMBusFlag_TIMEOUT ( I2C_TypeDef * p_i2c )

Clear SMBus Timeout detection flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR TIMOUTCF LL_I2C_ClearSMBusFlag_TIMEOUT

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

void LL_I2C_ClearSMBusFlag_ALERT ( I2C_TypeDef * p_i2c )

Clear SMBus Alert flag.

Reference Manual to LL API cross reference (Register Field Functions)

ICR ALERTCF LL_I2C_ClearSMBusFlag_ALERT

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Data_Management

group I2C_LL_EF_Data_Management

Functions

void LL_I2C_EnableAutoEndMode ( I2C_TypeDef * p_i2c )

Enable automatic STOP condition generation (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 AUTOEND LL_I2C_EnableAutoEndMode

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.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableAutoEndMode ( I2C_TypeDef * p_i2c )

Disable automatic STOP condition generation (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 AUTOEND LL_I2C_DisableAutoEndMode

Note

Software end mode : TC flag is set when NBYTES data are transferre, stretching SCL low.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledAutoEndMode ( const I2C_TypeDef * p_i2c )

Check if automatic STOP condition is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 AUTOEND LL_I2C_IsEnabledAutoEndMode

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_EnableReloadMode ( I2C_TypeDef * p_i2c )

Enable reload mode (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 RELOAD LL_I2C_EnableReloadMode

Note

The transfer is not completed after the NBYTES data transfer, NBYTES is reloaded when TCR flag is set.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableReloadMode ( I2C_TypeDef * p_i2c )

Disable reload mode (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 RELOAD LL_I2C_DisableReloadMode

Note

The transfer is completed after the NBYTES data transfer(STOP or RESTART follows).

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledReloadMode ( const I2C_TypeDef * p_i2c )

Check if reload mode is enabled or disabled.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 RELOAD LL_I2C_IsEnabledReloadMode

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_SetTransferSize ( I2C_TypeDef * p_i2c , uint32_t xfer_size )

Configure the number of bytes for transfer.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 NBYTES LL_I2C_SetTransferSize

Note

Changing these bits when START bit is set is not allowed.

Parameters :
  • p_i2c – I2C instance.

  • xfer_size – This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.

uint32_t LL_I2C_GetTransferSize ( const I2C_TypeDef * p_i2c )

Get the number of bytes configured for transfer.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 NBYTES LL_I2C_GetTransferSize

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0xFF

void LL_I2C_AcknowledgeNextData ( I2C_TypeDef * p_i2c , uint32_t type_acknowledge )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 NACK LL_I2C_AcknowledgeNextData

Note

Usage in Slave mode only.

Parameters :
void LL_I2C_AcknowledgeDisable ( I2C_TypeDef * p_i2c )

Disable Address Acknowledge.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 NACK LL_I2C_AcknowledgeNextData

Parameters :

p_i2c – I2C instance.

void LL_I2C_AcknowledgeEnable ( I2C_TypeDef * p_i2c )

Enable Address Acknowledge.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 NACK LL_I2C_AcknowledgeEnable

Parameters :

p_i2c – I2C instance.

void LL_I2C_GenerateStartCondition ( I2C_TypeDef * p_i2c )

Generate a START or RESTART condition.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 START LL_I2C_GenerateStartCondition

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.

Parameters :

p_i2c – I2C instance.

void LL_I2C_GenerateStopCondition ( I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 STOP LL_I2C_GenerateStopCondition

Parameters :

p_i2c – I2C instance.

void LL_I2C_EnableAuto10BitRead ( I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 HEAD10R LL_I2C_EnableAuto10BitRead

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.

Parameters :

p_i2c – I2C instance.

void LL_I2C_DisableAuto10BitRead ( I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 HEAD10R LL_I2C_DisableAuto10BitRead

Note

The master only sends the first 7 bits of 10bit address in Read direction.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledAuto10BitRead ( const I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 HEAD10R LL_I2C_IsEnabledAuto10BitRead

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

void LL_I2C_SetTransferRequest ( I2C_TypeDef * p_i2c , uint32_t xfer_request )

Configure the transfer direction (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 RD_WRN LL_I2C_SetTransferRequest

Note

Changing these bits when START bit is set is not allowed.

Parameters :
uint32_t LL_I2C_GetTransferRequest ( const I2C_TypeDef * p_i2c )

Get the transfer direction requested (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 RD_WRN LL_I2C_GetTransferRequest

Parameters :

p_i2c – I2C instance.

Return values :

Returned – value can be one of the following values:

void LL_I2C_SetSlaveAddr ( I2C_TypeDef * p_i2c , uint32_t slave_addr )

Configure the slave address for transfer (master mode).

Reference Manual to LL API cross reference (Register Field Functions)

CR2 SADD LL_I2C_SetSlaveAddr

Note

Changing these bits when START bit is set is not allowed.

Parameters :
  • p_i2c – I2C instance.

  • slave_addr – This parameter must be a value between Min_Data=0x00 and Max_Data=0x3F.

uint32_t LL_I2C_GetSlaveAddr ( const I2C_TypeDef * p_i2c )

Get the slave address programmed for transfer.

Reference Manual to LL API cross reference (Register Field Functions)

CR2 SADD LL_I2C_GetSlaveAddr

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x0 and Max_Data=0x3F

void LL_I2C_HandleTransfer ( I2C_TypeDef * p_i2c , uint32_t slave_addr , uint32_t slave_addr_size , uint32_t xfer_size , uint32_t end_mode , uint32_t request )

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

Reference Manual to LL API cross reference (Register Field Functions)

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 :
uint32_t LL_I2C_GetTransferDirection ( const I2C_TypeDef * p_i2c )

Indicate the value of transfer direction (slave mode).

Reference Manual to LL API cross reference (Register Field Functions)

ISR DIR LL_I2C_GetTransferDirection

Note

RESET: Write transfer, Slave enters in receiver mode. SET: Read transfer, Slave enters in transmitter mode.

Parameters :

p_i2c – I2C instance.

Return values :

Returned – value can be one of the following values:

uint32_t LL_I2C_GetAddressMatchCode ( const I2C_TypeDef * p_i2c )

Return the slave matched address.

Reference Manual to LL API cross reference (Register Field Functions)

ISR ADDCODE LL_I2C_GetAddressMatchCode

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x00 and Max_Data=0x3F

void LL_I2C_EnableSMBusPECCompare ( I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 PECBYTE LL_I2C_EnableSMBusPECCompare

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Note

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.

Parameters :

p_i2c – I2C instance.

uint32_t LL_I2C_IsEnabledSMBusPECCompare ( const I2C_TypeDef * p_i2c )

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

Reference Manual to LL API cross reference (Register Field Functions)

CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

State – of bit (1 or 0).

uint32_t LL_I2C_GetSMBusPEC ( const I2C_TypeDef * p_i2c )

Get the SMBus Packet Error byte calculated.

Reference Manual to LL API cross reference (Register Field Functions)

PECR PEC LL_I2C_GetSMBusPEC

Note

The macro IS_SMBUS_ALL_INSTANCE(p_i2c) can be used to check whether or not SMBus feature is supported by the p_i2c instance.

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x00 and Max_Data=0xFF

uint8_t LL_I2C_ReceiveData8 ( const I2C_TypeDef * p_i2c )

Read Receive data register.

Reference Manual to LL API cross reference (Register Field Functions)

RXDR RXDATA LL_I2C_ReceiveData8

Parameters :

p_i2c – I2C instance.

Return values :

Value – between Min_Data=0x00 and Max_Data=0xFF

void LL_I2C_TransmitData8 ( I2C_TypeDef * p_i2c , uint8_t data )

Write in Transmit data Register .

Reference Manual to LL API cross reference (Register Field Functions)

TXDR TXDATA LL_I2C_TransmitData8

Parameters :
  • p_i2c – I2C instance.

  • data – Value between Min_Data=0x00 and Max_Data=0xFF