AceTimeClock  1.3.0
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
StmRtc.h
1 /*
2  * MIT License
3  * Copyright (c) 2020 Brian T. Park, Anatoli Arkhipenko
4  */
5 
6 #ifndef ACE_TIME_HW_STM_RTC_H
7 #define ACE_TIME_HW_STM_RTC_H
8 
9 #if defined(ARDUINO_ARCH_STM32) || defined(EPOXY_DUINO)
10 
11 namespace ace_time {
12 namespace hw {
13 
14 class HardwareDateTime;
15 
27 class StmRtc {
28  public:
30  explicit StmRtc() = default;
31 
33  void readDateTime(HardwareDateTime* dateTime) const;
34 
36  void setDateTime(const HardwareDateTime& dateTime) const;
37 
39  bool isTimeSet() const;
40 };
41 
42 } // hw
43 } // ace_time
44 
45 #endif // #if defined(ARDUINO_ARCH_STM32) || defined(EPOXY_DUINO)
46 #endif // #ifndef ACE_TIME_HW_STM_RTC_H
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip.
A class that reads and writes HardwareDateTime from an STM32 RTC chip using the STM32RTC library.
Definition: StmRtc.h:27
void setDateTime(const HardwareDateTime &dateTime) const
Set the STM with the HardwareDateTime values.
Definition: StmRtc.cpp:59
bool isTimeSet() const
Return true if the RTC is available and the time is set.
Definition: StmRtc.cpp:69
StmRtc()=default
Constructor.
void readDateTime(HardwareDateTime *dateTime) const
Read the time into the HardwareDateTime object.
Definition: StmRtc.cpp:18