1.9.10.25 FCW_CALLBACK Typedef

C

typedef void (*FCW_CALLBACK)(uintptr_t context);

Summary

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

Description

This data type defines the function signature for the FCW peripheral callback function. The FCW peripheral library will call back the client's function with this signature when an on-going erase or write operation has completed and the FCW is ready to accept a new operation request. A function of this type should be registered by calling the FCW_CallbackRegister function.

Parameters

Param Description
context Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients).

Returns

None.

Example

typedef struct
{
    bool operationComplete;
    
} APP_DATA;

// Callback is called when an operation completes.
void APP_FCWCallback(uintptr_t context)
{
    APP_DATA * appdata = (APP_DATA *)context;
    appData->operationComplete = true;
}

// Function calls in main thread.
APP_DATA myAppData;
myAppData.operationComplete = false;

// Register the callback
FCW_CallbackRegister(APP_FCWCallback, &myAppData);

// Perform some operation.
FCW_PageErase(0xC088608U);

// Now wait for the operation to complete.
while(!myAppData.operationComplete);

Remarks

The callback feature is only available when the library was generated with interrupt option (in MHC) enabled.