2019-03-31 19:13:06 +02:00
|
|
|
#ifndef _TIMESYNC_H
|
|
|
|
#define _TIMESYNC_H
|
2019-03-09 00:53:11 +01:00
|
|
|
|
2019-03-12 23:50:02 +01:00
|
|
|
#include <chrono>
|
2019-03-09 00:53:11 +01:00
|
|
|
#include "globals.h"
|
2019-03-31 19:13:06 +02:00
|
|
|
#include "irqhandler.h"
|
2019-03-09 00:53:11 +01:00
|
|
|
#include "timekeeper.h"
|
|
|
|
|
2019-03-24 16:16:58 +01:00
|
|
|
//#define TIME_SYNC_TRIGGER 100 // threshold for time sync [milliseconds]
|
2019-08-13 13:16:56 +02:00
|
|
|
#define TIME_SYNC_FRAME_LENGTH 0x06 // timeserver answer frame length [bytes]
|
2019-04-07 16:57:52 +02:00
|
|
|
#define TIME_SYNC_FIXUP 4 // calibration to fixup processing time [milliseconds]
|
2019-03-09 00:53:11 +01:00
|
|
|
|
2019-04-07 16:13:04 +02:00
|
|
|
void timesync_init(void);
|
2019-03-12 23:50:02 +01:00
|
|
|
void send_timesync_req(void);
|
2019-10-01 16:29:02 +02:00
|
|
|
int recv_timesync_ans(const uint8_t buf[], uint8_t buf_len);
|
2019-03-12 23:50:02 +01:00
|
|
|
void process_timesync_req(void *taskparameter);
|
2019-03-16 21:01:43 +01:00
|
|
|
void store_time_sync_req(uint32_t t_millisec);
|
2019-03-09 00:53:11 +01:00
|
|
|
|
2019-10-01 16:29:02 +02:00
|
|
|
#endif
|