Fixed FMPI2C ifdefs and macro names

pull/1412/head
Mika Laurila 2015-11-05 15:04:45 +02:00 committed by Wojciech Gorniak
parent 716654908a
commit 0ffb311bab
1 changed files with 6 additions and 5 deletions

View File

@ -90,11 +90,12 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
pin_mode(scl, OpenDrain); pin_mode(scl, OpenDrain);
} }
#endif #endif
#if (defined(FMPI2C1_BASE) && defined(FMPI2C_1))
#if (defined(FMPI2C1_BASE) && defined(FMPI2C1))
// Enable I2C3 clock and pinout if not done // Enable I2C3 clock and pinout if not done
if ((obj->i2c == FMPI2C_1) && !fmpi2c1_inited) { if ((obj->i2c == FMPI2C_1) && !fmpi2c1_inited) {
fmpi2c1_inited = 1; fmpi2c1_inited = 1;
__FMPI2C1_CLK_ENABLE(); __HAL_RCC_FMPI2C1_CLK_ENABLE();
// Configure I2C pins // Configure I2C pins
pinmap_pinout(sda, PinMap_I2C_SDA); pinmap_pinout(sda, PinMap_I2C_SDA);
pinmap_pinout(scl, PinMap_I2C_SCL); pinmap_pinout(scl, PinMap_I2C_SCL);
@ -337,10 +338,10 @@ void i2c_reset(i2c_t *obj)
} }
#endif #endif
#if (defined(FMPI2C1_BASE) && defined(FMPI2C_1)) #if (defined(FMPI2C1_BASE) && defined(FMPI2C1))
if (obj->i2c == FMPI2C_1) { if (obj->i2c == FMPI2C_1) {
__FMPI2C1_FORCE_RESET(); __HAL_RCC_FMPI2C1_FORCE_RESET();
__FMPI2C1_RELEASE_RESET(); __HAL_RCC_FMPI2C1_RELEASE_RESET();
} }
#endif #endif
} }