mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/i2c_api.c
- Revision:
- 115:4f0cb9cdc478
- Parent:
- 88:81f18c97d490
- Child:
- 125:23cc3068a9e4
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/i2c_api.c Mon Mar 10 13:45:07 2014 +0000 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/i2c_api.c Tue Mar 11 12:00:07 2014 +0000 @@ -44,11 +44,15 @@ static const PinMap PinMap_I2C_SDA[] = { {PB_9, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_3, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)}, + {PB_4, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)}, {NC, NC, 0} }; static const PinMap PinMap_I2C_SCL[] = { {PB_8, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_10, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PA_8, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, {NC, NC, 0} }; @@ -69,6 +73,13 @@ if (obj->i2c == I2C_1) { __I2C1_CLK_ENABLE(); } + if (obj->i2c == I2C_2) { + __I2C2_CLK_ENABLE(); + } + + if (obj->i2c == I2C_3) { + __I2C3_CLK_ENABLE(); + } // Configure I2C pins pinmap_pinout(sda, PinMap_I2C_SDA); @@ -207,6 +218,14 @@ __I2C1_FORCE_RESET(); __I2C1_RELEASE_RESET(); } + if (obj->i2c == I2C_2) { + __I2C2_FORCE_RESET(); + __I2C2_RELEASE_RESET(); + } + if (obj->i2c == I2C_3) { + __I2C3_FORCE_RESET(); + __I2C3_RELEASE_RESET(); + } } #if DEVICE_I2CSLAVE