RTC: pull rtc code into own file for cleanup

This commit is contained in:
Kevin Hester
2020-10-08 07:28:57 +08:00
parent 62c228b986
commit f00d07baa3
11 changed files with 100 additions and 84 deletions

19
src/gps/RTC.h Normal file
View File

@@ -0,0 +1,19 @@
#pragma once
#include "configuration.h"
#include "sys/time.h"
#include <Arduino.h>
extern bool timeSetFromGPS; // We try to set our time from GPS each time we wake from sleep
/// If we haven't yet set our RTC this boot, set it from a GPS derived time
bool perhapsSetRTC(const struct timeval *tv);
bool perhapsSetRTC(struct tm &t);
/// Return time since 1970 in secs. Until we have a GPS lock we will be returning time based at zero
uint32_t getTime();
/// Return time since 1970 in secs. If we don't have a GPS lock return zero
uint32_t getValidTime();
void readFromRTC();