LL I2C Macros

Common Write and read registers Macros

group I2C_LL_EM_WRITE_READ

Defines

LL_I2C_WRITE_REG ( instance , reg , value ) STM32_WRITE_REG((instance)->reg, (value))

Write a value in I2C register.

Parameters :
  • instance – I2C instance

  • reg – Register to be written

  • value – Value to be written in the register

LL_I2C_READ_REG ( instance , reg ) STM32_READ_REG((instance)->reg)

Read a value in I2C register.

Parameters :
  • instance – I2C instance

  • reg – Register to be read

Return values :

Register – value

Convert SDA SCL timings

group I2C_LL_EM_CONVERT_TIMINGS

Defines

LL_I2C_CONVERT_TIMINGS ( prescaller , setup_time , hold_time , sclh_priod , scll_period )

((((uint32_t)(prescaller) << I2C_TIMINGR_PRESC_Pos) & I2C_TIMINGR_PRESC) \

| (((uint32_t)(setup_time) << I2C_TIMINGR_SCLDEL_Pos) & I2C_TIMINGR_SCLDEL) \

| (((uint32_t)(hold_time) << I2C_TIMINGR_SDADEL_Pos) & I2C_TIMINGR_SDADEL) \

| (((uint32_t)(sclh_priod) << I2C_TIMINGR_SCLH_Pos) & I2C_TIMINGR_SCLH) \

| (((uint32_t)(scll_period) << I2C_TIMINGR_SCLL_Pos) & I2C_TIMINGR_SCLL))


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

Parameters :
  • prescaller – This parameter must be a value between Min_Data=0 and Max_Data=0xF.

  • setup_time – This parameter must be a value between Min_Data=0 and Max_Data=0xF. (tscldel = (SCLDEL+1)xtpresc)

  • hold_time – This parameter must be a value between Min_Data=0 and Max_Data=0xF. (tsdadel = SDADELxtpresc)

  • sclh_priod – This parameter must be a value between Min_Data=0 and Max_Data=0xFF. (tsclh = (SCLH+1)xtpresc)

  • scll_period – This parameter must be a value between Min_Data=0 and Max_Data=0xFF. (tscll = (SCLL+1)xtpresc)

Return values :

Value – between Min_Data=0 and Max_Data=0xFFFFFFFF