Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-08-26 00:33:57 +0300
committerKevin O'Connor <kevin@koconnor.net>2022-09-06 01:22:32 +0300
commit7f98c8c7d85ed06961524badfabd2b514b5e3434 (patch)
tree8bf5df4c8e6dd8665b0cd4a8416420e78ff51cee
parent97a5b39aab9bb61aaf2181760886033a569626f7 (diff)
stm32: Fix i2c on stm32g0
Fix the gpio function. Also, add buses found only on stm32g0. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/stm32/stm32f0_i2c.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/stm32/stm32f0_i2c.c b/src/stm32/stm32f0_i2c.c
index df53aa29c..4c68779d0 100644
--- a/src/stm32/stm32f0_i2c.c
+++ b/src/stm32/stm32f0_i2c.c
@@ -15,14 +15,46 @@ struct i2c_info {
uint8_t scl_pin, sda_pin, function;
};
+#if CONFIG_MACH_STM32F0
+DECL_ENUMERATION("i2c_bus", "i2c1_PB6_PB7", 0);
+DECL_CONSTANT_STR("BUS_PINS_i2c1_PB6_PB7", "PB6,PB7");
+DECL_ENUMERATION("i2c_bus", "i2c1_PF1_PF0", 1);
+DECL_CONSTANT_STR("BUS_PINS_i2c1_PF1_PF0", "PF1,PF0");
+DECL_ENUMERATION("i2c_bus", "i2c1_PB8_PB9", 2);
+DECL_CONSTANT_STR("BUS_PINS_i2c1_PB8_PB9", "PB8,PB9");
+// Deprecated "i2c1a" style mappings
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
+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", "i2c3_PB3_PB4", 2);
+DECL_CONSTANT_STR("BUS_PINS_i2c3_PB3_PB4", "PB3,PB4");
+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");
+#endif
static const struct i2c_info i2c_bus[] = {
+#if CONFIG_MACH_STM32F0
{ 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
+ { I2C1, GPIO('B', 6), GPIO('B', 7), GPIO_FUNCTION(6) },
+ { I2C1, GPIO('B', 8), GPIO('B', 9), GPIO_FUNCTION(6) },
+ { I2C3, GPIO('B', 3), GPIO('B', 4), GPIO_FUNCTION(6) },
+ { I2C2, GPIO('B', 10), GPIO('B', 11), GPIO_FUNCTION(6) },
+ { I2C2, GPIO('B', 13), GPIO('B', 14), GPIO_FUNCTION(6) },
+ { I2C1, GPIO('A', 9), GPIO('A', 10), GPIO_FUNCTION(6) },
+#endif
};
struct i2c_config