From 9ba028ef647bc033e5ec078acd7de9d5c28432a9 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Thu, 21 Jun 2012 16:30:16 -0400 Subject: STM32F1: i2c_config_gpios(): Do afio_remap() if we should. This should help avoid surprising some users. Signed-off-by: Marti Bolivar --- libmaple/stm32f1/i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libmaple/stm32f1/i2c.c b/libmaple/stm32f1/i2c.c index 4c9af30..5797940 100644 --- a/libmaple/stm32f1/i2c.c +++ b/libmaple/stm32f1/i2c.c @@ -44,6 +44,10 @@ i2c_dev* const I2C2 = &i2c2; */ void i2c_config_gpios(const i2c_dev *dev) { + if ((dev->clk_id == RCC_I2C1) && + (dev->sda_pin == 9) && (dev->scl_pin == 8)) { + afio_remap(AFIO_REMAP_I2C1); + } gpio_set_mode(dev->gpio_port, dev->sda_pin, GPIO_AF_OUTPUT_OD); gpio_set_mode(dev->gpio_port, dev->scl_pin, GPIO_AF_OUTPUT_OD); } -- cgit v1.2.3