Power Management

2022-08-23
No Rating

This is the header file for "psdk_power_management.c", defining the structure and (exported) function prototypes.

Define Enum and Structure

typedef enum E_PsdkPowerManagementPinState

Pin state.

typedef enum {
    PSDK_POWER_MANAGEMENT_PIN_STATE_RESET = 0,       Specifies pin is in low level state. 
    PSDK_POWER_MANAGEMENT_PIN_STATE_SET = 1,         Specifies pin is in high level state. 
} E_PsdkPowerManagementPinState;

typedef function WriteHighPowerApplyPinCallback

Function:Set level of high power application pin product:all

Prototype of callback function used to set level of high power application pin.

typedef T_PsdkReturnCode (*WriteHighPowerApplyPinCallback)(E_PsdkPowerManagementPinState pinState);
Parameter
pinState:level state of pin to be set.
Return
The details for the return code please refer to:PsdkErrorCode

typedef function PowerOffNotificationCallback

Function:Power off notification product:all

Prototype of callback function used to notify payload that the aircraft will power off soon and get state whether the payload is ready to power off or not.

NOTE Developer can not execute blocking style operations or functions in a callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.

typedef T_PsdkReturnCode (*PowerOffNotificationCallback)(bool *powerOffPreparationFlag);
Parameter
powerOffPreparationFlag:ointer to memory space used to store power off preparation flag. True represents that payload has completed all work and is ready to power off. False represents that payload is not ready to power off.
Return
The details for the return code please refer to:PsdkErrorCode

typedef function PsdkPowerManagement_ApplyHighPowerSync

Function:Apply high power product:all

Apply high power from aircraft in blocking mode.Before applying, user should register callback function used to set level state of high power application pin using PsdkPowerManagement_RegWriteHighPowerApplyPinCallback() function. After applying high power, power pin of PSDK adapter will output high power based predetermined specification.

NOTE Max execution time of this function is slightly larger than 600ms.

T_PsdkReturnCode PsdkPowerManagement_ApplyHighPowerSync(void);


Return

The details for the return code please refer to:PsdkErrorCode

Function

function PsdkPowerManagement_RegWriteHighPowerApplyPinCallback

Function:Set level state of high power application pin product:all

Register callback function used to set level state of high power application pin. Must be called before applying high power.

T_PsdkReturnCode PsdkPowerManagement_RegWriteHighPowerApplyPinCallback(WriteHighPowerApplyPinCallback callback);
Parameter
callback:pointer to the callback function.
Return
The details for the return code please refer to:PsdkErrorCode

function PsdkPowerManagement_RegPowerOffNotificationCallback

Function:Power off notification product:all

Register callback function used to notify payload that the aircraft will power off soon and get state whether the payload is ready to power off or not.

NOTE After registering, the callback function will be called at a fixed frequency when aircraft will power off. User fill in the power off preparation flag, and once the payload is ready to power off, the callback function will not be called. After a specified time, if the payload is not ready to power off, the aircraft will power off immediately.

T_PsdkReturnCode PsdkPowerManagement_RegPowerOffNotificationCallback(PowerOffNotificationCallback callback);
Parameter
callback:pointer to callback function used to notify aircraft power off message and get payload power off preparation flag.
Return
The details for the return code please refer to:PsdkErrorCode
Last Updated: 8/23/2022, 8:30:21 AM
If you have any comments or confusion about our documentation, you can click here to give feedback and we will get back to you as soon as possible.