1.1.1.4.10 DRV_PLC_PHY_SleepDisableCallbackRegister Function

C

void DRV_PLC_PHY_SleepDisableCallbackRegister (
    const DRV_HANDLE handle,
    const DRV_PLC_PHY_SLEEP_IND_CALLBACK callback, 
    const uintptr_t context 
);

Summary

Allows a client to set a sleep mode disable event handling function for the driver to call back when the PLC driver is active again.

Description

This function allows a client to register a PLC sleep mode disable event handling function for the driver to call back when sleep mode is disabled and PLC driver has been restarted.

The event handler should be set before the client submits a wake-up request using the DRV_PLC_PHY_Sleep function. The callback once set, persists until the client closes the driver or sets another callback (which could be a NULL pointer to indicate no callback).

Precondition

DRV_PLC_PHY_Open must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open routine
callbackPointer to the callback function
contextThe value of this parameter will be passed back to the client unchanged, when the callback function is called

Returns

None.

Example

void APP_PLC_SleepModeDisableCb( uintptr_t context )
{
    // The context handle was set to an application specific
    // object. It is now retrievable easily in the event handler.
    MY_APP_OBJ* myAppObj = (MY_APP_OBJ *) context;

    // Sleep Disable handling here.

}
    
// myAppObj is an application specific state data object.
MY_APP_OBJ myAppObj;

// myHandle is the handle returned from DRV_PLC_PHY_Open API.

// Client registers a data confirm callback with driver. This is done once

DRV_PLC_PHY_SleepDisableCallbackRegister( myHandle, APP_PLC_SleepModeDisableCb, (uintptr_t)&myAppObj );

Remarks

This function is only available if Sleep Mode is enabled in MCC.