aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/stm32f1
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/stm32f1')
-rw-r--r--libmaple/stm32f1/include/series/i2c.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libmaple/stm32f1/include/series/i2c.h b/libmaple/stm32f1/include/series/i2c.h
index f9f1e43..0c89df4 100644
--- a/libmaple/stm32f1/include/series/i2c.h
+++ b/libmaple/stm32f1/include/series/i2c.h
@@ -34,6 +34,7 @@
#define _LIBMAPLE_STM32F1_I2C_H_
#include <libmaple/i2c_common.h>
+#include <libmaple/stm32.h>
/*
* Register maps
@@ -53,4 +54,13 @@ struct i2c_reg_map;
extern i2c_dev* const I2C1;
extern i2c_dev* const I2C2;
+/*
+ * For internal use
+ */
+
+static inline uint32 _i2c_bus_clk(i2c_dev *dev) {
+ /* Both I2C peripherals are on APB1 */
+ return STM32_PCLK1 / (1000 * 1000);
+}
+
#endif /* _LIBMAPLE_STM32F1_I2C_H_ */