@@ -121,9 +121,10 @@ void ws_sdcard::ConfigureSDCard() {
121121/* *************************************************************************/
122122bool ws_sdcard::InitDS1307 () {
123123 _rtc_ds1307 = new RTC_DS1307 ();
124- if (!_rtc_ds1307->begin ()) {
125- if (!_rtc_ds1307->begin (&Wire1)) {
126- WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS1307 RTC" );
124+ if (!_rtc_ds1307->begin (WsV2._i2c_controller ->GetI2cBus ())) {
125+ WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS1307 RTC on WIRE" );
126+ if (!_rtc_ds1307->begin (WsV2._i2c_controller ->GetI2cBus (true ))) {
127+ WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS1307 RTC on WIRE1" );
127128 delete _rtc_ds1307;
128129 return false ;
129130 }
@@ -144,9 +145,10 @@ bool ws_sdcard::InitDS1307() {
144145bool ws_sdcard::InitDS3231 () {
145146 WS_DEBUG_PRINTLN (" Begin DS3231 init" );
146147 _rtc_ds3231 = new RTC_DS3231 ();
147- if (!_rtc_ds3231->begin (&Wire)) {
148- if (!_rtc_ds3231->begin (&Wire1)) {
149- WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS3231 RTC" );
148+ if (!_rtc_ds3231->begin (WsV2._i2c_controller ->GetI2cBus ())) {
149+ WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS3231 RTC on WIRE" );
150+ if (!_rtc_ds3231->begin (WsV2._i2c_controller ->GetI2cBus (true ))) {
151+ WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize DS3231 RTC on WIRE1" );
150152 delete _rtc_ds3231;
151153 return false ;
152154 }
@@ -165,17 +167,10 @@ bool ws_sdcard::InitDS3231() {
165167*/
166168/* *************************************************************************/
167169bool ws_sdcard::InitPCF8523 () {
168- WsV2._i2c_controller ->ScanI2cBus (true );
169- WS_DEBUG_PRINT (" [sd] Scanned I2C Devices: " )
170- WS_DEBUG_PRINTLN (WsV2._i2c_controller ->GetScanDeviceCount ());
171- WS_DEBUG_PRINT (" Was Device Found? " );
172- WS_DEBUG_PRINTLN (WsV2._i2c_controller ->WasDeviceScanned (0x68 ));
173-
174-
175170 _rtc_pcf8523 = new RTC_PCF8523 ();
176171 if (!_rtc_pcf8523->begin (WsV2._i2c_controller ->GetI2cBus ())) {
177172 WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize PCF8523 RTC on WIRE" );
178- if (!_rtc_pcf8523->begin (&Wire1 )) {
173+ if (!_rtc_pcf8523->begin (WsV2. _i2c_controller -> GetI2cBus ( true ) )) {
179174 WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize PCF8523 RTC on WIRE1" );
180175 delete _rtc_pcf8523;
181176 return false ;
0 commit comments