NEW: release DJI Payload-SDK version 3.2
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
34
samples/sample_c/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
34
samples/sample_c/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native LIBUSB includes and library
|
||||
#
|
||||
# This module defines
|
||||
# LIBUSB_INCLUDE_DIR, where to find libusb.h
|
||||
# LIBUSB_LIBRARY, the libraries to link against to use LIBUSB.
|
||||
# LIBUSB_FOUND, If false, do not try to use LIBUSB.
|
||||
|
||||
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
|
||||
PATHS
|
||||
/usr/local/include/libusb-1.0
|
||||
/usr/include/libusb-1.0
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(LIBUSB_LIBRARY usb-1.0
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (LIBUSB_INCLUDE_DIR)
|
||||
IF (LIBUSB_LIBRARY)
|
||||
SET(LIBUSB_FOUND "YES")
|
||||
ENDIF (LIBUSB_LIBRARY)
|
||||
ENDIF (LIBUSB_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBUSB_INCLUDE_DIR
|
||||
LIBUSB_LIBRARY
|
||||
LIBUSB_FOUND
|
||||
)
|
34
samples/sample_c/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
34
samples/sample_c/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native OPUS includes and library
|
||||
#
|
||||
# This module defines
|
||||
# OPUS_INCLUDE_DIR, where to find opus.h
|
||||
# OPUS_LIBRARY, the libraries to link against to use OPUS.
|
||||
# OPUS_FOUND, If false, do not try to use OPUS.
|
||||
|
||||
FIND_PATH(OPUS_INCLUDE_DIR opus.h
|
||||
PATHS
|
||||
/usr/local/include/opus
|
||||
/usr/include/opus
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(OPUS_INCLUDE_DIR ${OPUS_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(OPUS_LIBRARY opus
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (OPUS_INCLUDE_DIR)
|
||||
IF (OPUS_LIBRARY)
|
||||
SET(OPUS_FOUND "YES")
|
||||
ENDIF (OPUS_LIBRARY)
|
||||
ENDIF (OPUS_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPUS_INCLUDE_DIR
|
||||
OPUS_LIBRARY
|
||||
OPUS_FOUND
|
||||
)
|
@ -30,6 +30,10 @@
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static uint32_t s_localTimeMsOffset = 0;
|
||||
static uint64_t s_localTimeUsOffset = 0;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
@ -279,6 +283,12 @@ T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
||||
gettimeofday(&time, NULL);
|
||||
*ms = (time.tv_sec * 1000 + time.tv_usec / 1000);
|
||||
|
||||
if (s_localTimeMsOffset == 0) {
|
||||
s_localTimeMsOffset = *ms;
|
||||
} else {
|
||||
*ms = *ms - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -289,6 +299,12 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
||||
gettimeofday(&time, NULL);
|
||||
*us = (time.tv_sec * 1000000 + time.tv_usec);
|
||||
|
||||
if (s_localTimeUsOffset == 0) {
|
||||
s_localTimeUsOffset = *us;
|
||||
} else {
|
||||
*us = *us - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user