From 035b7871bf6b1c84a216267bf10f71d64dc9c778 Mon Sep 17 00:00:00 2001 From: Jerome Coutant Date: Fri, 8 Oct 2021 13:50:36 +0200 Subject: [PATCH] STM32Wx: I2C issue a "else" was missing for uint32_t i2c_get_pclk(I2CName i2c) if (i2c == I2C_1) { else if (i2c == I2C_2) { else if (i2c == I2C_3) { else { error("I2C: unknown instance"); --- targets/TARGET_STM/TARGET_STM32WB/i2c_device.c | 2 +- targets/TARGET_STM/TARGET_STM32WL/i2c_device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32WB/i2c_device.c b/targets/TARGET_STM/TARGET_STM32WB/i2c_device.c index 9b99d3a054..798f4e802f 100755 --- a/targets/TARGET_STM/TARGET_STM32WB/i2c_device.c +++ b/targets/TARGET_STM/TARGET_STM32WB/i2c_device.c @@ -46,7 +46,7 @@ uint32_t i2c_get_pclk(I2CName i2c) } } #if defined I2C2_BASE - if (i2c == I2C_2) { + else if (i2c == I2C_2) { clocksource = __HAL_RCC_GET_I2C2_SOURCE(); switch (clocksource) { case RCC_I2C2CLKSOURCE_PCLK1: diff --git a/targets/TARGET_STM/TARGET_STM32WL/i2c_device.c b/targets/TARGET_STM/TARGET_STM32WL/i2c_device.c index d4c022b3b5..10c30ec239 100755 --- a/targets/TARGET_STM/TARGET_STM32WL/i2c_device.c +++ b/targets/TARGET_STM/TARGET_STM32WL/i2c_device.c @@ -47,7 +47,7 @@ uint32_t i2c_get_pclk(I2CName i2c) } } #if defined I2C2_BASE - if (i2c == I2C_2) { + else if (i2c == I2C_2) { clocksource = __HAL_RCC_GET_I2C2_SOURCE(); switch (clocksource) { case RCC_I2C2CLKSOURCE_PCLK1: