1.6.16.12 1.7.17.12 1.10.14.19 1.11.15.19 1.12.15.19 1.13.14.19 1.14.11.16 1.15.12.16 1.16.11.10 1.17.11.10 1.18.11.10 1.19.11.10 1.20.11.10 1.21.12.10 1.22.16.19 1.23.15.19 1.24.13.13 NVM_CALLBACK Typedef

C

typedef void (*NVM_CALLBACK)(uintptr_t context);

Summary

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

Description

This data type defines the function signature for the NVM peripheral callback function. The NVM peripheral library will call back the client's function with this signature when an on-going erase or write operation has completed and the NVM is ready to accept a new operation request. A function of this type should be registered by calling the NVM_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_NVMCallback(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
NVM_CallbackRegister(APP_NVMCallback, &myAppData);

// Perform some operation.
NVM_PageErase(0x9D100000);

// 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.