1.1.2.4.20 DRV_G3_MACRT_Sleep Function

C

void DRV_G3_MACRT_Sleep (
    const DRV_HANDLE handle, 
    bool enable 
);

Summary

Allows to manage the PLC Sleep mode.

Description

This function allows to manage the PLC Sleep mode. Before going to sleep, it disables PLC interrupts, and will leave them disabled upon return to normal operation. In sleep mode, the PLC transceiver consumes as little power as possible. If there is any PLC transmission in progress, it will be silently discarded before sleep mode is entered. To exit from sleep mode it is not needed to load the PLC binary again.

Precondition

DRV_G3_MACRT_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
enableSet true to enter in sleep mode. Set false to exit from sleep mode

Returns

None.

Example

DRV_HANDLE handle; // Returned from DRV_G3_MACRT_Open

while (true)
{
    if (sleep_condition)
    {
        DRV_G3_MACRT_Sleep (handle, true);
    }
}

Remarks

This function will never block or access any resources that may cause it to block.

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