8 #ifndef ACE_TIME_STM_RTC_CLOCK_H
9 #define ACE_TIME_STM_RTC_CLOCK_H
11 #if defined(ARDUINO_ARCH_STM32) || defined(EPOXY_DUINO)
15 #include "../hw/StmRtc.h"
16 #include "../hw/HardwareDateTime.h"
52 return toDateTime(hardwareDateTime).toEpochSeconds();
55 void setNow(acetime_t epochSeconds)
override {
58 LocalDateTime now = LocalDateTime::forEpochSeconds(epochSeconds);
73 return LocalDateTime::forComponents(
Abstract base class for objects that provide and store time.
static const acetime_t kInvalidSeconds
Error value returned by getNow() and other methods when this object is not yet initialized.
An implementation of Clock that uses an STM32 RTC chip using the STM32RTC library.
bool isTimeSet() const
Return true if the RTC is available and the time is set.
void setNow(acetime_t epochSeconds) override
Set the time to the indicated seconds.
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
void setup()
Setup does nothing.
StmRtcClock()=default
Constructor.
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip.
static const int16_t kBaseYear
Base year of the DS3231 chip.
uint8_t year
[00, 99], year - 2000
void setDateTime(const HardwareDateTime &dateTime) const
Set the STM with the HardwareDateTime values.
bool isTimeSet() const
Return true if the RTC is available and the time is set.
void readDateTime(HardwareDateTime *dateTime) const
Read the time into the HardwareDateTime object.