1.2.21.85 1.3.25.85 1.4.21.85 1.5.25.85 1.6.22.85 1.7.23.85 1.9.19.85 1.29.23.85 1.30.18.85 1.31.18.85 1.32.26.85 1.33.16.85 1.37.18.85 1.38.21.85 1.39.18.85 1.40.20.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