Skip to content

Commit fb4d898

Browse files
committed
Allow re-initializing an I2C peripheral
Allows the FPGA based test to pass, but requires #11004 before it will
1 parent 28eb39c commit fb4d898

File tree

1 file changed

+3
-0
lines changed
  • targets/TARGET_Silicon_Labs/TARGET_EFM32

1 file changed

+3
-0
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/i2c_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
119119

120120
/* Initializing the I2C */
121121
/* Using default settings */
122+
i2c_reset(obj);
122123
I2C_Init_TypeDef i2cInit = I2C_INIT_DEFAULT;
123124
I2C_Init(obj->i2c.i2c, &i2cInit);
124125

@@ -315,6 +316,8 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
315316

316317
void i2c_reset(i2c_t *obj)
317318
{
319+
i2c_enable_interrupt(obj, 0, false);
320+
i2c_enable(obj, false);
318321
/* EMLib function */
319322
I2C_Reset(obj->i2c.i2c);
320323
}

0 commit comments

Comments
 (0)