rcttime.cpp: mutex param added

This commit is contained in:
Verkehrsrot committed 2019-03-24 16:17:36 +01:00
1 parent c0abe0652e
commit e18f9fdcae
3 files changed
+7 -5

No files matched your search

+5 -4
View File
@@ -46,14 +46,15 @@ uint8_t rtc_init(void) {
} // rtc_init()
uint8_t set_rtctime(time_t t) { // t is UTC in seconds epoch time
if (I2C_MUTEX_LOCK()) {
Rtc.SetDateTime(RtcDateTime(t - SECS_YR_2000)); // epoch -> sec2000
uint8_t set_rtctime(time_t t, mutexselect_t mutex) { // t is sec epoch time
if (!mutex || I2C_MUTEX_LOCK()) {
#ifdef RTC_INT // sync rtc 1Hz pulse on top of second
Rtc.SetSquareWavePin(DS3231SquareWavePin_ModeNone); // off
Rtc.SetSquareWavePin(DS3231SquareWavePin_ModeClock); // start
#endif
I2C_MUTEX_UNLOCK();
Rtc.SetDateTime(RtcDateTime(t - SECS_YR_2000)); // epoch -> sec2000
if (mutex)
I2C_MUTEX_UNLOCK();
ESP_LOGI(TAG, "RTC time synced");
return 1; // success
} else {