STM32F439xx HAL User Manual
Defines
Exported_Macros_Helper
I2C Exported Macros

Defines

#define __LL_I2C_FREQ_HZ_TO_MHZ(__PCLK__)   (uint32_t)((__PCLK__)/1000000U)
 Convert Peripheral Clock Frequency in Mhz.
#define __LL_I2C_FREQ_MHZ_TO_HZ(__PCLK__)   (uint32_t)((__PCLK__)*1000000U)
 Convert Peripheral Clock Frequency in Hz.
#define __LL_I2C_RISE_TIME(__FREQRANGE__, __SPEED__)   (uint32_t)(((__SPEED__) <= LL_I2C_MAX_SPEED_STANDARD) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))
 Compute I2C Clock rising time.
#define __LL_I2C_SPEED_TO_CCR(__PCLK__, __SPEED__, __DUTYCYCLE__)
 Compute Speed clock range to a Clock Control Register (I2C_CCR_CCR) value.
#define __LL_I2C_SPEED_STANDARD_TO_CCR(__PCLK__, __SPEED__)   (uint32_t)(((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CCR_CCR) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))
 Compute Speed Standard clock range to a Clock Control Register (I2C_CCR_CCR) value.
#define __LL_I2C_SPEED_FAST_TO_CCR(__PCLK__, __SPEED__, __DUTYCYCLE__)
 Compute Speed Fast clock range to a Clock Control Register (I2C_CCR_CCR) value.
#define __LL_I2C_10BIT_ADDRESS(__ADDRESS__)   ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))
 Get the Least significant bits of a 10-Bits address.
#define __LL_I2C_10BIT_HEADER_WRITE(__ADDRESS__)   ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))
 Convert a 10-Bits address to a 10-Bits header with Write direction.
#define __LL_I2C_10BIT_HEADER_READ(__ADDRESS__)   ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))
 Convert a 10-Bits address to a 10-Bits header with Read direction.

Define Documentation

#define __LL_I2C_10BIT_ADDRESS (   __ADDRESS__)    ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))

Get the Least significant bits of a 10-Bits address.

Parameters:
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 348 of file stm32f4xx_ll_i2c.h.

#define __LL_I2C_10BIT_HEADER_READ (   __ADDRESS__)    ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))

Convert a 10-Bits address to a 10-Bits header with Read direction.

Parameters:
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values:
Valuebetween Min_Data=0xF1 and Max_Data=0xF7

Definition at line 362 of file stm32f4xx_ll_i2c.h.

#define __LL_I2C_10BIT_HEADER_WRITE (   __ADDRESS__)    ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))

Convert a 10-Bits address to a 10-Bits header with Write direction.

Parameters:
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values:
Valuebetween Min_Data=0xF0 and Max_Data=0xF6

Definition at line 355 of file stm32f4xx_ll_i2c.h.

#define __LL_I2C_FREQ_HZ_TO_MHZ (   __PCLK__)    (uint32_t)((__PCLK__)/1000000U)

Convert Peripheral Clock Frequency in Mhz.

Parameters:
__PCLK__This parameter must be a value of peripheral clock (in Hz).
Return values:
Valueof peripheral clock (in Mhz)

Definition at line 292 of file stm32f4xx_ll_i2c.h.

Referenced by LL_I2C_ConfigSpeed(), and LL_I2C_SetPeriphClock().

#define __LL_I2C_FREQ_MHZ_TO_HZ (   __PCLK__)    (uint32_t)((__PCLK__)*1000000U)

Convert Peripheral Clock Frequency in Hz.

Parameters:
__PCLK__This parameter must be a value of peripheral clock (in Mhz).
Return values:
Valueof peripheral clock (in Hz)

Definition at line 299 of file stm32f4xx_ll_i2c.h.

Referenced by LL_I2C_GetPeriphClock().

#define __LL_I2C_RISE_TIME (   __FREQRANGE__,
  __SPEED__ 
)    (uint32_t)(((__SPEED__) <= LL_I2C_MAX_SPEED_STANDARD) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))

Compute I2C Clock rising time.

Parameters:
__FREQRANGE__This parameter must be a value of peripheral clock (in Mhz).
__SPEED__This parameter must be a value lower than 400kHz (in Hz).
Return values:
Valuebetween Min_Data=0x02 and Max_Data=0x3F

Definition at line 307 of file stm32f4xx_ll_i2c.h.

Referenced by LL_I2C_ConfigSpeed().

#define __LL_I2C_SPEED_FAST_TO_CCR (   __PCLK__,
  __SPEED__,
  __DUTYCYCLE__ 
)
Value:
(uint32_t)(((__DUTYCYCLE__) == LL_I2C_DUTYCYCLE_2)? \
                                                                            (((((__PCLK__) / ((__SPEED__) * 3U)) & I2C_CCR_CCR) == 0U)? 1U:((__PCLK__) / ((__SPEED__) * 3U))) : \
                                                                            (((((__PCLK__) / ((__SPEED__) * 25U)) & I2C_CCR_CCR) == 0U)? 1U:((__PCLK__) / ((__SPEED__) * 25U))))

Compute Speed Fast clock range to a Clock Control Register (I2C_CCR_CCR) value.

Parameters:
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value between Min_Data=100Khz and Max_Data=400Khz (in Hz).
__DUTYCYCLE__This parameter can be one of the following values:
Return values:
Valuebetween Min_Data=0x001 and Max_Data=0xFFF

Definition at line 339 of file stm32f4xx_ll_i2c.h.

#define __LL_I2C_SPEED_STANDARD_TO_CCR (   __PCLK__,
  __SPEED__ 
)    (uint32_t)(((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CCR_CCR) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))

Compute Speed Standard clock range to a Clock Control Register (I2C_CCR_CCR) value.

Parameters:
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value lower than 100kHz (in Hz).
Return values:
Valuebetween Min_Data=0x004 and Max_Data=0xFFF.

Definition at line 328 of file stm32f4xx_ll_i2c.h.

#define __LL_I2C_SPEED_TO_CCR (   __PCLK__,
  __SPEED__,
  __DUTYCYCLE__ 
)
Value:
(uint32_t)(((__SPEED__) <= LL_I2C_MAX_SPEED_STANDARD)? \
                                                                                  (__LL_I2C_SPEED_STANDARD_TO_CCR((__PCLK__), (__SPEED__))) : \
                                                                                  (__LL_I2C_SPEED_FAST_TO_CCR((__PCLK__), (__SPEED__), (__DUTYCYCLE__))))

Compute Speed clock range to a Clock Control Register (I2C_CCR_CCR) value.

Parameters:
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value lower than 400kHz (in Hz).
__DUTYCYCLE__This parameter can be one of the following values:
Return values:
Valuebetween Min_Data=0x004 and Max_Data=0xFFF, except in FAST DUTY mode where Min_Data=0x001.

Definition at line 318 of file stm32f4xx_ll_i2c.h.