add:高功率申请
This commit is contained in:
@ -30,6 +30,9 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "dji_typedef.h"
|
||||
#include "dji_power_management.h"
|
||||
#include <wiringPi.h>
|
||||
|
||||
#define HIGH_POWER_APPLY_PIN 11
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -95,6 +95,9 @@ target_link_libraries(${PROJECT_NAME}
|
||||
z
|
||||
m
|
||||
pthread
|
||||
rt
|
||||
crypt
|
||||
wiringPi
|
||||
)
|
||||
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
|
@ -721,12 +721,32 @@ delay:
|
||||
|
||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit()
|
||||
{
|
||||
wiringPiSetup(); // 初始化WiringPi库
|
||||
|
||||
pinMode(HIGH_POWER_APPLY_PIN, OUTPUT); // 配置引脚为输出模式
|
||||
pullUpDnControl(HIGH_POWER_APPLY_PIN, PUD_DOWN); // 启用下拉电阻,使引脚默认为低电平
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
|
||||
{
|
||||
//attention: please pull up the HWPR pin state by hardware.
|
||||
|
||||
int wiringPiState;
|
||||
|
||||
switch (pinState) {
|
||||
case DJI_POWER_MANAGEMENT_PIN_STATE_RESET:
|
||||
wiringPiState = LOW; // WiringPi库中,LOW表示低电平
|
||||
break;
|
||||
case DJI_POWER_MANAGEMENT_PIN_STATE_SET:
|
||||
wiringPiState = HIGH; // WiringPi库中,HIGH表示高电平
|
||||
break;
|
||||
default:
|
||||
USER_LOG_ERROR("pin state unknown: %d.", pinState);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
digitalWrite(HIGH_POWER_APPLY_PIN, wiringPiState); // 使用WiringPi库设置引脚状态
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user