1.37.18.85 SERCOM_I2C_CALLBACK Typedef

C

/* I2C master mode */

typedef void (*SERCOM_I2C_CALLBACK) (uintptr_t contextHandle)

Summary

Defines the data type and function signature for the SERCOM I2C peripheral callback function in I2C master mode.

Description

This data type defines the function signature for the SERCOM I2C peripheral callback function. The SERCOM I2C peripheral will call back the client's function with this signature when the SERCOM I2C Transfer has completed.

Precondition

SERCOMx_I2C_Initialize must have been called for the given SERCOM I2C peripheral instance and SERCOMx_I2C_CallbackRegister must have been called to set the function to be called. The callback register function should have been called before a I2C transfer is initiated.

Parameters

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

Returns

None.

Example

void SERCOM0_I2C_Callback(uintptr_t context)
{
    if(SERCOM0_I2C_ErrorGet() == SERCOM_I2C_ERROR_NONE)
    {
        //Transfer is completed successfully
    }
    else
    {
        //Error occurred during transfer.
    }
}

// Register Callback function which is defined above
SERCOM0_I2C_CallbackRegister(SERCOM0_I2C_Callback, (uintptr_t)NULL);

Remarks

None