1.34.25.22 TWIHS_CALLBACK Typedef

C

/* TWIHS master mode */
typedef void (*TWIHS_CALLBACK) (uintptr_t contextHandle);

Summary

Defines the data type and function signature for the TWIHS peripheral callback function.

Description

This data type defines the function signature for the TWIHS peripheral callback function. The TWIHS peripheral will call back the client's function with this signature when the TWIHS Transfer event has occurred.

Precondition

TWIHSx_Initialize must have been called for the given TWIHS peripheral instance and TWIHSx_CallbackRegister must have been called to set the function to be called. The callback register function should have been called before a I2C transfer has been initiated.

Parameters

Param Description
context Allows the caller to provide a context value (usually a pointer to the callers context).

Returns

None.

Example

void TWIHS0_Callback(uintptr_t context)
{
    if(TWIHS0_ErrorGet() == TWIHS_ERROR_NONE)
    {
        //Transfer is completed successfully
    }
    else
    {
        //Error occurred during transfer.
    }
}

// Register Callback function which is defined above
TWIHS0_CallbackRegister(TWIHS0_Callback, (uintptr_t)NULL);

Remarks

None