uav_power_management.h
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef UAV_POWER_MANAGEMENT_H
#define UAV_POWER_MANAGEMENT_H
/* Includes ------------------------------------------------------------------*/
#include "uav_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported types ------------------------------------------------------------*/
/**
* @brief Pin state.
*/
typedef enum {
UAV_POWER_MANAGEMENT_PIN_STATE_DISABLE = 0, /*!< Specifies pin is in low level state. */
UAV_POWER_MANAGEMENT_PIN_STATE_ENABLE = 1 /*!< Specifies pin is in high level state. */
}E_UAVPowerManagementPinState;
typedef T_UAVReturnCode (*UAVWriteHighPowerApplyPinCallback)(E_UAVPowerManagementPinState state);
typedef T_UAVReturnCode (*UAVPowerOffNotificationCallback)(bool *powerOffPreparationFlag);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise power management module, and user should call this function before using power management features.
*/
T_UAVReturnCode UAV_PowerManagement_Init(void);
/**
* @brief DeInitialise power management module, and user should call this function before using power management features.
*/
T_UAVReturnCode UAV_PowerManagement_Deinit(void);
/**
* @brief Apply high power from aircraft in blocking mode.
* @details Before applying, user should register callback function used to set level state of high power application
* pin using After applying high power.
*/
T_UAVReturnCode UAV_PowerManagement_ApplyHighPowerSync(void);
/*
* @brief Register callback function used to set level state of high power application pin. Must be called before
* applying high power.
* @param callback: pointer to the callback function.
* @note 待实现
*/
T_UAVReturnCode UAV_PowerManagement_RegWriteHighPowerApplyPinCallback(UAVWriteHighPowerApplyPinCallback callback);
/**
* @brief 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.
* @details 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. The
* specified time is 10s.
* @param callback: pointer to callback function used to notify aircraft power off message and get payload power off
* preparation flag.
*/
T_UAVReturnCode UAV_PowerManagement_RegPowerOffNotificationCallback(UAVPowerOffNotificationCallback callback);
#ifdef __cplusplus
}
#endif
#endif //