diff options
author | Alex Voinea <voinea.dragos.alexandru@gmail.com> | 2023-01-03 19:43:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-03 12:43:46 -0500 |
commit | 9c2ccceb9f4890abe9d2c8a0953ae59fd529b8ef (patch) | |
tree | 706002d244b96368930ad777d434fcbcdf014815 /src/stm32/stm32f0_i2c.c | |
parent | b337cc3ee87c6620d2211a08e5568d59ad92b681 (diff) | |
download | kutter-9c2ccceb9f4890abe9d2c8a0953ae59fd529b8ef.tar.gz kutter-9c2ccceb9f4890abe9d2c8a0953ae59fd529b8ef.tar.xz kutter-9c2ccceb9f4890abe9d2c8a0953ae59fd529b8ef.zip |
stm32: Expand stm32g0 family (#5838)
Add stm32g07x family support.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Diffstat (limited to 'src/stm32/stm32f0_i2c.c')
-rw-r--r-- | src/stm32/stm32f0_i2c.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/stm32/stm32f0_i2c.c b/src/stm32/stm32f0_i2c.c index 6096b673..9e8994fc 100644 --- a/src/stm32/stm32f0_i2c.c +++ b/src/stm32/stm32f0_i2c.c @@ -27,27 +27,34 @@ DECL_ENUMERATION("i2c_bus", "i2c1", 0); DECL_CONSTANT_STR("BUS_PINS_i2c1", "PB6,PB7"); DECL_ENUMERATION("i2c_bus", "i2c1a", 1); DECL_CONSTANT_STR("BUS_PINS_i2c1a", "PF1,PF0"); - -#elif CONFIG_MACH_STM32G0 || CONFIG_MACH_STM32L4 +#elif CONFIG_MACH_STM32G0 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"); -#if CONFIG_MACH_STM32G0 -#define GPIO_AF_INDEX 6 -DECL_ENUMERATION("i2c_bus", "i2c3_PB3_PB4", 2); +DECL_ENUMERATION("i2c_bus", "i2c1_PA9_PA10", 2); +DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10"); +DECL_ENUMERATION("i2c_bus", "i2c2_PB10_PB11", 3); +DECL_CONSTANT_STR("BUS_PINS_i2c2_PB10_PB11", "PB10,PB11"); +DECL_ENUMERATION("i2c_bus", "i2c2_PB13_PB14", 4); +DECL_CONSTANT_STR("BUS_PINS_i2c2_PB13_PB14", "PB13,PB14"); +#ifdef I2C3 +DECL_ENUMERATION("i2c_bus", "i2c3_PB3_PB4", 5); DECL_CONSTANT_STR("BUS_PINS_i2c3_PB3_PB4", "PB3,PB4"); -#elif CONFIG_MACH_STM32L4 -#define GPIO_AF_INDEX 4 -DECL_ENUMERATION("i2c_bus", "i2c3_PA7_PB4", 2); -DECL_CONSTANT_STR("BUS_PINS_i2c3_PA7_PB4", "PA7,PB4"); #endif +#elif CONFIG_MACH_STM32L4 +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", "i2c1_PA9_PA10", 2); +DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10"); DECL_ENUMERATION("i2c_bus", "i2c2_PB10_PB11", 3); DECL_CONSTANT_STR("BUS_PINS_i2c2_PB10_PB11", "PB10,PB11"); DECL_ENUMERATION("i2c_bus", "i2c2_PB13_PB14", 4); DECL_CONSTANT_STR("BUS_PINS_i2c2_PB13_PB14", "PB13,PB14"); -DECL_ENUMERATION("i2c_bus", "i2c1_PA9_PA10", 5); -DECL_CONSTANT_STR("BUS_PINS_i2c1_PA9_PA10", "PA9,PA10"); +DECL_ENUMERATION("i2c_bus", "i2c3_PA7_PB4", 5); +DECL_CONSTANT_STR("BUS_PINS_i2c3_PA7_PB4", "PA7,PB4"); #elif CONFIG_MACH_STM32G4 DECL_ENUMERATION("i2c_bus", "i2c1_PA13_PA14", 0); DECL_CONSTANT_STR("BUS_PINS_i2c1_PA13_PA14", "PA13,PA14"); @@ -72,18 +79,22 @@ static const struct i2c_info i2c_bus[] = { { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(1) }, { I2C1, GPIO('F', 1), GPIO('F', 0), GPIO_FUNCTION(1) }, { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(1) }, - -#elif CONFIG_MACH_STM32G0 || CONFIG_MACH_STM32L4 - { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(GPIO_AF_INDEX) }, - { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(GPIO_AF_INDEX) }, -#if CONFIG_MACH_STM32G0 - { I2C3, GPIO('B', 3), GPIO('B', 4), GPIO_FUNCTION(GPIO_AF_INDEX) }, -#elif CONFIG_MACH_STM32L4 - { I2C3, GPIO('A', 7), GPIO('B', 4), GPIO_FUNCTION(GPIO_AF_INDEX) }, +#elif CONFIG_MACH_STM32G0 + { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(6) }, + { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(6) }, + { I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(6) }, + { I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(6) }, + { I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(6) }, +#ifdef I2C3 + { I2C3, GPIO('B', 3), GPIO('B', 4), GPIO_FUNCTION(6) }, #endif - { I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(GPIO_AF_INDEX) }, - { I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(GPIO_AF_INDEX) }, - { I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(GPIO_AF_INDEX) }, +#elif CONFIG_MACH_STM32L4 + { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(4) }, + { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(4) }, + { I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(4) }, + { I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(4) }, + { I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(4) }, + { I2C3, GPIO('A', 7), GPIO('B', 4), GPIO_FUNCTION(4) }, #elif CONFIG_MACH_STM32G4 { I2C1, GPIO('A', 13), GPIO('A', 14), GPIO_FUNCTION(4) }, { I2C1, GPIO('A', 15), GPIO('A', 14), GPIO_FUNCTION(4) }, |