1.3.15.25 1.4.13.24 1.5.14.25 1.29.15.25 1.30.10.25 1.31.10.25 1.32.16.33 1.33.10.25 1.37.10.25 1.38.13.24 1.39.10.25 1.40.13.25 NVMCTRL_CALLBACK Typedef

C

typedef void (*NVMCTRL_CALLBACK)(uintptr_t context);

Summary

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

Description

This data type defines the function signature for the NVMCTRL peripheral callback function. The NVMCTRL peripheral library will call back the client's function with this signature when an on-going erase or write operation has completed and the NVMCTRL is ready to accept a new operation request. A function of this type should be registered by calling the NVMCTRL_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_NVMCTRLCallback(uintptr_t context)
{
    APP_DATA * appdata = (APP_DATA *)context;
    appData->operationComplete = true;
}

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

NVMCTRL_Initialize();

// Register the callback
NVMCTRL_CallbackRegister(APP_NVMCTRLCallback, &myAppData);

// Perform some operation.
NVMCTRL_RowErase(SOME_ROW_ALIGNED_ADDRESS);

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