1.1.11.8 I2CSMBx_ErrorGet Function

C

/* x = I2C SMBUS peripheral instance number */

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

/* I2C slave mode */		
I2C_SLAVE_ERROR I2CSMBx_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

I2CSMBx_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(I2CSMB0_ErrorGet() == I2C_ERROR_NONE)
{
    //Transfer is completed successfully
}
else
{
    //Error occurred during transfer.
}

I2C in slave mode:

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

Remarks

None