mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #637 from rgrover/master
Target: NUCLEO_F103RB - removing some un-used variablespull/641/head
commit
835736bd23
|
|
@ -59,9 +59,6 @@ int i2c1_inited = 0;
|
|||
int i2c2_inited = 0;
|
||||
|
||||
void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
|
||||
int timeout;
|
||||
I2C_TypeDef *i2c = (I2C_TypeDef *)(obj->i2c);
|
||||
|
||||
// Determine the I2C to use
|
||||
I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
|
||||
I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
|
||||
|
|
@ -103,10 +100,10 @@ void i2c_frequency(i2c_t *obj, int hz) {
|
|||
I2C_InitTypeDef I2C_InitStructure;
|
||||
|
||||
if ((hz != 0) && (hz <= 400000)) {
|
||||
|
||||
// wait before init
|
||||
timeout = LONG_TIMEOUT;
|
||||
while((I2C_GetFlagStatus(i2c, I2C_FLAG_BUSY)) && (timeout-- != 0));
|
||||
while ((I2C_GetFlagStatus(i2c, I2C_FLAG_BUSY)) && (timeout-- != 0)) {
|
||||
}
|
||||
|
||||
I2C_DeInit(i2c);
|
||||
|
||||
|
|
@ -277,7 +274,8 @@ void i2c_reset(i2c_t *obj) {
|
|||
|
||||
// wait before reset
|
||||
timeout = LONG_TIMEOUT;
|
||||
while((I2C_GetFlagStatus(i2c, I2C_FLAG_BUSY)) && (timeout-- != 0));
|
||||
while ((I2C_GetFlagStatus(i2c, I2C_FLAG_BUSY)) && (timeout-- != 0)) {
|
||||
}
|
||||
|
||||
if (obj->i2c == I2C_1) {
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
|
||||
|
|
@ -379,7 +377,6 @@ int i2c_slave_write(i2c_t *obj, const char *data, int length) {
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
#endif // DEVICE_I2CSLAVE
|
||||
|
||||
#endif // DEVICE_I2C
|
||||
|
|
|
|||
Loading…
Reference in New Issue