diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index 9053f5b2b..e04f903ee 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -44,7 +44,11 @@ void readFromRTC() if(rtc_found == PCF8563_RTC) { uint32_t now = millis(); PCF8563_Class rtc; +#ifdef RTC_USE_WIRE1 + rtc.begin(Wire1); +#else rtc.begin(); +#endif auto tc = rtc.getDateTime(); tm t; t.tm_year = tc.year - 1900; @@ -110,7 +114,11 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv) #elif defined(PCF8563_RTC) if(rtc_found == PCF8563_RTC) { PCF8563_Class rtc; - rtc.begin(); +#ifdef RTC_USE_WIRE1 + rtc.begin(Wire1); +#else + rtc.begin(); +#endif tm *t = localtime(&tv->tv_sec); rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); DEBUG_MSG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec); diff --git a/src/main.cpp b/src/main.cpp index d4d76cc3b..f9a475af0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -246,6 +246,13 @@ void setup() // In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck if ((HW_VENDOR != HardwareModel_LILYGO_TBEAM_S3_CORE)) { scanI2Cdevice(); + }else{ + // PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus + Wire1.beginTransmission(PCF8563_RTC); + if (Wire1.endTransmission() == 0){ + rtc_found = PCF8563_RTC; + DEBUG_MSG("PCF8563 RTC found\n"); + } } #ifdef RAK4630