aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmaple/i2c.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libmaple/i2c.c b/libmaple/i2c.c
index 27db685..9c93d3f 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);