1.1.2.4.6 DRV_I2C_ErrorGet Function

C

DRV_I2C_ERROR DRV_I2C_ErrorGet( const DRV_I2C_TRANSFER_HANDLE transferHandle )

Summary

Gets the I2C hardware errors associated with the the transfer request.

Description

This function returns the errors associated with the given bufferHandle. The call to this function also clears all the associated error flags.

Precondition

DRV_I2C_Open must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
transferHandleA valid handle to the transfer request.

Returns

Errors occurred as listed by DRV_I2C_ERROR. This function reports I2C errors if occurred.

Example

// 'bufferHandle', returned by any of the I2C transfer APIs
##Example

// (Example: DRV_I2C_WriteTransferAdd / DRV_I2C_ReadTransferAdd etc.)

if (DRV_I2C_ErrorGet(bufferHandle) == DRV_I2C_ERROR_NACK)
{
    //Errors are cleared by the driver, take respective action
    //for the error case.
}

Remarks

The driver clears all the errors internally.