@@ -121,9 +121,10 @@ void ws_sdcard::ConfigureSDCard() {
121
121
/* *************************************************************************/
122
122
bool ws_sdcard::InitDS1307 () {
123
123
_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" );
127
128
delete _rtc_ds1307;
128
129
return false ;
129
130
}
@@ -144,9 +145,10 @@ bool ws_sdcard::InitDS1307() {
144
145
bool ws_sdcard::InitDS3231 () {
145
146
WS_DEBUG_PRINTLN (" Begin DS3231 init" );
146
147
_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" );
150
152
delete _rtc_ds3231;
151
153
return false ;
152
154
}
@@ -165,17 +167,10 @@ bool ws_sdcard::InitDS3231() {
165
167
*/
166
168
/* *************************************************************************/
167
169
bool 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
-
175
170
_rtc_pcf8523 = new RTC_PCF8523 ();
176
171
if (!_rtc_pcf8523->begin (WsV2._i2c_controller ->GetI2cBus ())) {
177
172
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 ) )) {
179
174
WS_DEBUG_PRINTLN (" [SD] Error: Failed to initialize PCF8523 RTC on WIRE1" );
180
175
delete _rtc_pcf8523;
181
176
return false ;
0 commit comments