33 lines
No EOL
829 B
C++
33 lines
No EOL
829 B
C++
#ifndef WATCHY_RTC_H
|
|
#define WATCHY_RTC_H
|
|
|
|
#include "config.h"
|
|
#include <Arduino.h>
|
|
#include <TimeLib.h>
|
|
#include <Rtc_Pcf8563.h>
|
|
|
|
namespace WatchFeatures
|
|
{
|
|
class RTC;
|
|
}
|
|
|
|
class WatchFeatures::RTC {
|
|
public:
|
|
void Get(tmElements_t & tm);
|
|
void Set(tmElements_t tm);
|
|
uint64_t GetTimestamp();
|
|
std::string GetDateString();
|
|
void SetTimer();
|
|
bool CheckWakeup(); // Checks to really wake up or not, also resets the timer after the initial sleep
|
|
void Resync(); // Resync the timer cycle, both initially and after RTC resync
|
|
|
|
static void OffsetTime(tmElements_t & tm, int offsetInSeconds);
|
|
static unsigned int GetDayOfYear(tmElements_t & tm);
|
|
static unsigned int DaysDifference(tmElements_t & tm1, tmElements_t & tm2);
|
|
|
|
private:
|
|
Rtc_Pcf8563 m_rtcPcf;
|
|
static RTC_DATA_ATTR bool m_timerSet, m_initialTimer;
|
|
};
|
|
|
|
#endif |