Time Synchronization
This is the header file for "psdk_time_sync.c", defining the structure and (exported) function prototypes.
Structure and Enum
typedef struct T_PsdkTimeSyncAircraftTime
The structure of the time system in the drone.
typedef struct {
uint16_t year; Specifies year.
uint8_t month; Specifies month, range from 1 to 12.
uint8_t day; Specifies day, range from 1 to 31.
uint8_t hour; Specifies hour, range from 0 to 23.
uint8_t minute; Specifies minute, range from 0 to 59.
uint8_t second; Specifies second, range from 0 to 59.
uint32_t microsecond; Specifies microsecond, range from 0 to 999999.
typedef function GetNewestPpsTriggerLocalTimeUsCallback
Function:Get the newest PPS triggered timestamp | product:all |
Prototype of callback function used to get the newest PPS triggered timestamp.
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef T_PsdkReturnCode (*GetNewestPpsTriggerLocalTimeUsCallback)(uint64_t *localTimeUs);
localTimeUs:pointer to memory space used to store PPS triggered timestamp
Return
The details for the return code please refer to:PsdkErrorCode
Function
function PsdkTimeSync_Init
Function:Initialise time synchronization module | product:all |
Initialise time synchronization module in blocking mode. User should call this function before all other time synchronization operations, just like transferring time.
NOTE
- Max execution time of this function is slightly larger than 2000ms.
- This function have to be called in user task, rather than main() function, and after scheduler being started.
T_PsdkReturnCode PsdkTimeSync_Init(void);
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkTimeSync_RegGetNewestPpsTriggerTimeCallback
Function:Get the newest timestamp | product:all |
Register callback function used to get the newest timestamp in local time system when PPS rising edge signal is detected.
NOTE PSDK uses the timestamp information to synchronise time of local time system and RTK navigation and positioning system.
T_PsdkReturnCode PsdkTimeSync_RegGetNewestPpsTriggerTimeCallback(GetNewestPpsTriggerLocalTimeUsCallback callback);
callback:pointer to the callback function.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkTimeSync_TransferToAircraftTime
Function:Time transfer | product:all |
Transfer local time to time in aircraft time system.
NOTE Before calling the interface, users must call PsdkTimeSync_RegGetNewestPpsTriggerTimeCallback() to register callback function used to report the latest triggered time of PPS signal.
T_PsdkReturnCode PsdkTimeSync_TransferToAircraftTime(uint64_t localTimeUs, T_PsdkTimeSyncAircraftTime *aircraftTime);
localTimeUs:local time, unit: microsecond.
aircraftTime:pointer to memory space used to store time in aircraft time system.
Return
The details for the return code please refer to:PsdkErrorCode