diff options
| author | mlundinse <lundin@mlu.mine.nu> | 2013-04-14 20:02:12 +0200 |
|---|---|---|
| committer | mlundinse <lundin@mlu.mine.nu> | 2013-04-14 20:02:12 +0200 |
| commit | 82e469e51f1baf8e50b6204c5ea02cc51dc49669 (patch) | |
| tree | ed7d93284a158f8a69869c485d8bd772ba0246b5 | |
| parent | 746dad8ee9d4dc3801a30bc0fc604ffa137e5249 (diff) | |
Configure i2c pins before resetting the bus.
| -rw-r--r-- | libmaple/i2c.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libmaple/i2c.c b/libmaple/i2c.c index 9c93d3f..27db685 100644 --- a/libmaple/i2c.c +++ b/libmaple/i2c.c @@ -181,15 +181,15 @@ void i2c_master_enable(i2c_dev *dev, uint32 flags) { /* Ugh */ _i2c_handle_remap(dev, flags); + /* Turn on clock and set GPIO modes */ + i2c_init(dev); + i2c_config_gpios(dev); + /* Reset the bus. Clock out any hung slaves. */ if (flags & I2C_BUS_RESET) { i2c_bus_reset(dev); } - /* Turn on clock and set GPIO modes */ - i2c_init(dev); - i2c_config_gpios(dev); - /* Configure clock and rise time */ set_ccr_trise(dev, flags); |
