1.1.2.4.12 DRV_I2C_TransferStatusGet Function

C

DRV_I2C_TRANSFER_EVENT DRV_I2C_TransferStatusGet(
    const DRV_I2C_TRANSFER_HANDLE transferHandle
)

Summary

Returns the status of the write/read/write-read transfer request.

Description

This function can be used to poll the status of the queued transfer request if the application doesn't prefer to use the event handler (callback) function to get notified.

Precondition

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

Either the DRV_I2C_ReadTransferAdd, DRV_I2C_WriteTransferAdd or DRV_I2C_WriteReadTransferAdd function must have been called and a valid buffer handle returned.

Parameters

ParamDescription
transferHandleHandle for the buffer of which the processed number of bytes to be obtained.

Returns

The success or error event of the transfer.

Example

uint8_t myBuffer[MY_BUFFER_SIZE];
DRV_I2C_TRANSFER_HANDLE transferHandle;
DRV_I2C_TRANSFER_EVENT event;

// myI2CHandle is the handle returned
// by the DRV_I2C_Open function.

DRV_I2C_ReadTransferAdd(myI2CHandle, slaveAddress, myBuffer, MY_BUFFER_SIZE, &transferHandle);

if(transferHandle == DRV_I2C_TRANSFER_HANDLE_INVALID)
{
    // Error handling here
}

//Check the status of the transfer
//This call can be used to wait until the transfer is processed.

event = DRV_I2C_TransferStatusGet(transferHandle);

Remarks

This function is available only in the asynchronous mode.