Skip to content

Commit c862434

Browse files
committed
Declare and use RTC for ESP8266
1 parent e7120b4 commit c862434

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/utility/time/TimeService.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
#include "NTPUtils.h"
2727

28+
#ifdef ARDUINO_ARCH_ESP8266
29+
#include "RTCMillis.h"
30+
#endif
31+
2832
/**************************************************************************************
2933
* GLOBAL VARIABLES
3034
**************************************************************************************/
@@ -33,6 +37,10 @@
3337
RTCZero rtc;
3438
#endif
3539

40+
#ifdef ARDUINO_ARCH_ESP8266
41+
RTCMillis rtc;
42+
#endif
43+
3644
/**************************************************************************************
3745
* INTERNAL FUNCTION DECLARATION
3846
**************************************************************************************/
@@ -476,17 +484,17 @@ unsigned long esp32_getRTC()
476484
#ifdef ARDUINO_ARCH_ESP8266
477485
void esp8266_initRTC()
478486
{
479-
/* Nothing to do */
487+
rtc.begin();
480488
}
481489

482490
void esp8266_setRTC(unsigned long time)
483491
{
484-
/* TODO */
492+
rtc.set(time);
485493
}
486494

487495
unsigned long esp8266_getRTC()
488496
{
489-
/* TODO */
497+
return rtc.get();
490498
}
491499
#endif
492500

0 commit comments

Comments
 (0)