diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-21 16:30:16 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-22 14:06:10 -0400 |
commit | 9ba028ef647bc033e5ec078acd7de9d5c28432a9 (patch) | |
tree | fad6606c51781141f82bd5e348e1e2236d360c19 | |
parent | fe34ca70469f1bd88eb38feb2b0b336ef5b07ff8 (diff) | |
download | librambutan-9ba028ef647bc033e5ec078acd7de9d5c28432a9.tar.gz librambutan-9ba028ef647bc033e5ec078acd7de9d5c28432a9.zip |
STM32F1: i2c_config_gpios(): Do afio_remap() if we should.
This should help avoid surprising some users.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
-rw-r--r-- | libmaple/stm32f1/i2c.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); } |