Skip to content

Commit 852ea39

Browse files
authored
Adds default Wire1 pins auto-setup (#7034)
1 parent 9432163 commit 852ea39

File tree

7 files changed

+14
-0
lines changed

7 files changed

+14
-0
lines changed

Diff for: libraries/Wire/src/Wire.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ bool TwoWire::initPins(int sdaPin, int sclPin)
7777
}
7878
} else {
7979
if(sda==-1) {
80+
#ifdef WIRE1_PIN_DEFINED
81+
sdaPin = SDA1;
82+
#else
8083
log_e("no Default SDA Pin for Second Peripheral");
8184
return false; //no Default pin for Second Peripheral
85+
#endif
8286
} else {
8387
sdaPin = sda; // reuse prior pin
8488
}
@@ -94,8 +98,12 @@ bool TwoWire::initPins(int sdaPin, int sclPin)
9498
}
9599
} else {
96100
if(scl == -1) {
101+
#ifdef WIRE1_PIN_DEFINED
102+
sclPin = SCL1;
103+
#else
97104
log_e("no Default SCL Pin for Second Peripheral");
98105
return false; //no Default pin for Second Peripheral
106+
#endif
99107
} else {
100108
sclPin = scl; // reuse prior pin
101109
}

Diff for: variants/Microduino-esp32/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static const uint8_t RX = 3;
2626
static const uint8_t SDA = 22;//23;
2727
static const uint8_t SCL = 21;//19;
2828

29+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
2930
static const uint8_t SDA1 = 12;
3031
static const uint8_t SCL1 = 13;
3132

Diff for: variants/adafruit_qtpy_esp32/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static const uint8_t RX = 7;
2323
static const uint8_t SDA = 4;
2424
static const uint8_t SCL = 33;
2525

26+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
2627
static const uint8_t SDA1 = 22;
2728
static const uint8_t SCL1 = 19;
2829

Diff for: variants/adafruit_qtpy_esp32s2/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
static const uint8_t SDA = 7;
3030
static const uint8_t SCL = 6;
3131

32+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
3233
static const uint8_t SDA1 = 41;
3334
static const uint8_t SCL1 = 40;
3435

Diff for: variants/adafruit_qtpy_esp32s3_nopsram/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static const uint8_t RX = 16;
3030
static const uint8_t SDA = 7;
3131
static const uint8_t SCL = 6;
3232

33+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
3334
static const uint8_t SDA1 = 41;
3435
static const uint8_t SCL1 = 40;
3536

Diff for: variants/esp32micromod/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static const uint8_t SDA = 21;
2121
static const uint8_t SCL = 22;
2222
static const uint8_t I2C_INT = 4;
2323

24+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
2425
static const uint8_t SDA1 = 26;
2526
static const uint8_t SCL1 = 25;
2627

Diff for: variants/openkb/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static const uint8_t OUTPUT2 = 27;
8181
static const uint8_t SDA0 = 21;
8282
static const uint8_t SCL0 = 22;
8383

84+
#define WIRE1_PIN_DEFINED 1 // See Wire.cpp at bool TwoWire::initPins(int sdaPin, int sclPin)
8485
static const uint8_t SDA1 = 4;
8586
static const uint8_t SCL1 = 5;
8687

0 commit comments

Comments
 (0)