i2c stm8 проблема с событием - PullRequest
0 голосов
/ 16 января 2019

Я работаю над драйвером i2c для STM8S105C6T6. Я не могу получить I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED. Пожалуйста, посоветуйте, где я не прав.

void I2C_ACC_ByteRead(u8 I2C_Slave_Address, u8 ReadAddr, u8 *pBuffer)
{   
    /* while the bus is busy */
    while(I2C_GetFlagStatus(I2C_FLAG_BUSBUSY));

    /* send start condition */
    I2C_GenerateSTART(ENABLE);

    /* test in I2C event and clear it */
    while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));

    /* send address to write */
    I2C_Send7bitAddress(I2C_Slave_Address, I2C_DIRECTION_TX);

    /* test on EV6 and clear it */
    while(!I2C_CheckEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));

    /* send the address of the first byte to be read and wait event detection */
    I2C_SendData(ReadAddr); /* LSB */

    /* test on EV8 and clear it */
    while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED));

    /* send start condition for the second time */
    I2C_GenerateSTART(ENABLE);

    /* test in I2C event and clear it */
    while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));

    /* send EEPROM address to write */
    I2C_Send7bitAddress(I2C_Slave_Address, I2C_DIRECTION_RX);

    ...
}

Заранее спасибо за помощь.

...