/* Wait for EV5 and clear it */
while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));
/* Send slave address for write */
I2C_Send7bitAddress((uint8_t)I2C_OLED_Address, I2C_Direction_Transmitter);
/* Wait for EV6 and clear it */
while(!I2C_CheckEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
/* Send SubAddress to 4637 while clearing EV8_1 */
I2C_SendData(addr);
/* Wait for EV8 */
while(!I2C_EVENT_MASTER_BYTE_TRANSMITTING);
/* Send single-byte data to 4637 while clearing EV8 */
I2C_SendData(data);
/* Wait for EV8_2 */
while(!I2C_EVENT_MASTER_BYTE_TRANSMITTED);
/* Send STOP condition while clearing EV8_2 */
I2C_GenerateSTOP(ENABLE);
/* Wait for communication to finish */
while(I2C_GetFlagStatus(I2C_FLAG_BUSY));
}