Skip to content

Adds default Wire1 pins auto-setup #7034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ bool TwoWire::initPins(int sdaPin, int sclPin)
}
} else {
if(sda==-1) {
#ifdef WIRE1_PIN_DEFINED
sdaPin = SDA1;
#else
log_e("no Default SDA Pin for Second Peripheral");
return false; //no Default pin for Second Peripheral
#endif
} else {
sdaPin = sda; // reuse prior pin
}
Expand All @@ -91,8 +95,12 @@ bool TwoWire::initPins(int sdaPin, int sclPin)
}
} else {
if(scl == -1) {
#ifdef WIRE1_PIN_DEFINED
sclPin = SCL1;
#else
log_e("no Default SCL Pin for Second Peripheral");
return false; //no Default pin for Second Peripheral
#endif
} else {
sclPin = scl; // reuse prior pin
}
Expand Down
1 change: 1 addition & 0 deletions variants/Microduino-esp32/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static const uint8_t RX = 3;
static const uint8_t SDA = 22;//23;
static const uint8_t SCL = 21;//19;

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

Expand Down
1 change: 1 addition & 0 deletions variants/adafruit_qtpy_esp32/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static const uint8_t RX = 7;
static const uint8_t SDA = 4;
static const uint8_t SCL = 33;

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

Expand Down
1 change: 1 addition & 0 deletions variants/adafruit_qtpy_esp32s2/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
static const uint8_t SDA = 7;
static const uint8_t SCL = 6;

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

Expand Down
1 change: 1 addition & 0 deletions variants/adafruit_qtpy_esp32s3_nopsram/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ static const uint8_t RX = 16;
static const uint8_t SDA = 7;
static const uint8_t SCL = 6;

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

Expand Down
1 change: 1 addition & 0 deletions variants/esp32micromod/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static const uint8_t SDA = 21;
static const uint8_t SCL = 22;
static const uint8_t I2C_INT = 4;

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

Expand Down
1 change: 1 addition & 0 deletions variants/openkb/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static const uint8_t OUTPUT2 = 27;
static const uint8_t SDA0 = 21;
static const uint8_t SCL0 = 22;

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

Expand Down