diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 50db29d2..94384ec3 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -7,7 +7,7 @@ config STM32_SELECT default y select HAVE_GPIO select HAVE_GPIO_ADC - select HAVE_GPIO_I2C if !(MACH_STM32F031 || MACH_STM32H7) + select HAVE_GPIO_I2C if !(MACH_STM32F031) select HAVE_GPIO_SPI if !MACH_STM32F031 select HAVE_GPIO_SDIO if MACH_STM32F4 select HAVE_GPIO_HARD_PWM if MACH_STM32F1 || MACH_STM32F4 || MACH_STM32G0 || MACH_STM32H7 diff --git a/src/stm32/Makefile b/src/stm32/Makefile index 390ad8d5..fac9ed4a 100644 --- a/src/stm32/Makefile +++ b/src/stm32/Makefile @@ -57,6 +57,7 @@ src-$(CONFIG_MACH_STM32G4) += stm32/stm32f0_i2c.c src-$(CONFIG_MACH_STM32H7) += ../lib/stm32h7/system_stm32h7xx.c src-$(CONFIG_MACH_STM32H7) += stm32/stm32h7.c generic/armcm_timer.c src-$(CONFIG_MACH_STM32H7) += stm32/gpioperiph.c stm32/stm32h7_adc.c +src-$(CONFIG_MACH_STM32H7) += stm32/stm32f0_i2c.c src-$(CONFIG_MACH_STM32L4) += ../lib/stm32l4/system_stm32l4xx.c src-$(CONFIG_MACH_STM32L4) += stm32/stm32l4.c generic/armcm_timer.c src-$(CONFIG_MACH_STM32L4) += stm32/gpioperiph.c diff --git a/src/stm32/stm32f0_i2c.c b/src/stm32/stm32f0_i2c.c index a37306e8..48c3ae3e 100644 --- a/src/stm32/stm32f0_i2c.c +++ b/src/stm32/stm32f0_i2c.c @@ -72,6 +72,13 @@ struct i2c_info { DECL_CONSTANT_STR("BUS_PINS_i2c3_PC8_PC9", "PC8,PC9"); DECL_ENUMERATION("i2c_bus", "i2c3_PC8_PC11", 7); DECL_CONSTANT_STR("BUS_PINS_i2c3_PC8_PC11", "PC8,PC11"); +#elif CONFIG_MACH_STM32H7 + DECL_ENUMERATION("i2c_bus", "i2c1_PB6_PB7", 0); + DECL_CONSTANT_STR("BUS_PINS_i2c1_PB6_PB7", "PB6,PB7"); + DECL_ENUMERATION("i2c_bus", "i2c1_PB8_PB9", 1); + DECL_CONSTANT_STR("BUS_PINS_i2c1_PB8_PB9", "PB8,PB9"); + DECL_ENUMERATION("i2c_bus", "i2c2_PB10_PB11", 2); + DECL_CONSTANT_STR("BUS_PINS_i2c2_PB10_PB11", "PB10,PB11"); #endif static const struct i2c_info i2c_bus[] = { @@ -104,6 +111,10 @@ static const struct i2c_info i2c_bus[] = { { I2C2, GPIO('C', 4), GPIO('F', 0), GPIO_FUNCTION(4) }, { I2C3, GPIO('C', 8), GPIO('C', 9), GPIO_FUNCTION(8) }, { I2C3, GPIO('C', 8), GPIO('C', 11), GPIO_FUNCTION(8) }, +#elif CONFIG_MACH_STM32H7 + { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(4) }, + { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(4) }, + { I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(4) }, #endif };