/* Master Transmitter --------------------------------------------------*/
/* Test on I2C1 EV6 and first EV8 and clear them */
case I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED:
/* Send the first data */
I2C_SendData(I2C1, I2C1_Buffer_Tx[Tx1_Idx++]);
I2cNumbOfBytes2Tansmit--;
if (I2cNumbOfBytes2Tansmit == 0)
{
/* In order to not have a TxE event Interrupt */
I2C_ITConfig(I2C1, I2C_IT_BUF, DISABLE);
}
break;
/* Test on I2C1 EV8 and clear it */
case I2C_EVENT_MASTER_BYTE_TRANSMITTING: /* Without BTF, EV8 */
I2C_SendData(I2C1, I2C1_Buffer_Tx[Tx1_Idx++]);
I2cNumbOfBytes2Tansmit--;
if (I2cNumbOfBytes2Tansmit == 0)
{
I2C_ITConfig(I2C1, I2C_IT_BUF, DISABLE);
}
break;
case I2C_EVENT_MASTER_BYTE_TRANSMITTED: /* With BTF EV8-2 */
I2C_ITConfig(I2C1, I2C_IT_BUF, ENABLE);
I2C_GenerateSTOP(I2C1, ENABLE);
Direction = Receiver;
break;
default:
break;
}
}