Jump to main content

##

# 2.73.27 NVMCTRL_SmartEEPROMCallbackRegister Function

## C

    void NVMCTRL_SmartEEPROMCallbackRegister( NVMCTRL_CALLBACK callback, uintptr_t context )

## Summary

Sets the pointer to the function (and it's context) to be called when an operation on the SmartEEPROM is complete, provided the corresponding interrupt is enabled.

## Description

This function sets the pointer to a client function to be called when the SmartEEPROM has completed an operation and is ready to receive new command. It also passes a context value that is passed into the callback function when it is called. This function is available only when the library is generated with SmartEEPROM interrupt option (in MCC) enabled.

## Precondition

SmartEEPROM Interrupt option in MCC should have been enabled

## Parameters

Param | Description
--- | ---
callback | A pointer to a function with a calling signature defined by theNVMCTRL_CALLBACK data type.
context | A value (usually a pointer) passed (unused) into the functionidentified by the callback parameter.

## Returns

None.

## Example

    uintptr_t seep_context;
    // Callback is called when an operation completes.
    void seep_cb(uint8_t int_flags, uintptr_t context)
    {
        //Code to check int_flags and decide next action
    }

    NVMCTRL_Initialize();

    // Register the callback
    NVMCTRL_SmartEEPROMCallbackRegister(seep_cb, seep_context);

    // Perform some operation.
    NVMCTRL_EnableSmartEepromInterruptSource(NVMCTRL_INT_SEEWRC);
    SMART_EEPROM32[0] = 0x11223344;

    // The callback 'seep_cb' will be invoked after the above operation is done.

## Remarks

The context value may be set to NULL if it is not required. Note that the value of NULL will still be passed to the callback function. To disable the callback function, pass a NULL for the callback parameter. See the NVMCTRL_CALLBACK type definition for additional information.