Handle possible problem with unintentional I2C interrupt handler triggering

Error handler may be called repeatedly during I2C unstucking. Not sure if this change is necessary, but it is safe
This commit is contained in:
Petr Ledvina 2015-01-29 14:48:21 +01:00
parent 5129403c83
commit f9f40fb98f
1 changed files with 3 additions and 0 deletions

View File

@ -325,6 +325,9 @@ void i2cInit(I2CDevice index)
I2Cx_index = index;
RCC_APB1PeriphClockCmd(i2cHardwareMap[index].peripheral, ENABLE);
// diable I2C interrrupts first to avoid ER handler triggering
I2C_ITConfig(I2Cx, I2C_IT_EVT | I2C_IT_ERR, DISABLE);
// clock out stuff to make sure slaves arent stuck
// This will also configure GPIO as AF_OD at the end
i2cUnstick();