WatchyWatchFace/src/WatchFeatures/RTC.h
Lewis Jackson 1b6f89faea
All checks were successful
Compile / Compile (push) Successful in 1m26s
Add fetching from wttr.in and moon display
2023-06-02 18:45:26 +03:00

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