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