@@ -193,9 +193,9 @@ static I2C_HandleTypeDef *i2c_handles[I2C_NUM];
193193static uint32_t i2c_getClkFreq (I2C_TypeDef * i2c )
194194{
195195 uint32_t clkSrcFreq = 0 ;
196- #if defined(STM32WB0x )
196+ #if defined(STM32WB0x )|| defined( STM32WL3x )
197197 (void )i2c ; // Avoid unused parameter warning
198- clkSrcFreq = SystemCoreClock ;
198+ clkSrcFreq = SystemCoreClock / 4 ;
199199#else
200200#ifdef STM32H7xx
201201 PLL3_ClocksTypeDef PLL3_Clocks ;
@@ -515,7 +515,7 @@ static uint32_t i2c_getClkFreq(I2C_TypeDef *i2c)
515515 }
516516 }
517517#endif // I2C6_BASE
518- #endif /* STM32WB0x */
518+ #endif /* STM32WB0x || STM32WL3x */
519519 return clkSrcFreq ;
520520}
521521
@@ -759,7 +759,8 @@ void i2c_init(i2c_t *obj, uint32_t timing, uint32_t ownAddress)
759759
760760 obj -> irq = I2C1_EV_IRQn ;
761761#if !defined(STM32C0xx ) && !defined(STM32F0xx ) && !defined(STM32G0xx ) && \
762- !defined(STM32L0xx ) && !defined(STM32U0xx ) && !defined(STM32WB0x )
762+ !defined(STM32L0xx ) && !defined(STM32U0xx ) && !defined(STM32WB0x ) && \
763+ !defined(STM32WL3x )
763764 obj -> irqER = I2C1_ER_IRQn ;
764765#endif /* !STM32C0xx && !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
765766 i2c_handles [I2C1_INDEX ] = handle ;
@@ -773,7 +774,8 @@ void i2c_init(i2c_t *obj, uint32_t timing, uint32_t ownAddress)
773774 __HAL_RCC_I2C2_RELEASE_RESET ();
774775 obj -> irq = I2C2_EV_IRQn ;
775776#if !defined(STM32C0xx ) && !defined(STM32F0xx ) && !defined(STM32G0xx ) && \
776- !defined(STM32L0xx ) && !defined(STM32U0xx )
777+ !defined(STM32L0xx ) && !defined(STM32U0xx ) && !defined(STM32WB0x ) && \
778+ !defined(STM32WL3x )
777779 obj -> irqER = I2C2_ER_IRQn ;
778780#endif /* !STM32F0xx && !STM32G0xx && !STM32L0xx && !STM32U0xx */
779781 i2c_handles [I2C2_INDEX ] = handle ;
0 commit comments