Merge pull request #11011 from SiliconLabs/fix/fpga_tests/i2c

Allow re-initialising an I2C peripheral on Silicon Labs targets
pull/11013/head
Martin Kojtal 2019-07-10 10:44:54 +01:00 committed by GitHub
commit 279f4cd584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -119,6 +119,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
/* Initializing the I2C */
/* Using default settings */
i2c_reset(obj);
I2C_Init_TypeDef i2cInit = I2C_INIT_DEFAULT;
I2C_Init(obj->i2c.i2c, &i2cInit);
@ -315,6 +316,8 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
void i2c_reset(i2c_t *obj)
{
i2c_enable_interrupt(obj, 0, false);
i2c_enable(obj, false);
/* EMLib function */
I2C_Reset(obj->i2c.i2c);
}