2019-02-21 23:17:01 +01:00
|
|
|
#ifndef _timemanager_H
|
|
|
|
#define _timemanager_H
|
|
|
|
|
|
|
|
#include "globals.h"
|
|
|
|
#include "rtctime.h"
|
|
|
|
|
|
|
|
#ifdef HAS_GPS
|
|
|
|
#include "gpsread.h"
|
|
|
|
#endif
|
|
|
|
#ifdef HAS_IF482
|
|
|
|
#include "if482.h"
|
|
|
|
#elif defined HAS_DCF77
|
|
|
|
#include "dcf77.h"
|
|
|
|
#endif
|
|
|
|
|
2019-02-23 21:51:24 +01:00
|
|
|
enum timesources { pps, rtc, lora, unsynced };
|
|
|
|
|
2019-02-21 23:17:01 +01:00
|
|
|
void clock_init(void);
|
|
|
|
void clock_loop(void *pvParameters);
|
|
|
|
void time_sync(void);
|
2019-02-22 22:28:35 +01:00
|
|
|
int wait_for_pulse(void);
|
2019-02-23 21:51:24 +01:00
|
|
|
int syncTime(time_t const t, uint8_t const timesource);
|
|
|
|
int syncTime(uint32_t const t, uint8_t const timesource);
|
2019-02-21 23:17:01 +01:00
|
|
|
void IRAM_ATTR CLOCKIRQ(void);
|
|
|
|
int timepulse_init(void);
|
|
|
|
void timepulse_start(void);
|
2019-02-23 21:51:24 +01:00
|
|
|
int TimeIsValid(time_t const t);
|
2019-02-22 22:28:35 +01:00
|
|
|
time_t compiledUTC(void);
|
2019-02-23 21:51:24 +01:00
|
|
|
time_t tmConvert(uint16_t YYYY, uint8_t MM, uint8_t DD, uint8_t hh,
|
|
|
|
uint8_t mm, uint8_t ss);
|
2019-02-21 23:17:01 +01:00
|
|
|
|
|
|
|
#endif // _timemanager_H
|