diff --git a/boards/b-l072z-lrwan1/include/periph_conf.h b/boards/b-l072z-lrwan1/include/periph_conf.h index 3b14a8d8d9..697d01f53d 100644 --- a/boards/b-l072z-lrwan1/include/periph_conf.h +++ b/boards/b-l072z-lrwan1/include/periph_conf.h @@ -22,6 +22,7 @@ #include "periph_cpu.h" #include "l0/cfg_clock_32_16_1.h" #include "cfg_rtt_default.h" +#include "cfg_i2c1_pb8_pb9.h" #ifdef __cplusplus extern "C" { @@ -175,29 +176,6 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ -/** - * @name I2C configuration - * @{ - */ -static const i2c_conf_t i2c_config[] = { - { - .dev = I2C1, - .speed = I2C_SPEED_NORMAL, - .scl_pin = GPIO_PIN(PORT_B, 8), - .sda_pin = GPIO_PIN(PORT_B, 9), - .scl_af = GPIO_AF4, - .sda_af = GPIO_AF4, - .bus = APB1, - .rcc_mask = RCC_APB1ENR_I2C1EN, - .irqn = I2C1_IRQn - } -}; - -#define I2C_0_ISR isr_i2c1 - -#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) -/** @} */ - /** * @name RTC configuration * @{ diff --git a/boards/common/stm32/include/cfg_i2c1_pb8_pb9.h b/boards/common/stm32/include/cfg_i2c1_pb8_pb9.h index aad781d884..d1e734f5ee 100644 --- a/boards/common/stm32/include/cfg_i2c1_pb8_pb9.h +++ b/boards/common/stm32/include/cfg_i2c1_pb8_pb9.h @@ -53,9 +53,11 @@ static const i2c_conf_t i2c_config[] = { #elif CPU_FAM_STM32F7 .rcc_mask = RCC_APB1ENR_I2C1EN, .irqn = I2C1_ER_IRQn, -#elif CPU_FAM_STM32F0 +#elif CPU_FAM_STM32F0 || CPU_FAM_STM32L0 .rcc_mask = RCC_APB1ENR_I2C1EN, +#if CPU_FAM_STM32F0 .rcc_sw_mask = RCC_CFGR3_I2C1SW, +#endif .irqn = I2C1_IRQn, #endif } @@ -65,7 +67,7 @@ static const i2c_conf_t i2c_config[] = { #define I2C_0_ISR isr_i2c1_ev #elif CPU_FAM_STM32L4 || CPU_FAM_STM32F7 #define I2C_0_ISR isr_i2c1_er -#elif CPU_FAM_STM32F0 +#elif CPU_FAM_STM32F0 || CPU_FAM_STM32L0 #define I2C_0_ISR isr_i2c1 #endif