Adds default Wire1 pins auto-setup (#7034)

This commit is contained in:
Rodrigo Garcia 2022-08-01 09:58:54 -03:00 committed by GitHub
parent 943216308d
commit 852ea39ab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 0 deletions

View File

@ -77,8 +77,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
}
@ -94,8 +98,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
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;