SiLabs: I2C: Always set master mode on initialization

If an I2C block was reused after being a slave the status would not
be cleared completely, so explicitly initialize to master mode always.
pull/1501/head
Mikko Polojarvi 2015-12-03 18:06:41 +02:00 committed by Steven Cooreman
parent 316e8733df
commit 81a9dd9031
1 changed files with 3 additions and 0 deletions

View File

@ -148,6 +148,9 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
/* We are assuming that there is only one master. So disable automatic arbitration */
obj->i2c.i2c->CTRL |= _I2C_CTRL_ARBDIS_MASK;
/* Set to master (needed if this I2C block was used previously as slave) */
i2c_slave_mode(obj, false);
/* Enable i2c */
i2c_enable(obj, true);
}