1.3.2.4.9 I2C_BB_CallbackRegister Function
1.3.2.4.9 C
void I2C_BB_CallbackRegister(I2CBB_CALLBACK callback, uintptr_t contextHandle)
1.3.2.4.9 Summary
Sets the pointer to the function (and it is context) to be called when the given I2C's transfer events occur.
1.3.2.4.9 Description
This function sets the pointer to a client function to be called "back" when the given I2C transfer events occur. It also passes a context value (usually a pointer to a context structure) that is passed into the function when it is called. The specified callback function will be called from the timer peripheral interrupt context.
1.3.2.4.9 Precondition
I2C_BB_Initialize must have been called for the associated I2C instance.
1.3.2.4.9 Parameters
| Parameters | Description |
|---|---|
| callback | A pointer to a function with a calling signature defined by the I2CBB_CALLBACK data type. Setting this to NULL disables the callback feature. |
| contextHandle | A value (usually a pointer) passed (unused) into the function identified by the callback parameter. |
1.3.2.4.9 Returns
None.
1.3.2.4.9 Example
void MyI2CCallback(uintptr_t context)
{
// This function will be called when the transfer completes. Note
// that this function executes in the context of the I2C interrupt.
}
I2C_BB_Initialize();
I2C_BB_CallbackRegister(MyI2CCallback, NULL);
1.3.2.4.9 Remarks
None.
