+#define I2C_BITBANG_HW_INIT \
+ do { \
+ RCC->APB2ENR |= RCC_APB2_GPIOB; \
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, SDA_PIN | SCL_PIN, GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ); \
+ } while (0)
+
+/**
+ * Half bit delay routine used to generate the correct timings.
+ */
+#define I2C_HALFBIT_DELAY() \
+ do { \
+ timer_delay(1); \
+ } while (0)
+
+
+/*
+ * New api
+ */
+#include <cfg/compiler.h>
+
+INLINE void i2c_sdaHi(int dev)
+{
+ (void)(dev);
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, SDA_PIN, GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ);
+}
+
+INLINE void i2c_sdaLo(int dev)
+{
+ (void)(dev);
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, SDA_PIN, GPIO_MODE_OUT_PP, GPIO_SPEED_50MHZ);
+}
+
+INLINE void i2c_sclHi(int dev)
+{
+ (void)(dev);
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, SCL_PIN, GPIO_MODE_IN_FLOATING, GPIO_SPEED_50MHZ);
+}
+
+INLINE void i2c_sclLo(int dev)
+{
+ (void)(dev);
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, SCL_PIN, GPIO_MODE_OUT_PP, GPIO_SPEED_50MHZ);
+}
+
+INLINE bool i2c_sdaIn(int dev)
+{
+ (void)(dev);
+ return stm32_gpioPinRead((struct stm32_gpio *)GPIOB_BASE, SDA_PIN);
+}
+
+INLINE bool i2c_sclIn(int dev)
+{
+ (void)(dev);
+ return stm32_gpioPinRead((struct stm32_gpio *)GPIOB_BASE, SCL_PIN);
+}