drivers: i2c_ll_stm32_v2: Use the correct flags in event ISR

Event ISR checks if the TX/RX interrupts is enabled instead
of the TXIS/RXNE interrupt status flags. Use the TXIS/RXNE
interrupt status flags to check which interrupt event
happened.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
This commit is contained in:
Yannis Damigos 2017-10-25 11:06:36 +03:00 committed by Kumar Gala
parent b80da2b710
commit cf2eb7d1fa

View file

@ -82,14 +82,14 @@ void stm32_i2c_event_isr(void *arg)
I2C_TypeDef *i2c = cfg->i2c;
if (data->current.is_write) {
if (data->current.len && LL_I2C_IsEnabledIT_TX(i2c)) {
if (data->current.len && LL_I2C_IsActiveFlag_TXIS(i2c)) {
LL_I2C_TransmitData8(i2c, *data->current.buf);
} else {
LL_I2C_DisableIT_TX(i2c);
goto error;
}
} else {
if (data->current.len && LL_I2C_IsEnabledIT_RX(i2c)) {
if (data->current.len && LL_I2C_IsActiveFlag_RXNE(i2c)) {
*data->current.buf = LL_I2C_ReceiveData8(i2c);
} else {
LL_I2C_DisableIT_RX(i2c);