1.18.10.12 I2Cx_ErrorGet Function

C

/* x = I2C instance number */

/* I2C master mode */
I2C_ERROR I2Cx_ErrorGet(void)	

/* I2C slave mode */		
I2C_SLAVE_ERROR I2Cx_ErrorGet(void)	

Summary

Returns the I2C error that occurred on the bus.

Description

This function returns the I2C error that occurred on the bus. The function can be called to identify the error cause.

Precondition

I2Cx_Initialize must have been called for the associated I2C instance.

Parameters

None.

Returns

Returns error of type I2C_ERROR (when I2C is in master mode) or I2C_SLAVE_ERROR (when I2C is in slave mode), identifying the error that has occurred.

Example

I2C in master mode:

if(I2C1_ErrorGet() == I2C_ERROR_NONE)
{
    //Transfer is completed successfully
}
else
{
    //Error occurred during transfer.
}

I2C in slave mode:

if(I2C1_ErrorGet() == I2C_SLAVE_ERROR_NONE)
{
    //Transfer is completed successfully
}
else
{
    //Error occurred during transfer.
}

Remarks

None