+
+ RCC->APB2ENR |= RCC_APB2_GPIOB;
+ RCC->APB1ENR |= RCC_APB1_I2C1;
+
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, GPIO_I2C1_SCL_PIN,
+ GPIO_MODE_AF_OD, GPIO_SPEED_50MHZ);
+
+ stm32_gpioPinConfig((struct stm32_gpio *)GPIOB_BASE, GPIO_I2C1_SDA_PIN,
+ GPIO_MODE_AF_OD, GPIO_SPEED_50MHZ);
+
+ i2c->CR1 = 0;
+ i2c->CR2 = 0;
+ i2c->CCR = 0;
+ i2c->TRISE = 0;
+ i2c->OAR1 = 0;
+
+ i2c->CR2 |= CR2_FREQ_36MHZ;
+
+ /* Configure spi in standard mode */
+ #if CONFIG_I2C_FREQ <= 100000
+ i2c->TRISE |= (CR2_FREQ_36MHZ + 1);
+ i2c->CCR |= 4;
+ #else
+ #error fast mode not supported
+ #endif
+
+ i2c->CR1 |= CR1_PE_SET;
+ i2c->CR1 |= CR1_ACK_SET;